ESC-POS Command Set
ESC-POS Command Set
HT
[Name] Horizontal tab
[Format] ASCII HT
Hex 09
Decimal 9
[Description
Move the current position to the next tab position
]
[Note] If the next tab position werent set, this order should be ignored
If the next horizontal tab position is beyond printing area, the current
position should be set as [Printing width+1]
Use ESC D to set the horizontal tab position.
If current position is in[Printing width+1] when receiving this order, the
printer runs the current buffer full actions and move printing position to
the beginning of next line.
The default tab position is to tab by each 8 standard ASCII
characters(12x24)
When the current buffer area is full, printer runs below actions: printer
prints contents of current line and move the print position to the
beginning of next line.
[Reference] ESC D
LF
[Name Print and line feed
[Format] ASCII LF
Hex 0A
Decimal 10
[Description
Print the data in buffer and line feed
]
[Note] This order puts current position to the begins of a line
[Reference] ESC 2, ESC 3
ESC SP n
[Name] Set right-side character spacing
[Format] ASCII ESC SP n
Hex 1B 20 n
Decimal 27 32 n
[Range] 0n255
[Description
Set the right-side character interspaces as N point
]
[Note] This setting only valid to character instead of Chinese.
When character enlarges the interspaces enlarge correspondingly with
same multiples.
[Default] n=0
[Reference] ESC 2, ESC 3
ESC ! n
[Name] Select print mode(s)
[Format] ASCII ESC ! n
Hex 1B 21 n
Decimal 27 33 n
[Range] 0n255
[Description Set the character print mode by the N value
] Decima
1/0 HEX Function
l
0,1,2 undefined
0 00 0 cancel the bold mode
3
1 08 8 select the bold mode
0 00 0 cancel the multi-high mode
4
1 10 16 select the multi-high mode
0 00 0 cancel the multi-wide mode
5
1 20 32 select the multi-wide mode
6 undefined
0 00 0 cancel the underline mode
7
1 80 128 select the underline mode
[Note] When selecting the multi-high and multi-wide mode in the same time, the
characters double in either horizontal and vertical way.
Except the spaces set by HT and characters printed by rotating, any
other characters could be underlined.
ESC- defines the underline but not the characters.
When some characters within one line are multi-high or more, all
characters align to bottom.
ESC E could also select or cancel the bold mode. The final executed
order is valid.
ESC could also select or cancel underline mode. The final executed
order is valid
GS ! could also set the character size. Final executed order is valid.
[Default] n=0
[Reference] ESC -, ESC E, GS !
ESC $ nL nH
[Name] Set absolute print position
[Format] ASCII ESC $ nL nH
Hex 1B 24 nL nH
Decimal 27 36 nL nH
[Range] 0nL2550nH2
[Description
Set the currently position to (nL+nHx256) dot from the beginning of a line.
]
[Note] If the preset position is out of print area, this order will be ignored.
Both horizontal and vertical moving unit is set by GS P
Use the horizontal moving unit under standard mode
Under Page mode, we should select horizontal or vertical moving unit
according to direction and beginning point of the print area. The selection
as below: 1. When the beginning point is set at left upper corner or right
bottom corner by ESC T, select the horizontal. 2. When the beginning
point is set at left bottom corner or right upper corner by ESC T, then
select vertical.
[Reference] ESC \, GS \
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
[Range] m = 0, 1, 32, 330 nL 2550 nH 30 d 255
[Description Select one of the bit-image modes designated by M. The bits are determined
] by nL and nH
Vertical Horizontal
m Mode Do Resolutio Resolutio
Data k
t n n
0 8 Dot single density 8 67DPI 100DPI nL+nH256
1 8 Dot double density 8 67DPI 200DPI nL+nH256
3 24 Dot single
24 200DPI 100DPI (nL+nH256)3
2 density
3 24 Dot double
24 200DPI 200DPI (nL+nH256)3
3 density
[Note] If the value of M exceeds range, nL and data after it will be executed as
common data.
The horizontal printer dots are determined by nL and nH. The total dots
are nL+nHx256
Bit-image which exceeds current area will be cut off.
D is data of bit-image. When all the unit of data be 1 then it prints this
dot, and no printers when be 0.
After sending bit-image data, the printer returns to common data mode.
()This order wont be affected by other printing mode(bold, double
printing, underline, zoom in) except the revert mode.
The relation between data and dots going to be print is as below:
When selecting 8 dot density
When selecting 14 dot density
ESC n /
[Name] Select/cancel user-defined character set
[Format] ASCII ESC - n
Hex 1B 2D n
Decimal 27 45 n
[Range] 0n248n50
[Description Select or cancel underline mode according to value of n
] n Function
0,48 Cancel underline mode
1,49 Select underline mode(1 dot width)
2,50 Select underline mode(2 dot width)
[Note] The underline could be put under all characters(including right GAP) but
not included spaces set by HT
Underline cant be functioned to characters under rotating mode and
revert display
When canceling the underline mode, following characters are without
underlines and underline width unchanged. Default width is one dot.
Changing the character size wont affect current underline width
The cancellation of underline could be set by ESC ! as well. The final
executed order is valid.
[Default] n=0
[Reference] ESC !
ESC 2
[Name] Select default line spacing
[Format] ASCII ESC 2
Hex 1B 32
Decimal 27 50
[Description
Select 30 dots height.
]
[Note]
[Reference] ESC 3
ESC 3 n
[Name] Set line spacing
[Format] ASCII ESC 3 n
Hex 1B 33 n
Decimal 27 51 n
[Range] 0n255
[Description] Set the height of line to be n dot
[Note]
[Default The default value of height of line is 30 dots.
Value]
[Reference] ESC 2
ESC @
[Name] Initialize printer
[Format] ASCII ESC @
Hex 1B 40
Decimal 27 64
[Description Eliminating the data in print buffer area. It is the default mode
] when printing mode is set as power on.
[Note] Save contents in order buffer area.
ESC E n
[Name] Turn emphasized mode on/off
[Format] ASCII ESC E n
Hex 1B 45 n
Decimal 27 69 n
[Range] 0n255
[Description Select or cancel bold mode
] When the lowest position of n is 0, the bold mode canceled.
When the lowest position of n is 1, the bold mode selected
[Note] N validates only at lowest position
/ESC ! could also select/cancel bold mode. The final received order is
valid.
[Default] n=0
[Reference] ESC !
ESC G n
[Name] Turn on/off double-strike mode
[Format] ASCII ESC G n
Hex 1B 47 n
Decimal 27 71 n
[Range] 0n255
[Description Turn on/off double-strike mode
] nWhen the lowest position of n is 0, cancel the double strike mode
n1When the lowest position of n is 1, turn on the double strike mode
[Note] N validates only at lowest position
This order has same effect as bold printing.
[Default] n=0
[Reference] ESC E
ESC J n
[Name] Print and feed paper
[Format] ASCII ESC J n
Hex 1B 4A n
Decimal 27 74 n
[Range] 0n255
[Description
Print the data in buffer area and feed paper for n dots line.
]
[Note] When printing finished, puts the current print position at beginning of line.
ESC 2 ESC 3 Feeding of paper wont be affected by ESC 2 or ESC 3
order set.
The max paper feed is 1016mm(40). If distance exceeds it, the max
value is taken.
[Reference] GS P
ESC V n
[Name] Select rotation mode
[Format] ASCII ESC V n
Hex 1B 56 n
Decimal 27 86 n
[Range] 0 n 348 n 51
[Description
] n Function
0,48
Cancel rotated printing mode, printing character by normal
ESC \ nL nH
[Name] Set relative print position
[Format] ASCII ESC \ nL nH
Hex 1B 5C nL nH
Decimal 27 92 nL nH
[Range] 0 nL 2550 nH 255
[Description Set relative print position by horizontal or vertical moving unit.
] This order sets the print position to (nL+nHx256) dot from current
position.
[Note] Settings exceed printable area are ignored.
When print position moves right: nL+nHx256=N
nL+nH256=65536NWhen print position moves left, nL+nH256=65536N
The print beginning point moves from current position to N dot.
[Reference] ESC $
ESC a n
[Name] Select justification
[Format] ASCII ESC a n
Hex 1B 61 n
Decimal 27 97 n
[Range] 0 n 248 n 50
[Description] Keep all the printing data aligned by certain way.
Relation between alignment way and Value of N
n Alignment way
0,48 Left Alignment
1, 49 Middle
2, 50 right
[Note] This order works only for beginning of line under standard mode.
This order changes only internal bit zone under page mode.
This order adjusts space area according to HT,ESC $ or ESC \ order.
[Default n=0
value]
[Example]
ESC d n
[Name] Print and feed n lines
[Format] ASCII ESC d n
Hex 1B 64 n
Decimal 27 100 n
[Range] 0 n 255
[Description
Print contents in buffer area and feed n lines(character line)
]
[Note] This command sets the start position of printer at the beginning of line.
This command doesnt affect the line distance set by ESC2 or ESC3
The max feeding distance is 1016mm. When value is larger than
1016mm, take the max instead
[Reference] ESC 2, ESC 3
ESC { n /
[Name] Turns on/off upside-down printing mode
[Name] ASCII ESC { n
Hex 1B 7B n
Decimal 27 123 n
[Name] 0 n 255
[Name] selecting or cancel the invert printing mode:
Canceling the invert printing mode when the ns lowest order is 0.
When the lowest of n is 1,the printing mode is invert mode.
[Name] Value N only take affect on lowest order.
This command take affect on the beginning of a line.
In the invert printing mode, the printer will prints content after rotate all the
line for 180 degrees.
[Reference n = 0
]
[Instance]
GS ! n
[Name] Select character size
[Format] ASCII GS ! n
Hex 1D 21 n
Decimal 29 33 n
[Range] 0 n 2551 Vertical zoom in times 81 Horizontal zoom in times 8
[Descriptio Use 0 to 3 to select character height, 4 to 7 to select character width. As
n] below chart
Digit 0/1 Hex Decimal Function
0
1
Character height selectionsee chart2
2
3
4
5
Character width selectionsee chart1
6
7
chart1 chart2
Width selection Height selection
He Decim Horizontal zoom in He Decim Vertical zoom in
x al times x al times
00 0 1 (Normal) 00 0 1 (Normal)
10 16 2 (2 times width) 01 1 2 (2 times height)
20 32 3 02 2 3
30 48 4 03 3 4
40 64 5 04 4 5
50 80 6 05 5 6
60 96 7 06 6 7
70 112 8 07 7 8
[Note] This command validates to all characters(ASCII and Chinese characters),
besides
T the HRI Characters.
If n exceeds regular Range, this command will be ignored.
If same line of characters are with different magnifying times, all
characters align to
Bottom.
ESC ! commend could also select or cancel character width or height. The
final
Received commend valid.
[Default n=0
value]
[Reference] ESC !
GS B n
[Name] Turn white/black reverse printing mode
[Format] ASCII GS B n
Hex 1D 42 n
Decimal 29 66 n
[Range] 0 n 255
[Description /Select/Cancel white black reverse printing mode
] When the lowest of n is 0, cancel the reverse printing.
When the lowest of N is 1, select the reverse printing.
[Note] N only validates to lowest position.
This command is effective to all characters(except the HRI character)
By selecting reverse printing, character distance set by ESC SP
reverses too.
HRI HT,ESC $,ESC \This command wont affect bmp, customized bmp,
bar code HRI character and spaces set by HT,ESC $,ESC \
This command wont affect spaces between lines.
White black reverse printing mode has higher priority than underline mode.
When selecting reverse mode, the underline mode palls on. It wont affect
until the reverse mode is canceled.
[Default] n=0
GS H n
[Name] Select printing position for HRI characters
[Format] ASCII GS H n
Hex 1D 48 n
Decimal 29 72 n
[Range] 0 n3 , 48 n51
[Description] Select printing position for HRI character when printing bar codes.
N defines the HRI printing position
n printing position
0,48 No printing
1,49 Upon bar code
2,50 beneath bar code
3,51 print both up and beneath bar code
HRI is character to Note bar code content
[Note]
[Default
n=0
value]
[Reference] GS f, GS k
GS LnL nH
[Name] Set left margin
[Format] ASCII GS L nL nH
Hex 1D 4C nL nH
Decimal 29 76 nL nH
[Range] 0 nL255 , 0nH255
[Description Set the left margin by nL and nH
] Set the left margin as [(nL+nH256)Horizontal moving unit)] Inch
GS W nL nH
[Name] Set printing area width
[Format] ASCII GS W nL nH
Hex 1D 57 nL nH
Decimal 29 87 nL nH
[Range] 0 nL255 , 0nH255
[Description] Set the printing area width by nL and nH
Set the printing area width as (nL+nH256) dots
GS h n
[Name] Select bar code height
[Format] ASCII GS h n
Hex 1D 68 n
Decimal 29 104 n
[Range] 1 n 255
[Description
Selecting the bar codes height
]
[Default] n = 162
[Reference] GS k
[Note(Page mode)] This order only generates the barcode image to buffer area,
but not printed. After processing barcode data, it moves the
printing position to right side of barcode.
If D exceeds the regular Range, this order will be ignored.
If barcode width exceeds printing area, this order will be
ignored.
[Reference] GS H, GS f, GS h, GS w
GS v 0 m xL xH yL yH d1....dk
[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
0m348m510xL2550xH2550yL2550d255
[Range]
k =(xL+xH256)(yL+yH256)(k0)
[Descri Print Raster bit image, select the mode by m value
ption] Vertical resolution Horizontal
m mode
(DPI) resolution (DPI)
0,48 standard mode 200 200
multi-width
1,49 200 100
mode
Multi-height
2,50 100 200
mode
Multi width and
3,51 multi height 100 100
mode
xL,xH indicates byte qty on horizontal direction
yL, yH indicates byte qty on vertical direction.
[Note] This order effects only when buffer area without data.
Print modes such as zoom in, bold, double print, reverse print, under line,
color reverse wont affect this order.
Bmp which exceeds printing area wont be printed.
ESC a(select align mode) effects to raster bit image.
D represents bmp data. If corresponding position of each byte were 1 then
print this dot, if it were 0 then this dot wont be printed.
[Instan xL+ (xH256) =64
ce]
highest position / lowest
position
GS w n
[Name] Set bar code width
[Format] ASCII GS w n
Hex 1D 77 n
Decimal 29 119 n
[Range] 2n6
[Description Set the horizontal width of barcode. Use n to designate the width
] Dual standard mode width
Single standard mode Narrow Wide
n
width(mm) standard standard
mode(mm) mode(mm)
2 0.25 0.25 0.625
3 0.375 0.375 1.0
4 0.5 0.5 1.25
5 0.625 0.625 1.625
6 0.75 0.75 1.875
Single standard mode code is as followsUPC-A, UPC-E,
JAN13(EAN13), JAN8(EAN8), CODE93,CODE128
Wide standard mode code is as followCODE39,ITF,CODABAR
[Default] n=2
[Reference] GS k
GS ( k pL pH cn fn [parameters]
[Name] Set up and print symbol
[Description Handle QR-Code data
] (pL + pH *256) determine the total account of (cn,fn and parameters)
Cn assign QR-Code type ,fixed to 49.
Fn assign command
Parameters was assigned by different command
fn format No Function name
6 GS ( k pL pH cn fn n1 165 QR-code:select mode (Invalid)
5 n2
6 GS ( k pL pH cn fn n 167 QR-code: setting the qr-code size
7
6 GS ( k pL pH cn fn n 169 QR-code: select the error
9 correction level
8 GS ( k pL pH cn fn m 180 QR-code: .storage the qr-code
0 d1...dk data
8 GS ( k pL pH cn fn m 181 QR-code: print the qr-code which
1 has been storage.
8 GS ( k pL pH cn fn m 182 QR-code: Getting the information
2 of data which has been storated.
[Note] The command which getting the size of saved data has been sended,there is no
need to resending data before getting the return values.
[Reference]
FS &
[Name] Select Chinese character mode
[Format] ASCII FS &
Hex 1C 26
Decimal 28 38
[Description
Select Chinese character mode
]
[Note] While choosing the chinese character mode ,the printer will judge if the
Chinese character is internal code. Handling the first character then
judge the if the next character s internal code.
The printer will automatic select the Chinese mode while the printer is
power on.
[Reference] FS .
FS - n
[Name] Turn underline mode on/off for Chinese characters
[Format] ASCII FS - n
Hex 1C 2D n
Decimal 28 45 n
[Range] 0n248n50
[Description] Selecting or Canceling the underline mode by the value of n
n Function
0,4
Canceling the Chinese characters underline
8
1,4 Selecting the Chinese characters underline(1 point in
9 width)
2,5 Selecting the Chinese characters underline(2 point in
0 width)
[Note] The printer will add underline to each character ,including left and right
space. But not added by the command which cause by HT command, not
take affect to the rotated character by 90 degrees which with underline.
The printer will not execute the underline print, but the line width of
underline you set former.The default line width is 1 point.
Even if you changing the size of character, the underline which you
set will not be changed.
You can canceling the underline mode by using FS!, the last
command take affect.
[Default n=0
value]
[Reference] FS !
FS .
[Name] Cancel Chinese character mode
[Format] ASCII FS .
Hex 1C 2E
Decimal 28 46
[Description
Canceling Chinese character mode
]
[Note] While all the Chinese character has been canceled ,all those character
will be regard as ASCII, the system will handle only one character each
time.
Power on and automatic selecting Chinese character mode.
[Reference] FS&
FS C n
[Name] Select Kanji character code system
[Format] ASCII FS C n
Hex 1C 43 n
Decimal 28 67 n
[Range] 0n248n50
[Description]
n Encoding system
0,48 GBK simple Chinese
1,49 BIG5 traditional Chinese
2,50 KSC5601 korean
[Default n=0
value]
[Reference]
FS S n1 n2
[Name] Set left- and right-side Chinese character spacing
[Format] ASCII FS S n1 n2
Hex 1C 53 n1 n2
Decimal 28 83 n1 n2
[Range] 0 n1 255 , 0 n2255
[Description] Setting the right&left space to n1 and n2
[Note]
[Default
n1 = 0n2 = 0
value]
FS W n
[Name] Turn quadruple-size mode on/off for Chinese characters
[Format] ASCII FS W n
Hex 1C 57 n
Decimal 28 87 n
[Range] 0n255
[Description]
Selecting or canceling Chinese quadruple-size mode on/off for Chinese
characters.
While the lowest of n is 0,turing the quadruple-size mode off.
While the lowest of n is 1,turning the quadruple-size height mode on.
[Note] Only the lowest of n take affect.
While the quadruple-size mode for Chinese characters is on, the later
Chinese characters printed is the same .
While the quadruple-size mode for Chinese characters is off, the later
Chinese characters printed is normal.
While the height of each character is different in one line, all the
character of the line will aligned at the base line.
You can also selecting or canceling Chinese quadruple-size height
and width , the last command will take affect.
[Default n=0
value]
[Reference] FS !GS !