ESCPOS For Printer
ESCPOS For Printer
ESCPOS For Printer
COMMAND SPECIFICATION
Cash drawer control pulse Shift between Simplified Chinese and Traditional Chiness
Set character line spacing Select cutting mode and cut paper
Print and take the paper n-point line Set bar code width
Partial cut Set the character black and white inverted print mode
Partial Cut
DLE EOT n
Control Commands Details
Name Transmission real-time status.
Command Notation Format ASCII DLE EOT n
[Name] The name of the command. Hex 10 04 n
[Format] The code sequence. ASCII Indicates the ASCII equivalents. Decimal 16 4 n
Hex indicates the hexadecimal equivalents. Range 1 n 4
Decimal indicates the decimal equivalents. Description Transmits the status specified by n in real-time as follows:
[ ] k indicates the contents of the [ ] should be repeated k times.
[Range] Gives the allowable ranges for the arguments. n Function
[Description] Describes the function of the command. 1 Transmit printer status.
4 Transmit paper roll sensor status.
Explanation of Terms This printer transmits the following status in real time.
n = 1: Printer status:
LSB Least Significant Bit
Bit Off/On Hex Decimal Function
0 Off 00 0 Fixed
Control Commands Details 1 On 02 2 Fixed
2 Off 00 0 Fixed
Off 00 0 On-Line
HT On 08 8 Off-Line
4 On 10 16 Fixed
Name Horizontal tab 5 Off 00 0 Fixed
Format ASCII HT 6 Off 00 0 Fixed
Hex 09 7 Off 00 0 Fixed
Decimal 9
n = 4: Continuous paper sensor status:
Description Moves the print position to the next horizoutal tab position.
Bit Off/On Hex Decimal Function
Details Reference to ESC D 0 Off 00 0 Fixed
1 On 02 2 Fixed
2 Off 00 0 Fixed
LF 3 Off 00 0 Fixed
4 On 10 16 Fixed
Name Print and line feed. 5 60 96 Paper roll near-end sensor : paper near end.
On
Format ASCII LF 6 Off 00 0 Paper roll near-end sensor : paper adequate
Hex 0A 7 Off 00 0 Fixed
Decimal 10
Description In standard mode, prints the data in the print buffer and feeds one line Notes If print data includes a character string with this command, the printer performs
based on the current line spacing. this command.
If the buffer is empty, the printer will only feed one line.
DLE DC4 m n1 n2
CR [Name] Generate pulse.
Name Print and carriage return. [Format] ASCII DLE DC4 m n1 n2
Format ASCII CR Hex 10 14 m n1 n2
Decimal 16 20 m n1 n2
Hex 0D
Decimal 13 [Range] 0 n1 255, 0 n2 255
Description print data in buffer without feed line. [Description] To form a certain interval pulse to control cash drawer according to n1
and n2 .
01 02
ESC SP n ESC * m nL nH d1...dk
[Name] Set right-side character spacing. [Name] Select bit image mode.
[Format] ASCII ESC SP n [Format] ASCII ESC * m nL nH d1...dk
Hex 1B 20 n Hex 1B 2A m nL nH d1...dk
Decimal 27 32 n
Decimal 27 42 m nL nH d1...dk
[Range] 0 n 255
[Description] Sets the character spacing for the right side of the character to [Range] m = 0, 1, 3 2, 33
[ n horizontal or vertical motion unit]. 1 (nL + nH x 256) 1023 (0 nL 255, 0 nH 3),0 d 255
The maximum of the right-side spacing is -31.875mm. [Description] Specifies the bit image in m mode for the number of dots specified
[Default] n=0 by nL and nH.
Number of Vertical Horizontal
dots in
ESC ! n m Mode vertical
Dot dot Number of bytes (k)
density density
direction
[Name] Select print mode(s). 0 8 nL + nH x 256
8-dot single-density 60 90
[Format] ASCII ESC ! N 1 8 180 nL + nH x 256
8-dot double-density 60
Hex 1B 21 n 32 24-dot single-density 24 180 90 (nL + nH x 256) x 3
Decimal 27 33 n 33 24-dot double-density 24 180 180 (nL + nH x 256) x 3
[Range] 0 n 255
[Description] Selects print mode(s) using n as follows: ES C - n
Bit Off/On Hex Decimal Function
Off 00 0 [Name] Set the character under line mode.
0 Character font A (12 X24) selected.
Character font B(9X17) selected.
[Format] ASCII ESC - n
On 01 1
1 ,2 Off 00 0 Reserved. Hex 1B 2D n
Off 00 0 Emphasized mode not selected. Decimal 27 45 n
3 Emphasized mode selected.
On 08 8 0 n 2, 48 n 50
Double-height mode not selected. [Range]
4 Off 00 0
[Description] Turn on /off underline mode according to n :
On 10 16 Double-height mode selected.
Off 00 0 Double-width mode not selected. n Function
5
On 20 32 Double-width mode selected.
6 Off 00 0 Reserved. 0,48 Turns off underline mode.
7 Off 00 0 Underline mode not selected. 1,49 Turns on underline mode, set width at 1-dot
On 80 128 Underline mode selected.
2,50 Turns on underline mode, set width at 2-dot
[Default] n=0
Emphsized mode is effective for alphanameric and kanji
All print modes except emphasized is effective only for alphanameric.
ESC 2
[Default]
[Name] Select default line spacing.
[Format] ASCII ESC 2
Hex 1B 32
Decimal 27 50
03 04
ESC 3 n ESC D n1...nK NULL
[Name] Set line spacing.
[Name] Set horizontal tab positions.
[Format] ASCII ESC 3 n [Format]
Hex 1B 33 n
Decimal 27 51 n
[Range] 0 n 255 [Range] 0 n 1,...nK 255
[Description] Set the line spacing to n/144 inch [Description] Set horizontal tab positions
The maximum line spacing is 1016 mm (40 inch), line spacing n specifies the number of digits from the setting position to the left
larger than 1016 mm will be still handled as 1016mm.The default margin or the beginning of the line.
line spacing is approx 4.23 mm (1 / 6 inch). k specifies the number of bytes set for the horizontal tab position.
[Default] 0 K 32
ESC 9 m n1 n2 n=8,16,24,32,40...232,240,248.
[Name] Cash drawer control pulse.
[Format] ASCII ESC 9 m n1 n2
ESC E n
Hex 1B 39 m n1 n2
Decimal 27 57 m n1 n2 [Name] Turn emphasized mode on / off.
[Range] M=0 [Format] ASCII ESC E n
0 n1 255, 0 n2 255 Hex 1B 45 n
[Description] To form a certain interval pulse to control cash drawer according to Decimal 27 69 n
[Range] 1 n 255
Turns emphasized mode on or off.
- When the LSB of n is 0, emphasized mode is turned off.
[Description] - When the LSB of n is 1, emphasized mode is turned on.
ESC @
n=0
[Name] Initialize printer
[Format] ASCII ESC @
Hex 1B 40 ESC G n
Decimal 27 64 [Name] Turn double-strike mode on/off.
[Description] Clear the buffer data and return to default settings [Format] ASCII ESC G n
Hex 1B 47 n
Decimal 27 71 n
ESC A n
[Range] 0 n 255
[Name] Set character line spacing. [Description] Turns double-strike mode on or off.
[Format] ASCII ESC A n - When the LSB of n is 0, double-strike mode is turned off.
Hex 1B 41 n - When the LSB of n is 1, double-strike mode is turned on.
[Default] n=0
Decimal 27 65 n
[Range] 0 n 255
[Description] Set the character line spacing at n/144 inch.
Maximum line spacing is 1016 mm (40 inch), if the setting larger than 1016 mm,
line spacing is still 1016 mm.
[Default] The default line spacing is about 4.23 mm (1 / 6 inch).
05 06
ESC J n ESC i
[Name] Print and feed the paper n-point line. [Name] Partial cut.
[Format] ASCII ESC J n [Format] ASCII ESC I
Hex 1B 4A n
Hex 1B 69
Decimal 27 74 n
[ Range] 0 n 255 Decimal 27 105
[Description] Print buffer data and to move forward paper n-point line [Description] to start the partial cut operation.
After the implementation of this command, the current print
position placed on the line starting position.
This command does not affect the ESC2 and ESC3 to set line
spacing.
The maximum spacing feed is 1016mm{40inch}if the line feed ESC m
exceeds 1016mm,the printer will still feed paper at 1016mm.
[Name] Partial Cut.
ESC a n [Format] ASCII ESC m
Hex 1B 6D
[Name] Select justification. Decimal 27 109
[Format] ASCII ESC a n [Description] to start the partial cut operation.
Hex 1B 61 n
Decimal 27 97 n
[Range] 0 n 2, 48 n 50
[Description] In standard mode, aligns all the data in one line to the position specified
by n as follows : ESC p m n1 n2
07 08
ESC t n First byte: Bit Binary Hex Decimal Function
0 0 00 0 Not used, Fixed to Off.
[Name] Select character set code page. 1 0 00 0 Not used, Fixed to Off.
[Format] ASCII ESC t n 2 1 04 4 Not used, Fixed to On.
Hex 1B 74 n 0 00 0 Idle.
3
Decimal 27 116 n 1 08 8 Busy.
[Range] 0 n 255 4 1 10 16 Not used, Fixed to On.
[Description] Selects character set code page according to n . 0 00 0 Cover is closed.
5
1 20 32 Cover is open.
6 0 00 0 Not used, Fixed to Off.
[Default]
7 0 00 0 Not used, Fixed to Off.
Second byte:
Bit Binary Hex Decimal Function
0 0 00 0 Not used, Fixed to Off.
1 0 00 0 Not used, Fixed to Off.
2 0 00 0 Not used, Fixed to Off.
3 0 00 0 Not used, Fixed to Off.
4 0 00 0 Not used, Fixed to Off.
5 0 00 0 Printing is being Continue
1 20 32 Printing is being stopped.
6
0 00 0 Printer head temperature is too normal.
7 1 40 64 Printer head temperature is too high
0 00 0 Not used, Fixed to Off.
09 10
FS W n FS - n
[Name] Turn quadruple-size mode on/off for kanji characters. [Name] Set underline mode for kanji characters .
[Format] ASCII FS W n [Format] ASCII FS - n
Hex 1C 57 n Hex 1C 2D n
Decimal 28 87 n
Decimal 28 45 n
[Range] 0 n 255 [Range] 0 n 2, 48 n 50
[Description] When the LSB of n is 0,quadruple-size mode for kanji characters is [Description] Turn on/off under line mode for kanji characters(non-Chinese
turned off. Characters)according to n :
When the LSB of n is 1,quadruple-size mode for kanji characters is
turned on. n Function
0,48 Turn off underline mode
[Default] n=0 1,49 Turn on Underline mode, set the width at 1-dot
2,50 Turn on Underline mode, set the width at 2-dots
[Default] n=0
FS ! n
FS p n m
[Name] Set kanji character print mode.
[Format] ASCII FS ! N [Name] Print NV bit image.
Hex 1C 21 n [Format] ASCII FS p n m
Decimal 28 33 n
Hex 1C 70 n m
[Range] 0 n 255
[Description] Set the print mode for kanji characters,using n as follows: Decimal 28 112 n m
11 12
FS q n xL xH yL yH d1...dk Hex Decimal Pattern Hex Decimal Pattern
GS ! n
GS E n1 n2 n3 n4 n5 n6 m
[Name] Set the character print mode
[Format] ASCII GS ! N [Name] Modify the MAC address.
Hex 1D 21 n [Format] ASCII GS E n1 n2 n3 n4 n5 n6 m
Decimal 29 33 n Hex 1D 45 n1 n2 n3 n4 n5 n6 m
[Range] 0 n 255 Decimal 29 69 n1 n2 n3 n4 n5 n6 m
[Description] Selects the character height using bits 0 to 2 and selects the
character width using bits 4 to 7 as follows. [Description] 0 n1,n2,n3,n4,n5,n6 255
m = n1 + n2 + n3 + n4 + n5 + n6
Bit Off/On Hex Decimal [Description] [Default] n1 is the highest bit of MAC address.
n6 is the lowest bit of MAC address.
0 m is the checksum.
1
Times of the higher mode, see Table 2
2
GS F n
3
4 [Name] Shift between Simplified Chinese and Traditional Chiness.
Times of the width mode, see Table 1 [Format] ASCII GS F n
5
Hex 1D 46 n
6 Decimal 29 70 n
7 [Range] n = 85 170
[Description] When n = 85, select traditional chinese.
Table 1 Times of the wide mode Table 2 Times of the higher mode
When n = 170, select simplified chinese.
[Default] n = 170
13 14
GS D n1 n2 n3 n4 m GS W nL nH
(1)G S V m GS h n
(2)G S V m n
[Name] Selects bar code height.
[Name] Select cutting mode and cut paper. [Format] ASCII GS h n
[Format] (1) ASCII GS V m Hex 1D 68 n
Hex 1D 56 m Decimal 29 104 n
Decimal 29 86 m [Range] 1 n 255
(2) ASCII GS V m n [Description] Set the barcode height according to n .
Hex 1D 56 m n [Default] n = 162
Decimal 29 86 m n
15 16
(1) GS v 0 m xL xH yL yH d1...dk
m Bar Code System Range of k Range of d [Name] Print raster bit image
[Format] ASCII GS v 0 m xL xH yL yH d1...dk
2 JAN13 (EAN13) 12 k 13 48 d 57
Hex 1D 76 30 m xL xH yL yH d1...dk
3 JAN 8 (EAN8) 7 k 8 48 d 57 Decimal 29 118 48 m xL xH yL yH d1...dk
[Range] 0 m 3, 48 m 51, 0 xL 255, 0 xH 255,
48 d 57, 65 d 90,
4 CODE39 0 yL 255, 0 yH 8, 0 d 255
32,36, 37, 43, 45, 46, 47
k=(xL+xH x 256) x (yL+yH x 256), k 0
(2) [Description] Prints a raster bit image in m mode.
m Bar Code System Range of k Range of d - m specifies the bit image mode:
67 JAN13 (EAN13) 12 k 13 48 d 57 m Mode Vertical dot density Horizontal dot density
68 JAN 8 (EAN8) 7 k 8 48 d 57
48 d 57, 65 d 90, 0,48 Normal 203 DPI 203 DPI
69 CODE39 1 k 255
32,36,37,43,45,46,47 1,49 Double-width 203 DPI 203/2 DPI
73 CODE128 2 k 255 0 d 127
2,50 Double-height 101 DPI 203 DPI
[Notes] Users mostly consider about the quiet area of the barcode (the
left and right margin). 3,51 Quadruple 203/2 DPI 101 DPI
xL, xH specifies (xL + xH x 256) byte(s) in the horizontal direction for the
bit image.
GS r n
yL, yH specifies (yL + yH x 256) dot(s) in the vertical direction for the bit
[Name] Transmit status. image.
[Format] ASCII GS r n In standard mode, this command is valid if there is no data in buffer
Hex 1D 72 n Any printing mode does not affects bit image data .
Decimal 29 114 n d defines bit image data .when d is set 1 one dot will be printed;
[Range] n=1,2,49,50 when d is ser 0 no dot will be printed.
[Description] Transmits the normal status specified by n as follows:
Eg:When the xL + xH x 256 = 64:
N Function (xL + xH x 256)x 8 dot=512points
17 18
GS w n
n Width(mm)
2 0.25
3 0.375
4 0.5
5 0.625
6 0.75
[Default]
GS B n
[Name] Set the character black and white inverted print mode.
[Format] ASCII GS B n
Hex 1D 42 n
Decimal 29 66 n
[Range] 0 n 255
[Description] Turns on/off the black/white inverted printing mode.
if the LSB bitof n is 0 , turn off the inverted printing mode .
if the LSB bit of n is 1 , turn on the inverted printing mode .
[Default] n=0
19