@thermal-print/escpos 0.1.0

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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +193 -0
  3. package/dist/command-adapters/escbematech-adapter.d.ts +30 -0
  4. package/dist/command-adapters/escbematech-adapter.d.ts.map +1 -0
  5. package/dist/command-adapters/escbematech-adapter.js +175 -0
  6. package/dist/command-adapters/escpos-adapter.d.ts +25 -0
  7. package/dist/command-adapters/escpos-adapter.d.ts.map +1 -0
  8. package/dist/command-adapters/escpos-adapter.js +144 -0
  9. package/dist/command-adapters/index.d.ts +11 -0
  10. package/dist/command-adapters/index.d.ts.map +1 -0
  11. package/dist/command-adapters/index.js +14 -0
  12. package/dist/command-adapters/types.d.ts +78 -0
  13. package/dist/command-adapters/types.d.ts.map +1 -0
  14. package/dist/command-adapters/types.js +8 -0
  15. package/dist/commands/escbematech.d.ts +867 -0
  16. package/dist/commands/escbematech.d.ts.map +1 -0
  17. package/dist/commands/escbematech.js +1387 -0
  18. package/dist/commands/escpos.d.ts +582 -0
  19. package/dist/commands/escpos.d.ts.map +1 -0
  20. package/dist/commands/escpos.js +1048 -0
  21. package/dist/converter.d.ts +47 -0
  22. package/dist/converter.d.ts.map +1 -0
  23. package/dist/converter.js +92 -0
  24. package/dist/encodings/cp860.d.ts +25 -0
  25. package/dist/encodings/cp860.d.ts.map +1 -0
  26. package/dist/encodings/cp860.js +187 -0
  27. package/dist/generator.d.ts +118 -0
  28. package/dist/generator.d.ts.map +1 -0
  29. package/dist/generator.js +383 -0
  30. package/dist/index.d.ts +17 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +55 -0
  33. package/dist/styles.d.ts +72 -0
  34. package/dist/styles.d.ts.map +1 -0
  35. package/dist/styles.js +210 -0
  36. package/dist/traverser.d.ts +60 -0
  37. package/dist/traverser.d.ts.map +1 -0
  38. package/dist/traverser.js +285 -0
  39. package/dist/types.d.ts +21 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +5 -0
  42. package/package.json +31 -0
