tauri-plugin-thermal-printer 1.2.2 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luis Andres Gonzalez Corzo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -274,7 +274,7 @@ Send a print test to a specific printer to verify functionality.
274
274
 
275
275
  #### Request:
276
276
  ```typescript
277
- import { test_thermal_printer, type TestPrintRequest } from "tauri-plugin-thermal-printer";
277
+ import { ENCODE, test_thermal_printer, type TestPrintRequest } from "tauri-plugin-thermal-printer";
278
278
 
279
279
  try { await test_thermal_printer({
280
280
  "printer_info": {
@@ -283,7 +283,12 @@ try { await test_thermal_printer({
283
283
  "options": {
284
284
  "cut_paper": true,
285
285
  "beep": true,
286
- "open_cash_drawer": false
286
+ "open_cash_drawer": false,
287
+ "code_page": {
288
+ "codepage": 6,
289
+ "encode": ENCODE.WINDOWS_1252,
290
+ "use_gbk": false
291
+ }
287
292
  },
288
293
  "sections": [] // it's not going to print anything
289
294
  },
@@ -341,7 +346,7 @@ Print a personalized document with the specified sections.
341
346
 
342
347
  #### Request:
343
348
  ```typescript
344
- import { print_thermal_printer, type PrintJobRequest } from "tauri-plugin-thermal-printer";
349
+ import { ENCODE, print_thermal_printer, type PrintJobRequest } from "tauri-plugin-thermal-printer";
345
350
 
