forked from NielsLeenheer/EscPosEncoder
-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.d.ts
173 lines (156 loc) · 4.72 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
export default class EscPosEncoder {
/**
* Initialize the printer
*
* @return {object} Return the object, for easy chaining commands
*
*/
initialize(): any;
/**
* Change the code page
*
* @param {string} value The codepage that we set the printer to
* @return {object} Return the object, for easy chaining commands
*
*/
codepage(value: string): any;
/**
* Print text
*
* @param {string} value Text that needs to be printed
* @param {number} wrap Wrap text after this many positions
* @return {object} Return the object, for easy chaining commands
*
*/
text(value: string, wrap: number): any;
/**
* Print a newline
*
* @return {object} Return the object, for easy chaining commands
*
*/
newline(): any;
/**
* Print text, followed by a newline
*
* @param {string} value Text that needs to be printed
* @param {number} wrap Wrap text after this many positions
* @return {object} Return the object, for easy chaining commands
*
*/
line(value: string, wrap: number): any;
/**
* Underline text
*
* @param {boolean|number} value true to turn on underline, false to turn off, or 2 for double underline
* @return {object} Return the object, for easy chaining commands
*
*/
underline(value: boolean): any;
/**
* Italic text
*
* @param {boolean} value true to turn on italic, false to turn off
* @return {object} Return the object, for easy chaining commands
*
*/
italic(value: boolean): any;
/**
* Bold text
*
* @param {boolean} value true to turn on bold, false to turn off, or 2 for double underline
* @return {object} Return the object, for easy chaining commands
*
*/
bold(value: boolean): any;
/**
* Change text size
*
* @param {string} value small or normal
* @return {object} Return the object, for easy chaining commands
*
*/
size(value: string): any;
/**
* Change text alignment
*
* @param {string} value left, center or right
* @return {object} Return the object, for easy chaining commands
*
*/
align(value: string): any;
/**
* Barcode
*
* @param {string} value the value of the barcode
* @param {string} symbology the type of the barcode
* @param {number} height height of the barcode
* @return {object} Return the object, for easy chaining commands
*
*/
barcode(value: string, symbology: string, height: number): any;
/**
* QR code
*
* @param {string} value the value of the qr code
* @param {number} model model of the qrcode, either 1 or 2
* @param {number} size size of the qrcode, a value between 1 and 8
* @param {string} errorlevel the amount of error correction used, either 'l', 'm', 'q', 'h'
* @return {object} Return the object, for easy chaining commands
*
*/
qrcode(value: string, model: number, size: number, errorlevel: string): any;
/**
* Image
*
* @param {object} element an element, like a canvas or image that needs to be printed
* @param {number} width width of the image on the printer
* @param {number} height height of the image on the printer
* @param {string} algorithm the dithering algorithm for making the image black and white
* @param {number} threshold threshold for the dithering algorithm
* @return {object} Return the object, for easy chaining commands
*
*/
image(
element: any,
width: number,
height: number,
algorithm: string,
threshold: number
): any;
/**
* Cut paper
*
* @param {string} value full or partial. When not specified a full cut will be assumed
* @return {object} Return the object, for easy chaining commands
*
*/
cut(value: string): any;
/**
* Beeper sound functionality
*
* @return {object} Return the object, for easy chaining commands
*/
beeper(): any;
/**
* Open cash drawer
*
* @return {object} Return the object, for easy chaining commands
*/
openCashDrawer(): any;
/**
* Add raw printer commands
*
* @param {array} data raw bytes to be included
* @return {object} Return the object, for easy chaining commands
*
*/
raw(data: any[]): any;
/**
* Encode all previous commands
*
* @return {Uint8Array} Return the encoded bytes
*
*/
encode(): any;
}