@@ -0,0 +1,867 @@
1
+ /**
2
+ * ESC/Bematech Command Set
3
+ *
4
+ * Command bytes for Bematech MP-4200 TH thermal printer using ESC/Bematech protocol.
5
+ * Reference: Bematech MP-4200 TH Programmer's Manual - Revision 1.0, Chapter 3
6
+ *
7
+ * This file contains all documented ESC/Bematech commands organized by category.
8
+ * Commands follow the Bematech-specific implementation which differs from standard ESC/POS.
9
+ */
10
+ export declare const NUL = 0;
11
+ export declare const SOH = 1;
12
+ export declare const STX = 2;
13
+ export declare const ETX = 3;
14
+ export declare const EOT = 4;
15
+ export declare const ENQ = 5;
16
+ export declare const ACK = 6;
17
+ export declare const BEL = 7;
18
+ export declare const BS = 8;
19
+ export declare const HT = 9;
20
+ export declare const LF = 10;
21
+ export declare const FF = 12;
22
+ export declare const CR = 13;
23
+ export declare const SO = 14;
24
+ export declare const SI = 15;
25
+ export declare const DC2 = 18;
26
+ export declare const DC4 = 20;
27
+ export declare const NAK = 21;
28
+ export declare const SYN = 22;
29
+ export declare const ETB = 23;
30
+ export declare const CAN = 24;
31
+ export declare const ESC = 27;
32
+ export declare const FS = 28;
33
+ export declare const GS = 29;
34
+ export declare const DEL = 127;
35
+ /**
36
+ * ESC @ - Initialize printer to default settings
37
+ * Hexadecimal: 1B 40
38
+ * Decimal: 27 64
39
+ *
40
+ * Cancels all printer settings including character font, line spacing,
41
+ * margins, and returns printer to initial state.
42
+ */
43
+ export declare const INIT: number[];
44
+ /**
45
+ * GS F9h 5 n - Select printer operating mode (permanent)
46
+ * Saves to non-volatile memory
47
+ * n = 0 or 48: ESC/Bema mode
48
+ * n = 1 or 49: ESC/POS mode
49
+ */
50
+ export declare const selectESCBemaMode: () => number[];
51
+ export declare const selectESCPOSMode: () => number[];
52
+ /**
53
+ * GS F9h SP n - Select printer operating mode temporarily
54
+ * Does NOT save to memory
55
+ * n = 0 or 48: ESC/Bema mode
56
+ * n = 1 or 49: ESC/POS mode
57
+ */
58
+ export declare const selectESCBemaModeTemp: () => number[];
59
+ export declare const selectESCPOSModeTemp: () => number[];
60
+ /**
61
+ * GS F9h 1Fh 1 - Return to previously set mode
62
+ * Hexadecimal: 1D F9 1F 31
63
+ */
64
+ export declare const returnToPreviousMode: () => number[];
65
+ /**
66
+ * GS F9h C 00h - Get printer current command set
67
+ * Returns: 0 = ESC/Bema, 1 = ESC/POS
68
+ */
69
+ export declare const GET_CURRENT_MODE: number[];
70
+ /**
71
+ * Code page identifiers
72
+ */
73
+ export declare enum CodePage {
74
+ CP850 = 2,// CODEPAGE 850 (default)
75
+ CP437 = 3,// CODEPAGE 437
76
+ CP860 = 4,// CODEPAGE 860 (Portuguese)
77
+ CP858 = 5,// CODEPAGE 858
78
+ CP866 = 6,// CODEPAGE 866
79
+ CP864 = 7,// CODEPAGE 864
80
+ UTF8 = 8,// UTF8 (Unicode)
81
+ BIG5E = 9,// Big-5E
82
+ JIS = 10,// JIS (0Ah)
83
+ SHIFT_JIS = 11,// SHIFT JIS (0Bh)
84
+ GB2312 = 12,// GB2312 (0Ch)
85
+ EUC_CN = 14,// EUC-CN (0Eh)
86
+ CP862 = 21
87
+ }
88
+ /**
89
+ * ESC t n - Select code page
90
+ * Hexadecimal: 1B 74 n
91
+ * Default: CP850
92
+ */
93
+ export declare const setCodePage: (codePage: CodePage) => number[];
94
+ /**
95
+ * GS F9h 7 n - Set and save printer default code page
96
+ * Saves to non-volatile memory
97
+ */
98
+ export declare const setDefaultCodePage: (codePage: CodePage) => number[];
99
+ /**
100
+ * GS F9h 8 n - Set and save ESC/POS ideogram mode
101
+ * n = 0: UTF8 (Unicode)
102
+ * n = 1: ESC/POS Japanese
103
+ * n = 2: ESC/POS Simplified Chinese
104
+ * n = 3: ESC/POS Traditional Chinese
105
+ */
106
+ export declare const setIdeogramMode: (mode: 0 | 1 | 2 | 3) => number[];
107
+ /**
108
+ * ESC R n - Select international character set
109
+ * n = 0: CODEPAGE 437
110
+ * n = 1-11: CODEPAGE 858
111
+ * n = 12: CODEPAGE 850 (default)
112
+ */
113
+ export declare const setInternationalCharset: (n: number) => number[];
114
+ /**
115
+ * ESC Z - Print supported Unicode sets
116
+ * Prints a chart showing all supported Unicode character sets
117
+ */
118
+ export declare const PRINT_UNICODE_SETS: number[];
119
+ /**
120
+ * ESC [ n - Print specific Unicode set
121
+ * Range: 0 ≤ n ≤ 255
122
+ */
123
+ export declare const printUnicodeSet: (n: number) => number[];
124
+ /**
125
+ * Paper width presets (ESC/Bema mode only)
126
+ * Format: [paper width in mm, printing width in mm]
127
+ */
128
+ export declare enum PaperWidth {
129
+ WIDTH_58_48 = 0,// 58mm paper, 48mm print width
130
+ WIDTH_76_72 = 1,// 76mm paper, 72mm print width
131
+ WIDTH_80_72 = 2,// 80mm paper, 72mm print width
132
+ WIDTH_80_76 = 3,// 80mm paper, 76mm print width (default)
133
+ WIDTH_82_72 = 4,// 82.5mm paper, 72mm print width
134
+ WIDTH_82_76 = 5,// 82.5mm paper, 76mm print width
135
+ WIDTH_82_80 = 6
136
+ }
137
+ /**
138
+ * GS F9h ! n - Set and save paper width
139
+ * Only effective in ESC/Bema mode
140
+ * In ESC/POS mode, paper width is always 80mm/73.5mm
141
+ */
142
+ export declare const setPaperWidth: (width: PaperWidth) => number[];
143
+ /**
144
+ * GS F9h , n - Enable/disable paper near-end sensor (PNES)
145
+ * n = 0 or 48: Disable PNES
146
+ * n = 1 or 49: Enable PNES (default)
147
+ * Saves to non-volatile memory
148
+ */
149
+ export declare const enablePaperNearEndSensor: () => number[];
150
+ export declare const disablePaperNearEndSensor: () => number[];
151
+ /**
152
+ * ESC b n - Select paper sensor to output paper-end signal
153
+ * n = 0 or 48: PE reflects paper sensor (default)
154
+ * n = 1 or 49: PE reflects drawer sensor
155
+ */
156
+ export declare const selectPaperSensor: () => number[];
157
+ export declare const selectDrawerSensor: () => number[];
158
+ /**
159
+ * Printer quality modes
160
+ */
161
+ export declare enum PrinterMode {
162
+ NORMAL = 0,// Normal mode (default)
163
+ HIGH_QUALITY = 1,// High quality mode
164
+ HIGH_SPEED = 2
165
+ }
166
+ /**
167
+ * GS F9h - n - Set and save printer mode
168
+ * Sets printing priority to high quality or high speed
169
+ */
170
+ export declare const setPrinterMode: (mode: PrinterMode) => number[];
171
+ /**
172
+ * ESC N n - Select printing intensity (OBSOLETE)
173
+ * Kept for compatibility with earlier Bematech products
174
+ * Command is ignored by MP-4200 TH
175
+ */
176
+ export declare const setPrintingIntensity: (n: number) => number[];
177
+ /**
178
+ * GS F9h + n - Set and save printing intensity (OBSOLETE)
179
+ * Kept for compatibility with earlier Bematech products
180
+ * Command is ignored by MP-4200 TH
181
+ */
182
+ export declare const setPrintingIntensityAlt: (n: number) => number[];
183
+ /**
184
+ * GS FAh n - Set and save printer language
185
+ * n = 0 or 48: English
186
+ * n = 1 or 49: Portuguese
187
+ * n = 2 or 50: Spanish
188
+ * n = 3 or 51: German
189
+ */
190
+ export declare enum PrinterLanguage {
191
+ ENGLISH = 0,
192
+ PORTUGUESE = 1,
193
+ SPANISH = 2,
194
+ GERMAN = 3
195
+ }
196
+ export declare const setPrinterLanguage: (lang: PrinterLanguage) => number[];
197
+ /**
198
+ * GS F9h ' n - Get printer information
199
+ * Returns different information based on n value:
200
+ * n = 0 or 48: Product code (10 bytes)
201
+ * n = 1 or 49: Serial number (20 bytes)
202
+ * n = 2 or 50: Manufacturing date (4 bytes)
203
+ * n = 3 or 51: Firmware version (3 bytes)
204
+ * n = 5 or 53: Manufacturing timestamp (17 bytes, "dd/mm/yy hh:mm:ss")
205
+ * n = 8 or 56: Interface type (1 byte: 0=None, 1=Serial DB-9, 2=Serial DB-25, 3=Ethernet, -1=Unknown)
206
+ */
207
+ export declare const getPrinterInfo: (infoType: 0 | 1 | 2 | 3 | 5 | 8) => number[];
208
+ /**
209
+ * GS F9h ( 0 - Load default user configuration
210
+ * Reloads all configurations from non-volatile memory and dipswitches
211
+ */
212
+ export declare const LOAD_DEFAULT_CONFIG: number[];
213
+ /**
214
+ * GS F9h ) 0 - Print user configuration
215
+ * Prints current user configuration on paper
216
+ */
217
+ export declare const PRINT_CONFIG: number[];
218
+ /**
219
+ * GS F8h F - Printer reset
220
+ * Forces a hardware reset
221
+ */
222
+ export declare const RESET_PRINTER: number[];
223
+ /**
224
+ * ESC y n - Enable/disable panel keys
225
+ * n = 0 or 48: Disable panel keys
226
+ * n = 1 or 49: Enable panel keys (default)
227
+ */
228
+ export declare const enablePanelKeys: () => number[];
229
+ export declare const disablePanelKeys: () => number[];
230
+ /**
231
+ * ESC x - Enable dump mode
232
+ * Prints data in hexadecimal for debugging
233
+ * WARNING: Only way to exit dump mode is to turn off printer
234
+ */
235
+ export declare const ENABLE_DUMP_MODE: number[];
236
+ /**
237
+ * ESC v n - Activate drawer #1 for n milliseconds
238
+ * Range: 50 ≤ n ≤ 250 (actual: 50ms ≤ n ≤ 200ms)
239
+ */
240
+ export declare const activateDrawer1: (milliseconds: number) => number[];
241
+ /**
242
+ * ESC 80h n - Activate drawer #2 for n milliseconds
243
+ * Range: 50 ≤ n ≤ 250 (actual: 50ms ≤ n ≤ 200ms)
244
+ */
245
+ export declare const activateDrawer2: (milliseconds: number) => number[];
246
+ /**
247
+ * ESC i - Perform full paper cut
248
+ * Hexadecimal: 1B 69
249
+ */
250
+ export declare const CUT_FULL: number[];
251
+ /**
252
+ * ESC w - Perform full paper cut (alternate command)
253
+ * Hexadecimal: 1B 77
254
+ */
255
+ export declare const CUT_FULL_ALT: number[];
256
+ /**
257
+ * GS F9h D m n - Activate buzzer on cut
258
+ * m: Buzzer selection (0=none, 1=internal, 2=external)
259
+ * n: Activation time (n × 100ms)
260
+ * Default: m=0, n=200
261
+ */
262
+ export declare const setBuzzerOnCut: (buzzer: 0 | 1 | 2, time: number) => number[];
263
+ export declare const disableBuzzerOnCut: () => number[];
264
+ /**
265
+ * ESC ( A pL pH fn n1 n2 vol - Activate/deactivate buzzer
266
+ * pL + pH × 256 = 4 (always: pL=4, pH=0)
267
+ * fn = 1 or 49: Activate buzzer
268
+ * fn = 0 or 48: Deactivate buzzer (deprecated)
269
+ * n = (n1 + n2 × 256): Time in milliseconds
270
+ * vol = 0, 1, 48, or 49: Volume (unused)
271
+ */
272
+ export declare const activateBuzzer: (milliseconds: number) => number[];
273
+ /**
274
+ * LF - Feed one line
275
+ * Prints buffer contents and feeds one line according to default line spacing
276
+ */
277
+ export declare const FEED_LINE: number[];
278
+ /**
279
+ * FF - Feed one page
280
+ * Moves from current position to top of next page
281
+ * Can be disabled by setting page size to zero
282
+ */
283
+ export declare const FEED_PAGE: number[];
284
+ /**
285
+ * ESC J n - Perform fine line feed
286
+ * Range: 48 ≤ n ≤ 255
287
+ * Feed: (n - 48) × 0.125mm
288
+ * Widely used for graphics printing
289
+ */
290
+ export declare const fineFeed: (n: number) => number[];
291
+ /**
292
+ * ESC A n - Feed paper by [n × 0.375]mm
293
+ * Range: 0 ≤ n ≤ 255
294
+ * Notes: n < 17 → 0mm, n > 85 → 32mm, else n × 0.375mm
295
+ */
296
+ export declare const feedPaper: (n: number) => number[];
297
+ /**
298
+ * ESC 2 - Set text line height to 1/6 inches (default)
299
+ * Hexadecimal: 1B 32
300
+ */
301
+ export declare const SET_LINE_HEIGHT_DEFAULT: number[];
302
+ /**
303
+ * ESC 3 n - Set line feed to n/144 inches
304
+ * Range: 18 ≤ n ≤ 255
305
+ * Takes effect immediately
306
+ */
307
+ export declare const setLineSpacing: (n: number) => number[];
308
+ /**
309
+ * ESC f 1 n - Vertical skipping
310
+ * Range: 0 ≤ n ≤ 255
311
+ * Performs vertical skipping of n characters
312
+ * Alternate: 1B 66 01 n (same effect)
313
+ */
314
+ export declare const verticalSkip: (n: number) => number[];
315
+ /**
316
+ * ESC f 0 n - Horizontal skipping
317
+ * Range: 0 ≤ n ≤ 255
318
+ * Performs horizontal skipping of n characters
319
+ * Alternate: 1B 66 00 n (same effect)
320
+ */
321
+ export declare const horizontalSkip: (n: number) => number[];
322
+ /**
323
+ * ESC C n - Set page size in lines
324
+ * Range: 0 < n < 256
325
+ * Default: n = 12
326
+ * n represents number of single-height lines
327
+ */
328
+ export declare const setPageSizeLines: (lines: number) => number[];
329
+ /**
330
+ * ESC c n1 n2 - Set page size in millimeters
331
+ * Range: 0 ≤ n1 ≤ 255, 0 ≤ n2 ≤ 255
332
+ * Page size = 0.125mm × [n1 + (256 × n2)]
333
+ */
334
+ export declare const setPageSizeMM: (n1: number, n2: number) => number[];
335
+ /**
336
+ * ESC z n - Enable/disable automatic line feed
337
+ * n = 0 or 48: Disable (default)
338
+ * n = 1 or 49: Enable
339
+ * When enabled, printer performs LF after receiving CR
340
+ */
341
+ export declare const enableAutoLineFeed: () => number[];
342
+ export declare const disableAutoLineFeed: () => number[];
343
+ /**
344
+ * ESC Q n - Set right margin
345
+ * Range: 0 ≤ n ≤ 255
346
+ * Sets right margin in number of characters from default left margin
347
+ * New margin becomes valid only on next line if on right side of current position
348
+ */
349
+ export declare const setRightMargin: (chars: number) => number[];
350
+ /**
351
+ * ESC l n - Set left margin
352
+ * Range: 0 ≤ n ≤ 255
353
+ * Sets left margin in number of characters from default left margin
354
+ * New margin becomes valid only on next line if on left side of current position
355
+ */
356
+ export declare const setLeftMargin: (chars: number) => number[];
357
+ /**
358
+ * HT - Horizontal tab
359
+ * Moves print position to next tab mark
360
+ * Default: tabs at every 8 character columns (9, 17, 25, ...)
361
+ */
362
+ export declare const TAB: number[];
363
+ /**
364
+ * ESC D n1 ... nk NUL - Set horizontal tab marks
365
+ * Range: 1 ≤ n ≤ 255, 0 ≤ k ≤ 32
366
+ * Default: intervals of 8 characters for font 12x24
367
+ *
368
+ * Example: setTabPositions([8, 16, 24]) sets tabs at columns 9, 17, 25
369
+ * Must be in ascending order and terminated with NUL
370
+ */
371
+ export declare const setTabPositions: (positions: number[]) => number[];
372
+ /**
373
+ * ESC D NUL - Cancel all horizontal tab marks
374
+ */
375
+ export declare const CLEAR_TABS: number[];
376
+ /**
377
+ * ESC a n - Character alignment
378
+ * n = 0 or 48: Left justified (default)
379
+ * n = 1 or 49: Center justified
380
+ * n = 2 or 50: Right justified
381
+ */
382
+ export declare const ALIGN_LEFT: number[];
383
+ export declare const ALIGN_CENTER: number[];
384
+ export declare const ALIGN_RIGHT: number[];
385
+ /**
386
+ * ESC E - Enable emphasized print mode (bold)
387
+ * Hexadecimal: 1B 45
388
+ * Emphasized mode is bolder than normal print
389
+ */
390
+ export declare const BOLD_ON: number[];
391
+ /**
392
+ * ESC F - Disable emphasized print mode (bold)
393
+ * Hexadecimal: 1B 46
394
+ */
395
+ export declare const BOLD_OFF: number[];
396
+ /**
397
+ * ESC - n - Enable/disable underline print mode
398
+ * n = 0 or 48: Disable (default)
399
+ * n = 1 or 49: Enable
400
+ * Underlines every character and space
401
+ */
402
+ export declare const UNDERLINE_ON: number[];
403
+ export declare const UNDERLINE_OFF: number[];
404
+ /**
405
+ * ESC 4 - Enable italic print mode
406
+ * Hexadecimal: 1B 34
407
+ * Available in all other print modes
408
+ */
409
+ export declare const ITALIC_ON: number[];
410
+ /**
411
+ * ESC 5 - Disable italic print mode
412
+ * Hexadecimal: 1B 35
413
+ */
414
+ export declare const ITALIC_OFF: number[];
415
+ /**
416
+ * ESC } n - Turn upside-down printing mode on/off
417
+ * n = 0 or 48: Disable (default)
418
+ * n = 1 or 49: Enable
419
+ */
420
+ export declare const UPSIDE_DOWN_ON: number[];
421
+ export declare const UPSIDE_DOWN_OFF: number[];
422
+ /**
423
+ * ESC S n - Enable superscript or subscript print mode
424
+ * n = 0 or 48: Superscript (print on upper side of line)
425
+ * n = 1 or 49: Subscript (print on bottom side of line)
426
+ */
427
+ export declare const SUPERSCRIPT_ON: number[];
428
+ export declare const SUBSCRIPT_ON: number[];
429
+ /**
430
+ * ESC T - Disable superscript and subscript print modes
431
+ * Hexadecimal: 1B 54
432
+ */
433
+ export declare const SCRIPT_OFF: number[];
434
+ /**
435
+ * ESC ! n - Select print mode (combined control)
436
+ * Bits:
437
+ * 0: Font selection (0=Font A, 1=Font B) - Not documented but works
438
+ * 1-2: Undefined
439
+ * 3: Emphasized (0=clear, 1=set)
440
+ * 4: Double height (0=clear, 1=set)
441
+ * 5: Double width (0=clear, 1=set)
442
+ * 6: Undefined
443
+ * 7: Underline (0=clear, 1=set)
444
+ */
445
+ export declare const calculatePrintMode: (options: {
446
+ emphasized?: boolean;
447
+ doubleHeight?: boolean;
448
+ doubleWidth?: boolean;
449
+ underline?: boolean;
450
+ }) => number[];
451
+ /**
452
+ * ESC d n - Enable/disable double height print mode
453
+ * n = 0 or 48: Disable (default)
454
+ * n = 1 or 49: Enable
455
+ *
456
+ * IMPORTANT: This is different from ESC/POS where ESC d is used for line feed
457
+ */
458
+ export declare const DOUBLE_HEIGHT_ON: number[];
459
+ export declare const DOUBLE_HEIGHT_OFF: number[];
460
+ /**
461
+ * ESC V - Enable on-line double height mode
462
+ * If received at beginning of line: valid for whole line
463
+ * Otherwise: valid only for next incoming characters
464
+ * Returns to normal mode on next line
465
+ */
466
+ export declare const DOUBLE_HEIGHT_ONLINE: number[];
467
+ /**
468
+ * ESC W n - Enable/disable expanded mode (double width)
469
+ * n = 0 or 48: Disable (default)
470
+ * n = 1 or 49: Enable
471
+ * Takes effect immediately
472
+ */
473
+ export declare const DOUBLE_WIDTH_ON: number[];
474
+ export declare const DOUBLE_WIDTH_OFF: number[];
475
+ /**
476
+ * ESC SO - Enable on-line expanded mode
477
+ * Hexadecimal: 1B 0E
478
+ * If received at beginning of line: valid for whole line
479
+ * Otherwise: valid only for next incoming characters
480
+ * Returns to normal mode on next line
481
+ */
482
+ export declare const EXPANDED_ONLINE: number[];
483
+ /**
484
+ * SO - Enable on-line expanded mode (alternate)
485
+ * Hexadecimal: 0E
486
+ * Same as ESC SO
487
+ */
488
+ export declare const EXPANDED_ONLINE_ALT: number[];
489
+ /**
490
+ * DC4 - Disable on-line expanded print
491
+ * Hexadecimal: 14
492
+ * Disables expanded mode if previously set by ESC SO or SO
493
+ */
494
+ export declare const EXPANDED_OFF: number[];
495
+ /**
496
+ * ESC SI - Enable condensed mode
497
+ * Hexadecimal: 1B 0F
498
+ */
499
+ export declare const CONDENSED_ON: number[];
500
+ /**
501
+ * SI - Enable condensed mode (alternate)
502
+ * Hexadecimal: 0F
503
+ * Same as ESC SI
504
+ */
505
+ export declare const CONDENSED_ON_ALT: number[];
506
+ /**
507
+ * ESC H - Disable condensed mode
508
+ * Hexadecimal: 1B 48
509
+ * Same as DC2 or ESC P
510
+ */
511
+ export declare const CONDENSED_OFF: number[];
512
+ /**
513
+ * ESC P - Disable condensed mode (alternate)
514
+ * Hexadecimal: 1B 50
515
+ * Same as DC2 or ESC H
516
+ */
517
+ export declare const CONDENSED_OFF_ALT: number[];
518
+ /**
519
+ * DC2 - Disable condensed mode (alternate)
520
+ * Hexadecimal: 12
521
+ * Same as ESC H or ESC P
522
+ */
523
+ export declare const CONDENSED_OFF_DC2: number[];
524
+ /**
525
+ * ESC $ n1 n2 - Fill in blank bit columns
526
+ * Fills blank bit columns from current column to column (n1 + n2 × 256)
527
+ * Must be ≤ printing width N
528
+ */
529
+ export declare const fillBlankColumns: (columns: number) => number[];
530
+ /**
531
+ * ESC * ! n1 n2 b1 ... bn - 24-bit graphics
532
+ * Hexadecimal: 1B 2A 21 n1 n2 b1 ... bn
533
+ * Downloads 24-bit image with (n1 + n2 × 256) columns
534
+ * Each column = 3 bytes (24 bits height)
535
+ * Total bytes needed = columns × 3
536
+ */
537
+ export declare const print24BitGraphics: (columns: number, data: number[]) => number[];
538
+ /**
539
+ * ESC K n1 n2 b1 ... bn - 8-bit graphics
540
+ * Hexadecimal: 1B 4B n1 n2 b1 ... bn
541
+ * Select "8 pin" bit image (compatible with dot-matrix printers)
542
+ * Columns = n1 + (n2 × 256), each column = 1 byte
543
+ * Low resolution (expanded to 3 bytes internally)
544
+ */
545
+ export declare const print8BitGraphics: (columns: number, data: number[]) => number[];
546
+ /**
547
+ * Raster bitmap print modes
548
+ */
549
+ export declare enum RasterMode {
550
+ NORMAL = 0,// 203 dpi × 203 dpi
551
+ DOUBLE_WIDTH = 1,// 203 dpi × 101 dpi
552
+ DOUBLE_HEIGHT = 2,// 101 dpi × 203 dpi
553
+ QUADRUPLE = 3
554
+ }
555
+ /**
556
+ * GS v 0 m xL xH yL yH d1 ... dk - Print raster bitmap
557
+ * m: Mode (0-3 or 48-51)
558
+ * xL, xH: Horizontal bytes = xL + xH × 256
559
+ * yL, yH: Vertical bytes = yL + yH × 256
560
+ * k = (xL + xH × 256) × (yL + yH × 256)
561
+ *
562
+ * Data outside printing area is discarded
563
+ * Affected by HT, ESC $, ESC \, GS L, and ESC a
564
+ */
565
+ export declare const printRasterBitmap: (mode: RasterMode, width: number, height: number, data: number[]) => number[];
566
+ /**
567
+ * GS * x y d1 ... d(x×y×8) - Define downloaded bit image
568
+ * Range: 1 ≤ x ≤ 255, 1 ≤ y ≤ 64
569
+ * Horizontal dots: x × 8
570
+ * Vertical dots: y × 8
571
+ *
572
+ * Cleared by: ESC @, FS q, printer restart, or power cycle
573
+ */
574
+ export declare const defineDownloadedBitImage: (x: number, y: number, data: number[]) => number[];
575
+ /**
576
+ * GS / m - Print downloaded bit image
577
+ * m: Mode (0-3 or 48-51) - same as RasterMode
578
+ * No effect if downloaded image not defined
579
+ */
580
+ export declare const printDownloadedBitImage: (mode: RasterMode) => number[];
581
+ /**
582
+ * FS q n [xL xH yL yH d1 ... dn]1 ... [xL xH yL yH d1 ... dn]n
583
+ * Define NV bit images (stored in non-volatile memory)
584
+ *
585
+ * n: Number of NV bit images (1 ≤ n ≤ 255)
586
+ * xL, xH: Horizontal = (xL + xH × 256) × 8 dots (max 1023 × 8)
587
+ * yL, yH: Vertical = (yL + yH × 256) × 8 dots (max 288 × 8)
588
+ *
589
+ * Erases all previously defined NV images
590
+ */
591
+ export declare const defineNVBitImage: (images: Array<{
592
+ width: number;
593
+ height: number;
594
+ data: number[];
595
+ }>) => number[];
596
+ /**
597
+ * FS p n m - Print non-volatile (NV) bit image
598
+ * n: NV bit image number (as defined by FS q)
599
+ * m: Mode (0-3 or 48-51) - same as RasterMode
600
+ * No effect if n-th NV image not defined
601
+ */
602
+ export declare const printNVBitImage: (imageNumber: number, mode: RasterMode) => number[];
603
+ /**
604
+ * GS h n - Set barcode height
605
+ * Range: 1 ≤ n ≤ 255
606
+ * Default: n = 162
607
+ * Height = n × 0.125mm
608
+ */
609
+ export declare const setBarcodeHeight: (n: number) => number[];
610
+ /**
611
+ * GS w n - Set barcode width
612
+ * Range: 2 ≤ n ≤ 4
613
+ * Default: n = 3
614
+ * n = 2: Normal width
615
+ * n = 3: Double width
616
+ * n = 4: Quadruple width
617
+ */
618
+ export declare const setBarcodeWidth: (width: 2 | 3 | 4) => number[];
619
+ /**
620
+ * Human Readable Information (HRI) position
621
+ */
622
+ export declare enum BarcodeHRIPosition {
623
+ NONE = 0,// No HRI
624
+ TOP = 1,// HRI on top of barcode (default)
625
+ BOTTOM = 2,// HRI on bottom of barcode
626
+ BOTH = 3
627
+ }
628
+ /**
629
+ * GS H n - Choose HRI position in barcode
630
+ * Range: 0 ≤ n ≤ 3
631
+ * Default: n = 1 (top)
632
+ */
633
+ export declare const setBarcodeHRI: (position: BarcodeHRIPosition) => number[];
634
+ /**
635
+ * GS f n - Set HRI font
636
+ * n = 0 or 48: Normal font (default)
637
+ * n = 1 or 49: Condensed font
638
+ */
639
+ export declare const setBarcodeHRIFont: (condensed: boolean) => number[];
640
+ /**
641
+ * GS k 84h n1 n2 - Program barcode left margin
642
+ * Margin position = n1 + n2 × 256
643
+ */
644
+ export declare const setBarcodeLeftMargin: (position: number) => number[];
645
+ /**
646
+ * GS k NUL d1 ... d11 NUL - Print UPC-A barcode
647
+ * Range: 48 ≤ dn ≤ 57 (ASCII digits '0'-'9')
648
+ * Requires exactly 11 digits, checksum generated automatically
649
+ */
650
+ export declare const printBarcodeUPCA: (data: string) => number[];
651
+ /**
652
+ * GS k A VT d1 ... d11 - Print UPC-A barcode (alternate)
653
+ * Same as GS k NUL variant
654
+ */
655
+ export declare const printBarcodeUPCAAlt: (data: string) => number[];
656
+ /**
657
+ * GS k SOH d1 ... d6 NUL - Print UPC-E barcode
658
+ * Range: 48 ≤ dn ≤ 57 (ASCII digits '0'-'9')
659
+ * Requires exactly 6 digits, checksum generated automatically
660
+ */
661
+ export declare const printBarcodeUPCE: (data: string) => number[];
662
+ /**
663
+ * GS k B ACK d1 ... d6 - Print UPC-E barcode (alternate)
664
+ */
665
+ export declare const printBarcodeUPCEAlt: (data: string) => number[];
666
+ /**
667
+ * GS k STX d1 ... d12 NUL - Print EAN-13 barcode
668
+ * Range: 48 ≤ dn ≤ 57 (ASCII digits '0'-'9')
669
+ * Requires exactly 12 digits, 13th digit generated automatically
670
+ */
671
+ export declare const printBarcodeEAN13: (data: string) => number[];
672
+ /**
673
+ * GS k C FF d1 ... d12 - Print EAN-13 barcode (alternate)
674
+ */
675
+ export declare const printBarcodeEAN13Alt: (data: string) => number[];
676
+ /**
677
+ * GS k ETX d1 ... d7 NUL - Print EAN-8 barcode
678
+ * Range: 48 ≤ dn ≤ 57 (ASCII digits '0'-'9')
679
+ * Requires exactly 7 digits, 8th digit generated automatically
680
+ */
681
+ export declare const printBarcodeEAN8: (data: string) => number[];
682
+ /**
683
+ * GS k D BEL d1 ... d7 - Print EAN-8 barcode (alternate)
684
+ */
685
+ export declare const printBarcodeEAN8Alt: (data: string) => number[];
686
+ /**
687
+ * GS k EOT d1 ... dn NUL - Print CODE 39 barcode
688
+ * Valid characters: 32 (space), 36 ($), 37 (%), 42 (*), 43 (+), 45-57 (-, ., /, 0-9), 65-90 (A-Z)
689
+ * Checksum generated automatically
690
+ * Length limited by physical print width and barcode width setting
691
+ */
692
+ export declare const printBarcodeCODE39: (data: string) => number[];
693
+ /**
694
+ * GS k E n d1 ... dn - Print CODE 39 barcode (alternate)
695
+ */
696
+ export declare const printBarcodeCODE39Alt: (data: string) => number[];
697
+ /**
698
+ * GS k ENQ d1 ... dn NUL - Print ITF barcode
699
+ * Range: 48 ≤ dn ≤ 57 (ASCII digits '0'-'9')
700
+ * Length limited by physical print width and barcode width setting
701
+ */
702
+ export declare const printBarcodeITF: (data: string) => number[];
703
+ /**
704
+ * GS k F n d1 ... dn - Print ITF barcode (alternate)
705
+ */
706
+ export declare const printBarcodeITFAlt: (data: string) => number[];
707
+ /**
708
+ * GS k ACK d1 ... dn NUL - Print CODABAR barcode
709
+ * Valid: 36 ($), 43 (+), 45-57 (-, ., /, 0-9), 65-68 (A-D uppercase), 97-100 (a-d lowercase)
710
+ * Cannot mix uppercase and lowercase letters
711
+ * If d1 is letter, dn must also be letter
712
+ */
713
+ export declare const printBarcodeCODABAR: (data: string) => number[];
714
+ /**
715
+ * GS k G n d1 ... dn - Print CODABAR barcode (alternate)
716
+ */
717
+ export declare const printBarcodeCODABARAlt: (data: string) => number[];
718
+ /**
719
+ * GS k H n d1 ... dn - Print CODE 93 barcode
720
+ * Range: 0 ≤ dn ≤ 127 (all ASCII characters)
721
+ * Checksum generated automatically
722
+ */
723
+ export declare const printBarcodeCODE93: (data: string) => number[];
724
+ /**
725
+ * GS k I n d1 ... dn - Print CODE 128 barcode
726
+ * Range: 0 ≤ dn ≤ 127 (all ASCII characters)
727
+ * Checksum generated automatically
728
+ */
729
+ export declare const printBarcodeCODE128: (data: string) => number[];
730
+ /**
731
+ * GS k 80h n1 n2 n3 n4 n5 n6 d1 ... dn - Print PDF-417 barcode
732
+ * n1: ECC level (0-8)
733
+ * n2: Pitch height (n2 × 0.125mm)
734
+ * n3: Pitch width (n3 × 0.125mm, range 1-4)
735
+ * n4: Codewords per row (0 = max for pitch width)
736
+ * n5, n6: Byte count (n5 + n6 × 256, must be < 900)
737
+ */
738
+ export declare const printBarcodePDF417: (eccLevel: number, pitchHeight: number, pitchWidth: number, codewordsPerRow: number, data: string) => number[];
739
+ /**
740
+ * GS k NAK d1 ... d9 NUL - Print ISBN barcode
741
+ * Format: X-XXXXX-XXX-X [XXXXX] (hyphens optional in data)
742
+ * Last char before space: 'X' (88) or digit
743
+ * After hyphen+X/digit: optional space + 5 more digits
744
+ */
745
+ export declare const printBarcodeISBN: (data: string) => number[];
746
+ /**
747
+ * GS k SYN d1 ... dn NUL - Print MSI barcode
748
+ * Range: 48 ≤ dn ≤ 57 (ASCII digits '0'-'9')
749
+ * Checksum generated automatically
750
+ */
751
+ export declare const printBarcodeMSI: (data: string) => number[];
752
+ /**
753
+ * GS k 82h n d1 ... dn - Print MSI barcode (alternate)
754
+ */
755
+ export declare const printBarcodeMSIAlt: (data: string) => number[];
756
+ /**
757
+ * GS k ETB d1 ... dn NUL - Print PLESSEY barcode
758
+ * Valid: 48-57 (0-9), 65-70 (A-F uppercase), 97-102 (a-f lowercase)
759
+ * Cannot mix uppercase and lowercase letters
760
+ * Checksum generated automatically
761
+ */
762
+ export declare const printBarcodePLESSEY: (data: string) => number[];
763
+ /**
764
+ * GS k 83h n d1 ... dn - Print PLESSEY barcode (alternate)
765
+ */
766
+ export declare const printBarcodePLESSEYAlt: (data: string) => number[];
767
+ /**
768
+ * ENQ - Printer status enquiry
769
+ * Returns 1 byte with status bits:
770
+ * Bit 0: 0=offline, 1=online
771
+ * Bit 1: 0=paper present, 1=paper out
772
+ * Bit 2: Drawer/paper status (depends on ESC b setting)
773
+ * Bit 3: 0=print head raised, 1=print head down
774
+ * Bit 4: 0=paper full, 1=paper near end
775
+ * Bit 5: 0=command not executed, 1=command executed
776
+ * Bits 6-7: Unused (always 0)
777
+ */
778
+ export declare const STATUS_ENQUIRY: number[];
779
+ /**
780
+ * GS F8h 1 - Printer extended status enquiry
781
+ * Returns 5 status bytes with detailed printer information
782
+ */
783
+ export declare const EXTENDED_STATUS: number[];
784
+ /**
785
+ * STX - Clear buffer
786
+ * Clears print buffer without restoring default printer conditions
787
+ */
788
+ export declare const CLEAR_BUFFER: number[];
789
+ /**
790
+ * ETX - End buffer
791
+ * Printer remains in BUSY state until print buffer becomes empty
792
+ * DTR (RTS) remains deactivated while printing on serial interfaces
793
+ */
794
+ export declare const END_BUFFER: number[];
795
+ /**
796
+ * CAN - Cancel last line
797
+ * Clears last line sent to printer
798
+ * No action if data already dispatched to print head
799
+ */
800
+ export declare const CANCEL_LINE: number[];
801
+ /**
802
+ * DEL - Cancel last character
803
+ * Clears last character sent to printer
804
+ * No action if already dispatched to print head
805
+ */
806
+ export declare const CANCEL_CHAR: number[];
807
+ /**
808
+ * GS F7h BS NUL " i1 i2 i3 i4 s1 s2 s3 s4 - Set IP address and subnet mask
809
+ * i1-i4: IP address octets
810
+ * s1-s4: Subnet mask octets
811
+ *
812
+ * Example: IP 10.10.1.2, Mask 255.255.0.0
813
+ * Command: 1D F7 08 00 22 0A 0A 01 02 FF FF 00 00
814
+ *
815
+ * Valid only for ethernet or wi-fi interface
816
+ */
817
+ export declare const setIPAddress: (ip: [number, number, number, number], subnet: [number, number, number, number]) => number[];
818
+ /**
819
+ * GS F7h EOT NUL ' g1 g2 g3 g4 - Set default gateway IP address
820
+ * g1-g4: Gateway IP address octets
821
+ * Default: 0.0.0.0
822
+ *
823
+ * Example: Gateway 192.168.1.2
824
+ * Command: 1D F7 04 00 27 C0 A8 01 02
825
+ */
826
+ export declare const setGateway: (gateway: [number, number, number, number]) => number[];
827
+ /**
828
+ * GS F9h E n - Set DHCP usage
829
+ * LSB of n: 0 = DHCP disabled (default), 1 = DHCP enabled
830
+ * Saves to non-volatile memory
831
+ * Valid only for ethernet or wi-fi interface
832
+ */
833
+ export declare const enableDHCP: () => number[];
834
+ export declare const disableDHCP: () => number[];
835
+ /**
836
+ * GS F9h S m ip1 ip2 ip3 ip4 n c1 ... cn - Set SNMP settings
837
+ * m: 0 = disabled, non-zero = enabled
838
+ * ip1-ip4: SNMP trap IP address
839
+ * n: Community name length (0-64)
840
+ * c1-cn: Community name bytes
841
+ *
842
+ * Valid only for ethernet or wi-fi interface
843
+ */
844
+ export declare const setSNMP: (enabled: boolean, ip: [number, number, number, number], community: string) => number[];
845
+ /**
846
+ * GS F9h W a s c m n e1...em p1...pn - Set Wi-Fi settings
847
+ * a: Access mode (0=Access Point, 1=Ad-hoc)
848
+ * s: Security mode (0=None, 1=WEP 64-bit, 2=WEP 128-bit, 3=WPA-TKIP, 4=WPA2-AES)
849
+ * c: Channel (0-13, use 0 when a=0)
850
+ * m: ESSID size (0-32)
851
+ * n: Passphrase size (0-63)
852
+ * e1-em: ESSID bytes
853
+ * p1-pn: Passphrase bytes
854
+ *
855
+ * Valid only for wi-fi interface
856
+ */
857
+ export declare const setWiFi: (accessMode: 0 | 1, securityMode: 0 | 1 | 2 | 3 | 4, channel: number, essid: string, passphrase: string) => number[];
858
+ /**
859
+ * Convert string to code page bytes
860
+ * Uses CP860 encoding by default (Portuguese)
861
+ */
862
+ export declare const encodeText: (text: string, codePage?: CodePage) => number[];
863
+ /**
864
+ * Validate barcode data
865
+ */
866
+ export declare const validateBarcodeData: (data: string, type: "numeric" | "alphanumeric" | "all") => boolean;
867
+ //# sourceMappingURL=escbematech.d.ts.map