ESC Commands: Difference between revisions
(→CR) |
No edit summary |
||
(32 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Technical manual== | |||
* [http://ftp.wizarpos.com/device/WizarPOSPrinter_TechnicalManual_en_20200715.pdf Printer Technical Manual] | |||
== ESC Commands== | == ESC Commands== | ||
Line 72: | Line 74: | ||
|} | |} | ||
=== ESC SP | === ESC SP === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! ESC SP | ! ESC SP !! | ||
|- | |- | ||
| Name|| Set the right-side character space | | Name|| Set the right-side character space | ||
Line 94: | Line 96: | ||
|} | |} | ||
=== ESC ! | === ESC ! (Ⅰ) === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 118: | Line 120: | ||
|} | |} | ||
=== ESC ! | === ESC ! (Ⅱ) === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 150: | Line 152: | ||
* GS ! also can set character size. | * GS ! also can set character size. | ||
=== ESC $ | === ESC $ === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 175: | Line 177: | ||
|} | |} | ||
=== ESC * | === ESC * === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 209: | Line 211: | ||
|} | |} | ||
=== ESC - | === ESC - === | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 757: | Line 759: | ||
|- | |- | ||
| Default|| n=0(Suggest to use ESC R command to replace this command) | | Default|| n=0(Suggest to use ESC R command to replace this command) | ||
|} | |||
===ESC { === | |||
{| class="wikitable" | |||
|- | |||
! ESC { !! | |||
|- | |||
| Name|| Turn upside-down printing mode on/off | |||
|- | |||
| Format|| ASCII ESC { n | |||
Hex 1B 7b n | |||
Decimal 27 123 n | |||
|- | |||
| Parameter range|| 0≤n≤255 | |||
|- | |||
| Description||turns upside-down print mode on or off: | |||
* 0 Upside-down print mode is turned off | |||
* 1 Upside-down print mode is turned on | |||
|- | |||
| Note||The settings by this command are effective at the line begin. | |||
|} | |||
=== GS ! === | |||
{| class="wikitable" | |||
|- | |||
! GS ! !! | |||
|- | |||
| Name||Select character size | |||
|- | |||
| Format|| ASCII GS ! n | |||
Hex 1D 21 n | |||
Decimal 29 33 n | |||
|- | |||
| Parameter range|| 0≤n≤255 | |||
|- | |||
| Description|| Function description Character height is set by the bit0~bit3 of n, and character | |||
width is set by bit4~bit7 of n. | |||
|- | |||
| Note|| | |||
* If n is our of range, the command will be ignored. | |||
* Use ESC ! also can turn on/off double-width and double height | |||
|- | |||
| Reference|| ESC ! | |||
|} | |||
=== GS B === | |||
{| class="wikitable" | |||
|- | |||
! GS B !! | |||
|- | |||
| Name|| Turn black/white inverse printing mode on/off | |||
|- | |||
| Format|| ASCII GS B n | |||
Hex 1D 412 n | |||
Decimal 29 66 n | |||
|- | |||
| Parameter range|| 0≤n≤255 | |||
|- | |||
| Description|| turns upside-down print mode on or off. | |||
* 0 Black/white inverse printing mode is turned off | |||
* 1 Black/white inverse printing mode is turned on | |||
|- | |||
| Note|| | |||
* Also effective the blank set by ESC SP. | |||
* Not effective the blank set by HT、ESC $ and ESC \. | |||
* Not effective the line space. | |||
* This command prior to the underline mode, but can not cancel the underline mode. | |||
|- | |||
| Default||n=0 | |||
|} | |||
=== GS v 0 === | |||
{| class="wikitable" | |||
|- | |||
! GS v 0 !! | |||
|- | |||
| Name|| Print raster bit image | |||
|- | |||
| Format|| ASCII GS v 0 m xL xH yL yH d1...dk | |||
Hex 1D 76 30 m xL xH yL yH d1...dk | |||
Decimal 29 118 48 m xL xH yL yH d1...dk | |||
|- | |||
| Parameter range|| | |||
* 0≤m≤3 | |||
* 48≤m≤51 | |||
* 0≤xL≤255 | |||
* 0≤xH≤255,1≤(xL+xH×256)≤128 | |||
* 0≤yL≤255 | |||
* 0≤yH≤8,1≤(yL+yH×256)≤4095 | |||
* 0≤d≤255 | |||
* k=(xL+xH×256)×(yL+yH×256)(k>0) | |||
|- | |||
| Description|| Print raster bit image, the meanings of parameter m are as follows: | |||
{| class="wikitable" | |||
|- | |||
| m || Mode || Vertical dot density ||Horizontal dot density | |||
|- | |||
| 0, 48|| Normal ||203.2 dpi || 203.2 dpi | |||
|- | |||
| 1, 49|| Double width ||203.2 dpi ||101.6 dpi | |||
|- | |||
| 2, 50|| Double height||101.6 dpi ||203.2 dpi | |||
|- | |||
|3, 51 ||Double width & double height||101.6 dpi ||101.6 dpi | |||
|} | |||
|- | |||
| Note|| | |||
* xL, xH specifies (xL + xH × 256) bytes in horizontal direction for the bit image. | |||
* yL, yH specifies (yL + yH × 256) dots in vertical direction for the bit image. | |||
* [d]k specifies the bit image data (raster format). k indicates the number of bit image data. k is an explanation parameter; therefore, it does not need to be transmitted | |||
* The print mode command will not affect the command. | |||
* The data out print are will be ignored. | |||
* The print position can be set by HT, ESC $, ESC \, GS L. | |||
* ESC a can affect the raster image. | |||
|- | |||
| Reference|| ESC 2,ESC 3 | |||
|} | |||
=== DC2 * === | |||
{| class="wikitable" | |||
|- | |||
!DC2 * !! | |||
|- | |||
| Name|| Bitmap print | |||
|- | |||
| Format|| ASCII DC2 * r n d1...dn | |||
Hex 12 2A r n d1...dn | |||
Decimal 18 42 r n d1...dn | |||
|- | |||
| Parameter range|| | |||
* 0≤n≤255 | |||
* 0<r≤255 | |||
|- | |||
| Description|| | |||
* Print the assigned height bitmap. | |||
* r:height | |||
* n:width | |||
* only effective when no data in print buffer | |||
* the print mode command will not affect this bitmap. | |||
* The data out of print area will be decrypted. | |||
* Dn is the print data, 1 will print, 0 will not print | |||
|} | |||
=== DC2 V === | |||
{| class="wikitable" | |||
|- | |||
! DC2 V !! | |||
|- | |||
| Name|| MSB Bitmap print | |||
|- | |||
| Format|| ASCII DC2 V n nL nH d1...d48 | |||
Hex 12 56 nL nH d1...d48 | |||
Decimal 18 86 nL nH d1...d48 | |||
|- | |||
| Parameter range|| 0<nL+nH×256 | |||
|- | |||
| Description|| | |||
* Print the MSB bitmap, the width is 384. | |||
* The height of the bitmap is nL+nH×256. | |||
* Only effective when no data in print buffer | |||
* The print mode command will not affect this bitmap. | |||
* The data out of print area will be decrypted. | |||
* Dn is the print data, 1 will print, 0 will not print. | |||
|} | |||
=== DC2 v === | |||
{| class="wikitable" | |||
|- | |||
! DC2 v !! | |||
|- | |||
| Name|| LSB Bitmap print | |||
|- | |||
| Format|| ASCII DC2 v n nL nH d1...d48 | |||
Hex 12 76 nL nH d1...d48 | |||
Decimal 18 118 nL nH d1...d48 | |||
|- | |||
| Parameter range|| 0<nL+nH×256 | |||
|- | |||
| Description|| | |||
* Print the LSB bitmap, the width is 384. | |||
* The height of the bitmap is nL+nH×256. | |||
* Only effective when no data in print buffer | |||
* The print mode command will not affect this bitmap. | |||
* The data out of print area will be decrypted. | |||
* Dn is the print data, 1 will print, 0 will not print. | |||
|} | |||
=== DC2 T === | |||
{| class="wikitable" | |||
|- | |||
! DC2 T !! | |||
|- | |||
| Name|| Print test page | |||
|- | |||
| Format|| ASCII DC2 T | |||
Hex 12 54 | |||
Decimal 18 84 | |||
|- | |||
| Description||Print test page | |||
|} | |||
=== ESC A === | |||
{| class="wikitable" | |||
|- | |||
! ESC A !! | |||
|- | |||
| Name|| Check print module version | |||
|- | |||
| Format|| ASCII ESC A | |||
Hex 1B 41 | |||
Decimal 27 65 | |||
|- | |||
| Description|| Send the check command, then read the return value. The return value is 32 bytes(char[32]) | |||
|} | |||
=== ESC > === | |||
{| class="wikitable" | |||
|- | |||
! ESC > !! | |||
|- | |||
| Name|| Check the font library head info | |||
|- | |||
| Format|| ASCII ESC > | |||
Hex 1B 3E | |||
Decimal 27 62 | |||
|- | |||
| Description|| Send the check command, then read the return value. The return value is 128 bytes. | |||
* char magic[8]; | |||
* int version; | |||
* int size; | |||
* int offset; | |||
* char md5[16] | |||
* char time[24]; | |||
* char reserve[2]; | |||
* char describe[64]; | |||
* char unuse; | |||
* char checksum | |||
|} | |||
=== GS E === | |||
{| class="wikitable" | |||
|- | |||
! GS E !! | |||
|- | |||
| Name|| Set print density | |||
|- | |||
| Format|| ASCII GS E n | |||
Hex 1D 45 n | |||
Decimal 29 69 n | |||
|- | |||
| Parameter range|| 0≤n≤3 | |||
|- | |||
| Description|| | |||
{| class="wikitable" | |||
|- | |||
| n || description | |||
|- | |||
| 0|| lighter | |||
|- | |||
| 1|| light | |||
|- | |||
| 2|| dark | |||
|- | |||
| 3|| darker | |||
|} | |||
|- | |||
| Note||This setting will effect all the time until power off the printer or reset the | |||
command | |||
|- | |||
| Default|| n=1 | |||
|} | |} |
Latest revision as of 03:10, 22 April 2021
Technical manual
ESC Commands
HT
HT | |
---|---|
Name | Horizontal tab |
Format | ASCII HT
Hex 09 Decimal 9 |
Description | Move the print position to the next tab position.
|
Reference | ESC D |
LF
LF | |
---|---|
Name | Print and feed paper |
Format | ASCII LF
Hex 0A Decimal 10 |
Description | Print the data in the printer buffer, then feed paper for one line
according to the current line space settings. After printing, the print position moves to the beginning of the line. |
Reference | ESC 2,ESC 3 |
CR
CR | |
---|---|
Name | Carriage return |
Format | ASCII CR
Hex 0D Decimal 13 |
Description | Adjust the print position to the starting position of this line and line
feed. |
Reference | LF |
ESC SP
ESC SP | |
---|---|
Name | Set the right-side character space |
Format | ASCII ESC SP n
Hex 1B 20 n Decimal 27 32 n |
Description | Set the right right-side character space is [n×0.125mm]
|
Default | n=0 |
ESC ! (Ⅰ)
ESC ! n | |
---|---|
Name | set the font type |
Format | ASCII ESC ! n
Hex 1B 21 n Decimal 27 33 n |
Description | Set the font type (italic, border, bold, double width, double height,
inverse or underline). And the bit definitions of parameter n are shown as follows table |
Reference | ESC -, ESC E, GS ! |
Default | n=0 |
ESC ! (Ⅱ)
Bit | On/off | Hex | Decimal | Function |
0 | off | 00 | 0 | Character type A (12×24) |
0 | on | 01 | 1 | Character type B (9×17) |
4 | off | 00 | 0 | Double-height mode off |
4 | on | 10 | 16 | Double-height mode on |
5 | off | 00 | 0 | Double-width mode off |
5 | on | 20 | 32 | Double-width mode on |
7 | off | 00 | 0 | Underline mode off |
7 | on | 80 | 128 | Underline mode on |
- If set double-width and double-height at the same time, quadrupled thecharacter size.
- Can not underline the blank generated by HT or the rotate 90 character.
- The width of under line set by ESC -, have not affected by the character size.
- ESC M also can set character type.
- ESC – also can turn on/off underline.
- GS ! also can set character size.
ESC $
ESC $ nL nH | |
---|---|
Name | Set the absolute print position |
Format | ASCII ESC $ nL nH
Hex ESC $ nL nH Decimal 27 36 nL nH |
Parameter Range |
|
Description | Moves the print position to a location in a distance of (nL + nH × 256) dots from
the starting position for printing |
Reference | ESC \ |
ESC *
ESC * m nL nH d1...dk | |
---|---|
Name | Select bit-image mode |
Format | ASCII ESC * m nL nH d1...dk
Hex 1B 2A m nL nH d1...dk Decimal 27 42 m nL nH d1...dk |
Parameter Range |
|
Description | Stores the bit image data in the print buffer using the mode specified
by bit image mode m, nl and nh specifies a bit image in the horizontal direction as(nl+256×nh) dots, [d]k specifies the bit image data (column format) k indicates the amount of bit image data, but it does not need to be transmitted.. |
Note |
|
ESC -
ESC - n | |
---|---|
Name | Turn underline mode on/off |
Format | ASCII ESC - n
Hex 1B 2D n Decimal 27 45 n |
Description | Turns underline mode on or off using n as follows
|
Note |
Can not underline the blank generated by HT or the rotate 90 character. Default width is 1-dot thick. The thick is not affected by the character size. ESC ! can also turn on/off underline. |
Default | n=0 |
Reference | ESC ! |
ESC 2
ESC 2 | |
---|---|
Name | Set the line space to a default value 3mm |
Format | ASCII ESC 2
Hex 1B 32 Decimal 27 50 |
Description | Set the line space to a default value 3mm(24×0.125mm) |
Reference | ESC 3 |
ESC 3
ESC 3 | |
---|---|
Name | Set the line space to n dots |
Format | ASCII ESC 3 n
Hex 1B 33 n Decimal 27 51 n |
Description | ASet the line space to n dots |
Default | n=24 |
Reference | ESC 2 |
ESC SO
ESC SO | |
---|---|
Name | Turn on double width mode |
Format | ASCII ESC SO n
Hex 1B 0E n Decimal 27 14 n |
Parameter Range | 0≤n≤255 |
Description | Turn on double width mode |
Note | Use LF or ESC DC4 to turn off |
Default | n=2 |
ESC DC4
ESC DC4 | |
---|---|
Name | Turn off double width mode |
Format | ASCII ESC DC4 n
Hex 1B 14 n Decimal 27 20 n |
Parameter Range | 0≤n≤255 |
Description | Turn off double width mode |
Default | n=2 |
Note | The value of n is same with the n in turn on command |
ESC @
ESC @ | |
---|---|
Name | Initialize the printer |
Format | ASCII ESC @
Hex 1B 40 Decimal 27 64 |
Description | Reset the printer, the print mode reset to the default setting |
Note | Can not clear the data in receive buffer |
ESC B
ESC B | |
---|---|
Name | Set the left margin |
Format | ASCII ESC B n
Hex 1B 42 n Decimal 27 66 n |
Parameter Range | 0≤n≤47 |
Description | Set the left margin |
Note | This command just affects the character, doesn’t affect the Chinese |
Default | n=0 |
ESC D
ESC D | |
---|---|
Name | Set horizontal tab positions |
Format | ASCII ESC D n1...nk NUL
Hex 1B 44 n1...nk 00 Decimal 27 68 n1...nk 0 |
Parameter range |
|
Description | Set the horizontal tab positions, the meanings of parameters are as follows:
n1..nk are horizontal tab position (Unit: 8 dots), NULL is a stop character |
Note |
|
Defualt | Default tab position is character type A(12×24), the eight character space
(column 9,17,25 ...) |
Reference | HT |
ESC E
ESC E | |
---|---|
Name | Turn bold mode on/off |
Format | ASCII ESC E n
Hex 1B 45 n Decimal 27 69 n |
Parameter range | 0≤n≤255 |
Descriptiopn | Turns bold mode on or off using n as follows:
If n = 0, turn off the bold, if n = 1, turn on the bold. |
Default | n = 0 |
Reference | ESC ! |
ESC J
ESC J | |
---|---|
Name | Print and feed paper for n dots |
Format | ASCII ESC J n
Hex 1B 4A n Decimal 27 74 n |
Parameter range | 0≤n≤255 |
Description | Print the data in the printer buffer and feed paper for n dots(0.125mm per
dot) |
Note |
|
ESC G
ESC G | |
---|---|
Name | Print and feed paper |
Format | ASCII ESC G n
Hex 1B 47 n Decimal 27 71 n |
Parameter range | 0≤n≤255 |
Description | Turn double-strike mode on/off:
|
Note | The double-strike has the same print with bold print |
Default | n=0 |
Reference | ESC E |
ESC M
ESC M | |
---|---|
Name | Select the character type |
Format | ASCII ESC M n
Hex 1B 4D n Decimal 27 77 n |
Parameter range | n = 0,1,48,49 |
Description | Select character type:
If n=0 or 48,Character type A (12×24) If n=1 or 49,Character type B (9×17) |
Reference | ESC! |
ESC R
ESC R | |
---|---|
Name | Select international character |
Format | ASCII ESC R n
Hex 1B 52 n Decimal 27 82 n |
Parameter range | 0≤n≤255 |
Description | Selects an international character set n as follows::
|
Default | n=0(Suggest to use n >100) |
ESC V
ESC V | |
---|---|
Name | Turn 90° clockwise rotation mode on/off |
Format | ASCII ESC V n
Hex 1B 56 n Decimal 27 86 n |
Parameter range | n = 0,1,48,49 |
Description | Turn 90° clockwise rotation mode on/off using n as follows:
|
Note | Underline is not effective for the rotation characters |
Default | n=0 |
Reference | ESC !,ESC - |
ESC \
ESC \ | |
---|---|
Name | Print and feed paper |
Format | ASCII ESC \ nL nH
Hex 1B 5C nL nH Decimal 27 92 nL nH |
Parameter range |
|
Description | Moves the print position to a location in a distance of (nL + nH × 256) dots from the current position |
Note |
|
Reference | ESC $ |
ESC a
ESC a | |
---|---|
Name | Set the print alignment mode(left, center or right) |
Format | ASCII ESC a n
Hex 1B 61 n Decimal 27 97 n |
Parameter range | n=0,1,2,48,49,50 |
Description | Align all data in a line, the meanings of n value are as follows:
|
Note | The settings by this command are effective at the line begin |
Default | n=0 |
ESC d
ESC d | |
---|---|
Name | Print and feed paper for n lines |
Format | ASCII ESC d n
Hex 1B 64 n Decimal 27 100 n |
Parameter range | 0≤n≤255 |
Description | Print the data in the printer buffer and feed paper for n lines |
Note |
|
Reference | ESC 2,ESC 3 |
ESC t
ESC t | |
---|---|
Name | Select character code table |
Format | ASCII ESC t n
Hex 1B 74 n Decimal 27 116 n |
Parameter range | 0≤n≤255 |
Description | Selects an code n from the character code table as follows:
n Character code table 0 PC437: USA, Standard Europe 1 Katakana 2 PC850: Multilingual 3 PC860: Portuguese 4 PC863: Canadian-French 5 PC865: Nordic 11 PC851: Greek 12 PC853: Turkish 13 PC857: Turkish 14 PC737: Greek 15 ISO8859-7: Greek 16 WPC1252 17 PC866: Cyrillic #2 18 PC852: Latin2 19 PC858: Euro 20 KU42: Thai 21 TIS11: Thai 26 TIS18: Thai 30 TCVN-3: Vietnamese I 31 TCVN-3: Vietnamese II 32 PC720: Arabic 33 WPC775: Baltic Rim 34 PC855: Cylillic 35 PC861: Icelandic 36 PC862: Hebrew 37 PC864: Arabic 38 PC869: Greek 39 ISO8859-2: Latin2 40 ISO8859-15: Latin9 41 PC1098: Farsi 42 PC1118: Lithuanian 43 PC1119: Lithuanian 44 PC1125: Ukrainian 45 WPC1250: Latin 2 46 WPC1251: Cyrillic 47 WPC1253: Greek 48 WPC1254: Turkish 49 WPC1255: Hebrew 50 WPC1256: Arabic 51 WPC1257: Baltic Rim 52 WPC1258: Vietnamese 53 KZ1048: Kazakhstan |
Default | n=0(Suggest to use ESC R command to replace this command) |
ESC {
ESC { | |
---|---|
Name | Turn upside-down printing mode on/off |
Format | ASCII ESC { n
Hex 1B 7b n Decimal 27 123 n |
Parameter range | 0≤n≤255 |
Description | turns upside-down print mode on or off:
|
Note | The settings by this command are effective at the line begin. |
GS !
GS ! | |
---|---|
Name | Select character size |
Format | ASCII GS ! n
Hex 1D 21 n Decimal 29 33 n |
Parameter range | 0≤n≤255 |
Description | Function description Character height is set by the bit0~bit3 of n, and character
width is set by bit4~bit7 of n. |
Note |
|
Reference | ESC ! |
GS B
GS B | |
---|---|
Name | Turn black/white inverse printing mode on/off |
Format | ASCII GS B n
Hex 1D 412 n Decimal 29 66 n |
Parameter range | 0≤n≤255 |
Description | turns upside-down print mode on or off.
|
Note |
|
Default | n=0 |
GS v 0
GS v 0 | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Name | Print raster bit image | ||||||||||||||||||||
Format | ASCII GS v 0 m xL xH yL yH d1...dk
Hex 1D 76 30 m xL xH yL yH d1...dk Decimal 29 118 48 m xL xH yL yH d1...dk | ||||||||||||||||||||
Parameter range |
| ||||||||||||||||||||
Description | Print raster bit image, the meanings of parameter m are as follows:
| ||||||||||||||||||||
Note |
| ||||||||||||||||||||
Reference | ESC 2,ESC 3 |
DC2 *
DC2 * | |
---|---|
Name | Bitmap print |
Format | ASCII DC2 * r n d1...dn
Hex 12 2A r n d1...dn Decimal 18 42 r n d1...dn |
Parameter range |
|
Description |
|
DC2 V
DC2 V | |
---|---|
Name | MSB Bitmap print |
Format | ASCII DC2 V n nL nH d1...d48
Hex 12 56 nL nH d1...d48 Decimal 18 86 nL nH d1...d48 |
Parameter range | 0<nL+nH×256 |
Description |
|
DC2 v
DC2 v | |
---|---|
Name | LSB Bitmap print |
Format | ASCII DC2 v n nL nH d1...d48
Hex 12 76 nL nH d1...d48 Decimal 18 118 nL nH d1...d48 |
Parameter range | 0<nL+nH×256 |
Description |
|
DC2 T
DC2 T | |
---|---|
Name | Print test page |
Format | ASCII DC2 T
Hex 12 54 Decimal 18 84 |
Description | Print test page |
ESC A
ESC A | |
---|---|
Name | Check print module version |
Format | ASCII ESC A
Hex 1B 41 Decimal 27 65 |
Description | Send the check command, then read the return value. The return value is 32 bytes(char[32]) |
ESC >
ESC > | |
---|---|
Name | Check the font library head info |
Format | ASCII ESC >
Hex 1B 3E Decimal 27 62 |
Description | Send the check command, then read the return value. The return value is 128 bytes.
|
GS E
GS E | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Name | Set print density | ||||||||||
Format | ASCII GS E n
Hex 1D 45 n Decimal 29 69 n | ||||||||||
Parameter range | 0≤n≤3 | ||||||||||
Description |
| ||||||||||
Note | This setting will effect all the time until power off the printer or reset the
command | ||||||||||
Default | n=1 |