346
351
  try { await print_thermal_printer({
347
352
  "printer": "TM-T20II",
@@ -349,7 +354,12 @@ try { await print_thermal_printer({
349
354
  "options": {
350
355
  "cut_paper": true,
351
356
  "beep": false,
352
- "open_cash_drawer": false
357
+ "open_cash_drawer": false,
358
+ "code_page": {
359
+ "codepage": 6,
360
+ "encode": ENCODE.WINDOWS_1252,
361
+ "use_gbk": false
362
+ }
353
363
  },
354
364
  "sections": [
355
365
  {"Title": {"text": "My Business"}},
@@ -384,7 +394,7 @@ Returns `Promise<void>`. Resolves when printing completes successfully. **Throws
384
394
  | `options.cut_paper` | boolean | ❌ No | Cut paper after printing (default: `true`) |
385
395
  | `options.beep` | boolean | ❌ No | Beep after printing (default: `false`) |
386
396
  | `options.open_cash_drawer` | boolean | ❌ No | Open cash drawer after printing (default: `false`) |
387
- | `options.code_page` | CodePage | No | Character encoding for special characters (default: `"Default"`) — see [CodePage](#codepage) |
397
+ | `options.code_page` | CodePage | Yes | Required ESC/POS page selection plus host-side encoding strategy — see [CodePage](#codepage) |
388
398
  | `sections` | array | ✅ Yes | Array of sections to print (see [Section Types](#section-types)) |
389
399
 
390
400
  #### Paper Sizes
@@ -881,31 +891,50 @@ The plugin exports typed constants and builder functions so you never have to ty
881
891
 
882
892
  Set the character encoding once in `PrinterOptions.code_page` and all text sections (`Title`, `Subtitle`, `Text`, `Table`) will use it automatically.
883
893
 
894
+ Each printer model assigns its own `ESC t n` values, so `CodePage.codepage` accepts the raw page number directly. `CodePage.encode` controls the host-side encoding used before bytes are sent to the printer. `CodePage.use_gbk` explicitly controls whether characters that the selected `encode` cannot represent should be retried with GBK before falling back to the original UTF-8 bytes.
895
+
884
896
  ```typescript
885
- import { CODE_PAGE, type CodePage } from "tauri-plugin-thermal-printer";
897
+ import { ENCODE, type CodePage } from "tauri-plugin-thermal-printer";
886
898
 
887
- // In your PrintJobRequest:
888
899
  const options = {
889
900
  cut_paper: true,
890
901
  beep: false,
891
902
  open_cash_drawer: false,
892
- code_page: CODE_PAGE.SPANISH, // enables á é í ó ú ñ ü ¿ ¡
903
+ code_page: {
904
+ codepage: 6,
905
+ encode: ENCODE.WINDOWS_1252,
906
+ use_gbk: false,
907
+ }, // sends ESC t 6
893
908
  };
894
909
  ```
895
910
 
896
- | Constant | Value | Code Page | Languages |
897
- |---|---|---|---|
898
- | `CODE_PAGE.DEFAULT` | `"Default"` | CP437 | ASCII only — no accented characters |
899
- | `CODE_PAGE.SPANISH` | `"Spanish"` | CP850 | **Spanish**, French, Italian, German, Portuguese |
900
- | `CODE_PAGE.FRENCH` | `"French"` | CP850 | Alias of Spanish |
901
- | `CODE_PAGE.PORTUGUESE` | `"Portuguese"` | CP860 | **Portuguese** (ã, õ) |
902
- | `CODE_PAGE.CANADIAN_FRENCH` | `"CanadianFrench"` | CP863 | Canadian French |
903
- | `CODE_PAGE.NORDIC` | `"Nordic"` | CP865 | Swedish, Norwegian, Danish, Finnish (å, ø, æ) |
904
- | `CODE_PAGE.WINDOWS_LATIN` | `"WindowsLatin"` | CP1252 | Wide Western European — includes € |
905
- | `CODE_PAGE.RUSSIAN` | `"Russian"` | CP866 | **Russian** / Cyrillic |
906
- | `CODE_PAGE.EASTERN_EUROPE` | `"EasternEurope"` | CP852 | **Polish**, Czech, Slovak, Hungarian |
911
+ `CodePage` fields:
912
+
913
+ | Field | Required | Description |
914
+ |---|---|---|
915
+ | `codepage` | ✅ Yes | Raw `ESC t n` value sent to the printer. |
916
+ | `encode` | No | Host-side encoding strategy. Defaults to `ENCODE.ACCENT_REMOVER`. |
917
+ | `use_gbk` | ❌ No | Retries GBK for characters that `encode` cannot represent before falling back to the original UTF-8 bytes. Defaults to `false`. |
918
+
919
+ `ENCODE.ACCENT_REMOVER`:
907
920
 
908
- > **Note**: Without a `code_page`, accented characters (á, ñ, ü, etc.) will print as `?`. Set it once in `options` and it applies to the entire document.
921
+ - Transliterates accented characters to ASCII before any optional GBK retry
922
+ and final UTF-8 passthrough.
923
+ - Useful when the printer does not have a reliable legacy code page for your
924
+ text.
925
+ - Examples: `á -> a`, `ß -> ss`, `€ -> EUR`.
926
+
927
+ All other `ENCODE.*` values come directly from
928
+ [`encoding_rs` statics](https://docs.rs/encoding_rs/latest/encoding_rs/#statics).
929
+ Use them with the same uppercase names exposed by the package.
930
+
931
+ Examples:
932
+
933
+ - `ENCODE.WINDOWS_1252` for Western European text
934
+ - `ENCODE.GBK` for GBK output
935
+ - `ENCODE.SHIFT_JIS` for Shift JIS output
936
+
937
+ > **Note**: `options.code_page` is required. If the selected `encode` cannot represent a character, the plugin retries GBK only when `use_gbk` is `true`; otherwise it silently emits the original UTF-8 bytes for that character.
909
938
 
910
939
  ---
911
940
 
@@ -1026,13 +1055,13 @@ import {
1026
1055
  pdf417,
1027
1056
  image,
1028
1057
  logo,
1058
+ ENCODE,
1029
1059
  TEXT_ALIGN,
1030
1060
  TEXT_SIZE,
1031
1061
  BARCODE_TYPE,
1032
1062
  BARCODE_TEXT_POSITION,
1033
1063
  QR_ERROR_CORRECTION,
1034
1064
  IMAGE_MODE,
1035
- CODE_PAGE,
1036
1065
  } from "tauri-plugin-thermal-printer";
1037
1066
 
1038
1067
  const job: PrintJobRequest = {
@@ -1042,7 +1071,11 @@ const job: PrintJobRequest = {
1042
1071
  cut_paper: true,
1043
1072
  beep: false,
1044
1073
  open_cash_drawer: false,
1045
- code_page: CODE_PAGE.WINDOWS_LATIN,
1074
+ code_page: {
1075
+ codepage: 6,
1076
+ encode: ENCODE.WINDOWS_1252,
1077
+ use_gbk: false,
1078
+ },
1046
1079
  },
1047
1080
  sections: [
1048
1081
  globalStyles({ align: TEXT_ALIGN.LEFT }),
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ export declare const ENCODE: {
2
+ readonly BIG5: "BIG5";
3
+ readonly EUC_JP: "EUC_JP";
4
+ readonly EUC_KR: "EUC_KR";
5
+ readonly GBK: "GBK";
6
+ readonly IBM866: "IBM866";
7
+ readonly ISO_2022_JP: "ISO_2022_JP";
8
+ readonly ISO_8859_10: "ISO_8859_10";
9
+ readonly ISO_8859_13: "ISO_8859_13";
10
+ readonly ISO_8859_14: "ISO_8859_14";
11
+ readonly ISO_8859_15: "ISO_8859_15";
12
+ readonly ISO_8859_16: "ISO_8859_16";
13
+ readonly ISO_8859_2: "ISO_8859_2";
14
+ readonly ISO_8859_3: "ISO_8859_3";
15
+ readonly ISO_8859_4: "ISO_8859_4";
16
+ readonly ISO_8859_5: "ISO_8859_5";
17
+ readonly ISO_8859_6: "ISO_8859_6";
18
+ readonly ISO_8859_7: "ISO_8859_7";
19
+ readonly ISO_8859_8: "ISO_8859_8";
20
+ readonly ISO_8859_8_I: "ISO_8859_8_I";
21
+ readonly KOI8_R: "KOI8_R";
22
+ readonly KOI8_U: "KOI8_U";
23
+ readonly SHIFT_JIS: "SHIFT_JIS";
24
+ readonly UTF_16BE: "UTF_16BE";
25
+ readonly UTF_16LE: "UTF_16LE";
26
+ readonly UTF_8: "UTF_8";
27
+ readonly GB18030: "GB18030";
28
+ readonly MACINTOSH: "MACINTOSH";
29
+ readonly REPLACEMENT: "REPLACEMENT";
30
+ readonly WINDOWS_1250: "WINDOWS_1250";
31
+ readonly WINDOWS_1251: "WINDOWS_1251";
32
+ readonly WINDOWS_1252: "WINDOWS_1252";
33
+ readonly WINDOWS_1253: "WINDOWS_1253";
34
+ readonly WINDOWS_1254: "WINDOWS_1254";
35
+ readonly WINDOWS_1255: "WINDOWS_1255";
36
+ readonly WINDOWS_1256: "WINDOWS_1256";
37
+ readonly WINDOWS_1257: "WINDOWS_1257";
38
+ readonly WINDOWS_1258: "WINDOWS_1258";
39
+ readonly WINDOWS_874: "WINDOWS_874";
40
+ readonly X_MAC_CYRILLIC: "X_MAC_CYRILLIC";
41
+ readonly X_USER_DEFINED: "X_USER_DEFINED";
42
+ readonly ACCENT_REMOVER: "ACCENT_REMOVER";
43
+ };
44
+ export type Encode = typeof ENCODE[keyof typeof ENCODE];
package/dist-js/index.cjs CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  var core = require('@tauri-apps/api/core');
4
4
 
5
+ const ENCODE = {
6
+ BIG5: 'BIG5',
7
+ EUC_JP: 'EUC_JP',
8
+ EUC_KR: 'EUC_KR',
9
+ GBK: 'GBK',
10
+ IBM866: 'IBM866',
11
+ ISO_2022_JP: 'ISO_2022_JP',
12
+ ISO_8859_10: 'ISO_8859_10',
13
+ ISO_8859_13: 'ISO_8859_13',
14
+ ISO_8859_14: 'ISO_8859_14',
15
+ ISO_8859_15: 'ISO_8859_15',
16
+ ISO_8859_16: 'ISO_8859_16',
17
+ ISO_8859_2: 'ISO_8859_2',
18
+ ISO_8859_3: 'ISO_8859_3',
19
+ ISO_8859_4: 'ISO_8859_4',
20
+ ISO_8859_5: 'ISO_8859_5',
21
+ ISO_8859_6: 'ISO_8859_6',
22
+ ISO_8859_7: 'ISO_8859_7',
23
+ ISO_8859_8: 'ISO_8859_8',
24
+ ISO_8859_8_I: 'ISO_8859_8_I',
25
+ KOI8_R: 'KOI8_R',
26
+ KOI8_U: 'KOI8_U',
27
+ SHIFT_JIS: 'SHIFT_JIS',
28
+ UTF_16BE: 'UTF_16BE',
29
+ UTF_16LE: 'UTF_16LE',
30
+ UTF_8: 'UTF_8',
31
+ GB18030: 'GB18030',
32
+ MACINTOSH: 'MACINTOSH',
33
+ REPLACEMENT: 'REPLACEMENT',
34
+ WINDOWS_1250: 'WINDOWS_1250',
35
+ WINDOWS_1251: 'WINDOWS_1251',
36
+ WINDOWS_1252: 'WINDOWS_1252',
37
+ WINDOWS_1253: 'WINDOWS_1253',
38
+ WINDOWS_1254: 'WINDOWS_1254',
39
+ WINDOWS_1255: 'WINDOWS_1255',
40
+ WINDOWS_1256: 'WINDOWS_1256',
41
+ WINDOWS_1257: 'WINDOWS_1257',
42
+ WINDOWS_1258: 'WINDOWS_1258',
43
+ WINDOWS_874: 'WINDOWS_874',
44
+ X_MAC_CYRILLIC: 'X_MAC_CYRILLIC',
45
+ X_USER_DEFINED: 'X_USER_DEFINED',
46
+ ACCENT_REMOVER: 'ACCENT_REMOVER',
47
+ };
48
+
5
49
  const PAPER_SIZE_CHARS_PER_LINE = {
6
50
  Mm40: 21,
7
51
  Mm44: 24,
@@ -79,29 +123,6 @@ const CUT_MODE = {
79
123
  FULL: 'full',
80
124
  PARTIAL: 'partial',
81
125
  };
82
- const CODE_PAGE = {
83
- /** CP437 — ASCII only, no accented characters */
84
- DEFAULT: 'Default',
85
- /** CP850 — Spanish, French, Italian, German */
86
- SPANISH: 'Spanish',
87
- /** CP850 — Alias of Spanish */
88
- FRENCH: 'French',
89
- /** CP860 — Portuguese (ã, õ) */
90
- PORTUGUESE: 'Portuguese',
91
- /** CP863 — Canadian French */
92
- CANADIAN_FRENCH: 'CanadianFrench',
93
- /** CP865 — Nordic languages (å, ø, æ) */
94
- NORDIC: 'Nordic',
95
- /** CP1252 — Wide Western European, includes € */
96
- WINDOWS_LATIN: 'WindowsLatin',
97
- /** CP866 — Russian / Cyrillic */
98
- RUSSIAN: 'Russian',
99
- /** CP852 — Eastern Europe (Polish, Czech, Slovak, Hungarian) */
100
- EASTERN_EUROPE: 'EasternEurope',
101
- /** Strips accents and special chars to plain ASCII. Use when the printer
102
- * ignores ESC t commands. á→a, é→e, ñ→n, ß→ss, ¿→?, €→EUR, etc. */
103
- ACCENT_REMOVER: 'AccentRemover',
104
- };
105
126
  // ─── Helper builders ──────────────────────────────────────────────────────────
106
127
  /** Creates a Title section */
107
128
  function title(text, styles) {
@@ -248,9 +269,9 @@ async function test_thermal_printer(testPrintRequest) {
248
269
 
249
270
  exports.BARCODE_TEXT_POSITION = BARCODE_TEXT_POSITION;
250
271
  exports.BARCODE_TYPE = BARCODE_TYPE;
251
- exports.CODE_PAGE = CODE_PAGE;
252
272
  exports.CUT_MODE = CUT_MODE;
253
273
  exports.DEFAULT_PAPER_SIZE = DEFAULT_PAPER_SIZE;
274
+ exports.ENCODE = ENCODE;
254
275
  exports.IMAGE_MODE = IMAGE_MODE;
255
276
  exports.PAPER_SIZE_CHARS_PER_LINE = PAPER_SIZE_CHARS_PER_LINE;
256
277
  exports.PAPER_SIZE_PIXELS_WIDTH = PAPER_SIZE_PIXELS_WIDTH;
@@ -1,3 +1,6 @@
1
+ import type { Encode } from './encode';
2
+ export { ENCODE } from './encode';
3
+ export type { Encode } from './encode';
1
4
  export type PaperSize = 'Mm40' | 'Mm44' | 'Mm58' | 'Mm72' | 'Mm80' | 'Mm104';
2
5
  export declare const PAPER_SIZE_CHARS_PER_LINE: Record<PaperSize, number>;
3
6
  export declare const PAPER_SIZE_PIXELS_WIDTH: Record<PaperSize, number>;
@@ -5,22 +8,19 @@ export declare const DEFAULT_PAPER_SIZE: PaperSize;
5
8
  export declare function getPaperSizeCharsPerLine(paperSize: PaperSize): number;
6
9
  export declare function getPaperSizePixelsWidth(paperSize: PaperSize): number;
7
10
  /**
8
- * Character encoding page to use for printing.
9
- * Select by language/region — no need to know ESC/POS code page numbers.
11
+ * ESC/POS page selection plus explicit host-side encoding behavior.
10
12
  *
11
- * | Value | Code Page | Languages |
12
- * |-----------------|-----------|------------------------------------------------|
13
- * | Default | CP437 | ASCII only — no accented characters |
14
- * | Spanish | CP850 | Spanish, French, Italian, German, Portuguese |
15
- * | French | CP850 | Alias of Spanish |
16
- * | Portuguese | CP860 | Portuguese (includes ã, õ) |
17
- * | CanadianFrench | CP863 | Canadian French |
18
- * | Nordic | CP865 | Swedish, Norwegian, Danish, Finnish (å, ø, æ) |
19
- * | WindowsLatin | CP1252 | Wide Western European coverage (includes €) |
20
- * | Russian | CP866 | Russian / Cyrillic |
21
- * | EasternEurope | CP852 | Polish, Czech, Slovak, Hungarian |
13
+ * - `codepage` controls the `ESC t n` command sent to the printer.
14
+ * - `encode` selects the host-side encoding and defaults to
15
+ * `ENCODE.ACCENT_REMOVER`.
16
+ * - `use_gbk` controls whether unmapped non-ASCII characters may fall back
17
+ * to GBK. It defaults to `false`.
22
18
  */
23
- export type CodePage = 'Default' | 'Spanish' | 'French' | 'Portuguese' | 'CanadianFrench' | 'Nordic' | 'WindowsLatin' | 'Russian' | 'EasternEurope' | 'AccentRemover';
19
+ export interface CodePage {
20
+ codepage: number;
21
+ encode?: Encode;
22
+ use_gbk?: boolean;
23
+ }
24
24
  /** Text alignment options */
25
25
  export type TextAlign = 'left' | 'center' | 'right';
26
26
  /** Text size options */
@@ -92,35 +92,12 @@ export declare const CUT_MODE: {
92
92
  readonly FULL: CutMode;
93
93
  readonly PARTIAL: CutMode;
94
94
  };
95
- export declare const CODE_PAGE: {
96
- /** CP437 — ASCII only, no accented characters */
97
- readonly DEFAULT: CodePage;
98
- /** CP850 — Spanish, French, Italian, German */
99
- readonly SPANISH: CodePage;
100
- /** CP850 — Alias of Spanish */
101
- readonly FRENCH: CodePage;
102
- /** CP860 — Portuguese (ã, õ) */
103
- readonly PORTUGUESE: CodePage;
104
- /** CP863 — Canadian French */
105
- readonly CANADIAN_FRENCH: CodePage;
106
- /** CP865 — Nordic languages (å, ø, æ) */
107
- readonly NORDIC: CodePage;
108
- /** CP1252 — Wide Western European, includes € */
109
- readonly WINDOWS_LATIN: CodePage;
110
- /** CP866 — Russian / Cyrillic */
111
- readonly RUSSIAN: CodePage;
112
- /** CP852 — Eastern Europe (Polish, Czech, Slovak, Hungarian) */
113
- readonly EASTERN_EUROPE: CodePage;
114
- /** Strips accents and special chars to plain ASCII. Use when the printer
115
- * ignores ESC t commands. á→a, é→e, ñ→n, ß→ss, ¿→?, €→EUR, etc. */
116
- readonly ACCENT_REMOVER: CodePage;
117
- };
118
95
  export interface PrinterOptions {
119
96
  cut_paper: boolean;
120
97
  beep: boolean;
121
98
  open_cash_drawer: boolean;
122
- /** Character encoding for the printer. Default: 'Default' (ASCII only). */
123
- code_page?: CodePage;
99
+ /** Required ESC/POS page plus host-side encoding strategy. */
100
+ code_page: CodePage;
124
101
  }
125
102
  export interface GlobalStyles {
126
103
  bold?: boolean;
package/dist-js/index.js CHANGED
@@ -1,5 +1,49 @@
1
1
  import { invoke } from '@tauri-apps/api/core';
2
2
 
3
+ const ENCODE = {
4
+ BIG5: 'BIG5',
5
+ EUC_JP: 'EUC_JP',
6
+ EUC_KR: 'EUC_KR',
7
+ GBK: 'GBK',
8
+ IBM866: 'IBM866',
9
+ ISO_2022_JP: 'ISO_2022_JP',
10
+ ISO_8859_10: 'ISO_8859_10',
11
+ ISO_8859_13: 'ISO_8859_13',
12
+ ISO_8859_14: 'ISO_8859_14',
13
+ ISO_8859_15: 'ISO_8859_15',
14
+ ISO_8859_16: 'ISO_8859_16',
15
+ ISO_8859_2: 'ISO_8859_2',
16
+ ISO_8859_3: 'ISO_8859_3',
17
+ ISO_8859_4: 'ISO_8859_4',
18
+ ISO_8859_5: 'ISO_8859_5',
19
+ ISO_8859_6: 'ISO_8859_6',
20
+ ISO_8859_7: 'ISO_8859_7',
21
+ ISO_8859_8: 'ISO_8859_8',
22
+ ISO_8859_8_I: 'ISO_8859_8_I',
23
+ KOI8_R: 'KOI8_R',
24
+ KOI8_U: 'KOI8_U',
25
+ SHIFT_JIS: 'SHIFT_JIS',
26
+ UTF_16BE: 'UTF_16BE',
27
+ UTF_16LE: 'UTF_16LE',
28
+ UTF_8: 'UTF_8',
29
+ GB18030: 'GB18030',
30
+ MACINTOSH: 'MACINTOSH',
31
+ REPLACEMENT: 'REPLACEMENT',
32
+ WINDOWS_1250: 'WINDOWS_1250',
33
+ WINDOWS_1251: 'WINDOWS_1251',
34
+ WINDOWS_1252: 'WINDOWS_1252',
35
+ WINDOWS_1253: 'WINDOWS_1253',
36
+ WINDOWS_1254: 'WINDOWS_1254',
37
+ WINDOWS_1255: 'WINDOWS_1255',
38
+ WINDOWS_1256: 'WINDOWS_1256',
39
+ WINDOWS_1257: 'WINDOWS_1257',
40
+ WINDOWS_1258: 'WINDOWS_1258',
41
+ WINDOWS_874: 'WINDOWS_874',
42
+ X_MAC_CYRILLIC: 'X_MAC_CYRILLIC',
43
+ X_USER_DEFINED: 'X_USER_DEFINED',
44
+ ACCENT_REMOVER: 'ACCENT_REMOVER',
45
+ };
46
+
3
47
  const PAPER_SIZE_CHARS_PER_LINE = {
4
48
  Mm40: 21,
5
49
  Mm44: 24,
@@ -77,29 +121,6 @@ const CUT_MODE = {
77
121
  FULL: 'full',
78
122
  PARTIAL: 'partial',
79
123
  };
80
- const CODE_PAGE = {
81
- /** CP437 — ASCII only, no accented characters */
82
- DEFAULT: 'Default',
83
- /** CP850 — Spanish, French, Italian, German */
84
- SPANISH: 'Spanish',
85
- /** CP850 — Alias of Spanish */
86
- FRENCH: 'French',
87
- /** CP860 — Portuguese (ã, õ) */
88
- PORTUGUESE: 'Portuguese',
89
- /** CP863 — Canadian French */
90
- CANADIAN_FRENCH: 'CanadianFrench',
91
- /** CP865 — Nordic languages (å, ø, æ) */
92
- NORDIC: 'Nordic',
93
- /** CP1252 — Wide Western European, includes € */
94
- WINDOWS_LATIN: 'WindowsLatin',
95
- /** CP866 — Russian / Cyrillic */
96
- RUSSIAN: 'Russian',
97
- /** CP852 — Eastern Europe (Polish, Czech, Slovak, Hungarian) */
98
- EASTERN_EUROPE: 'EasternEurope',
99
- /** Strips accents and special chars to plain ASCII. Use when the printer
100
- * ignores ESC t commands. á→a, é→e, ñ→n, ß→ss, ¿→?, €→EUR, etc. */
101
- ACCENT_REMOVER: 'AccentRemover',
102
- };
103
124
  // ─── Helper builders ──────────────────────────────────────────────────────────
104
125
  /** Creates a Title section */
105
126
  function title(text, styles) {
@@ -244,4 +265,4 @@ async function test_thermal_printer(testPrintRequest) {
244
265
  });
245
266
  }
246
267
 
247
- export { BARCODE_TEXT_POSITION, BARCODE_TYPE, CODE_PAGE, CUT_MODE, DEFAULT_PAPER_SIZE, IMAGE_MODE, PAPER_SIZE_CHARS_PER_LINE, PAPER_SIZE_PIXELS_WIDTH, QR_ERROR_CORRECTION, TEXT_ALIGN, TEXT_FONT, TEXT_SIZE, barcode, beep, cut, dataMatrix, drawer, feed, getPaperSizeCharsPerLine, getPaperSizePixelsWidth, globalStyles, image, line, list_thermal_printers, logo, pdf417, print_thermal_printer, qr, subtitle, table, test_thermal_printer, text, title };
268
+ export { BARCODE_TEXT_POSITION, BARCODE_TYPE, CUT_MODE, DEFAULT_PAPER_SIZE, ENCODE, IMAGE_MODE, PAPER_SIZE_CHARS_PER_LINE, PAPER_SIZE_PIXELS_WIDTH, QR_ERROR_CORRECTION, TEXT_ALIGN, TEXT_FONT, TEXT_SIZE, barcode, beep, cut, dataMatrix, drawer, feed, getPaperSizeCharsPerLine, getPaperSizePixelsWidth, globalStyles, image, line, list_thermal_printers, logo, pdf417, print_thermal_printer, qr, subtitle, table, test_thermal_printer, text, title };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tauri-plugin-thermal-printer",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "author": "luis3132",
5
5
  "description": "Plugin for Tauri to send esc/pos commands to thermal_printer",
6
6
  "type": "module",