HP Thermal Receipt Printer Programming Guide
HP Thermal Receipt Printer Programming Guide
Programming Guide
© Copyright 2019 HP Development Company, L.P.
Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other
countries.
The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in
the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an
additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.
Product notice
This user guide describes features that are common to most models. Some features may not be available on your computer.
To access the latest user guides, go to http://www.hp.com/support, and follow the instructions to find your product. Then select User
Guides.
Software terms
By installing, copying, downloading, or otherwise using any software product preinstalled on this computer, you agree to be bound by
the terms of the HP End User License Agreement (EULA). If you do not accept these license terms, your sole remedy is to return the
entire unused product (hardware and software) within 14 days for a full refund subject to the refund policy of your seller.
For any further information or to request a full refund of the price of the computer, contact your seller.
Contents
1 Overview............................................................................................................................................. - 1 -
FF ........................................................................................................................................................... - 3 -
CR .......................................................................................................................................................... - 3 -
ESC FF................................................................................................................................................... - 3 -
ESC J n .................................................................................................................................................. - 4 -
ESC d n .................................................................................................................................................. - 4 -
ESC $ nL nH .......................................................................................................................................... - 6 -
ESC T n .................................................................................................................................................. - 7 -
ESC \ nL nH ......................................................................................................................................... - 10 -
ESC a n ................................................................................................................................................ - 11 -
GS $ nL nH ........................................................................................................................................... - 12 -
GS L nL nH ........................................................................................................................................... - 12 -
GS P x y ............................................................................................................................................... - 13 -
GS W nL nH ......................................................................................................................................... - 14 -
GS \ nL nH ............................................................................................................................................ - 14 -
ESC SP n ............................................................................................................................................. - 16 -
ESC ! n ................................................................................................................................................. - 17 -
ESC % n ............................................................................................................................................... - 18 -
ESC – n ................................................................................................................................................ - 21 -
ESC ? n ................................................................................................................................................ - 21 -
ESC E n ............................................................................................................................................... - 22 -
ESC G n ............................................................................................................................................... - 22 -
ESC M n ............................................................................................................................................... - 23 -
ESC R n ............................................................................................................................................... - 23 -
ESC V n ............................................................................................................................................... - 24 -
ESC t n ................................................................................................................................................. - 25 -
ESC { n ................................................................................................................................................. - 26 -
GS ! n ................................................................................................................................................... - 27 -
GS B n .................................................................................................................................................. - 28 -
FS ! n .................................................................................................................................................... - 29 -
FS & ..................................................................................................................................................... - 30 -
FS - n.................................................................................................................................................... - 30 -
FS . ....................................................................................................................................................... - 30 -
FS 2 c1 c2 d1...dk ................................................................................................................................ - 31 -
FS C n .................................................................................................................................................. - 31 -
FS S n1 n2 ........................................................................................................................................... - 32 -
FS W n ................................................................................................................................................. - 32 -
GS # n .................................................................................................................................................. - 34 -
GS * x y d1...d(x × y × 8) ...................................................................................................................... - 35 -
GS / m .................................................................................................................................................. - 35 -
GS v 0 m xL xH yL yH d1....dk ............................................................................................................. - 36 -
FS p n m ............................................................................................................................................... - 37 -
GS r n ................................................................................................................................................... - 43 -
GS f n ................................................................................................................................................... - 44 -
GS h n .................................................................................................................................................. - 44 -
GS s n1 n2 n3 n4 n5 n6 n7 n8 ............................................................................................................. - 49 -
GS o n .................................................................................................................................................. - 51 -
GS p n .................................................................................................................................................. - 52 -
GS q n .................................................................................................................................................. - 52 -
GS w n.................................................................................................................................................. - 52 -
ESC C n ............................................................................................................................................... - 54 -
GS (N pL pH fn a............................................................................................................................. - 54 -
GS (z nL nH 0 E ................................................................................................................................... - 56 -
GS { w n ............................................................................................................................................... - 57 -
ESC 2 ................................................................................................................................................... - 63 -
ESC 3 n ................................................................................................................................................ - 63 -
ESC = n ................................................................................................................................................ - 64 -
ESC @ ................................................................................................................................................. - 64 -
ESC L ................................................................................................................................................... - 64 -
ESC S................................................................................................................................................... - 65 -
ESC c 0 n ............................................................................................................................................. - 66 -
ESC c 3 n ............................................................................................................................................. - 66 -
ESC c 4 n ............................................................................................................................................. - 67 -
ESC c 5 n ............................................................................................................................................. - 67 -
ESC p m t1 t2 ....................................................................................................................................... - 67 -
GS (A pL pH n m .................................................................................................................................. - 68 -
GS ........................................................................................................................................................ - 68 -
GS ^ r t m ............................................................................................................................................. - 69 -
Appendix ............................................................................................................................................. - 72 -
Real-time commands: These commands are acted on immediately upon being received by the printer.
Print buffers: Used to store figure data to be printed.
Page mode: Under this mode, the printer stores all data in a specified memory and thinks of this as a virtual page.
The page is printed when the printer receives print command either FF or ESC FF.
Standard mode: Standard mode is the default mode of printer, namely line mode. Under this mode, the printer prints
data and feeds paper upon print line buffer full (data is enough for one print line) or receiving print command like LF.
HRI character: Barcode note character. Human Readable Interface.
NV: Non-volatile memory in which data stored is not lost when the device is turned off.
RAM: Random Access Memory.
DPI: Dots per inch (one inch equals 25.4 mm). It is used to identify the resolution of a printer. For example, 203 DPI
means 203 print dots per inch.
Baseline: The standard position where character data in print buffers are stored. The figure shows the position of
ordinary characters in standard mode and page mode:
-1-
1.3 Command format
-2-
2 Command Description
LF
FF
[Function] Print all data in the print buffers and return to the standard mode.
[Format] ASCII FF
Hex 0C
Decimal 12
[Notes] This command is valid only in page mode.
The buffer data is deleted after being printed.
The printer does not execute paper cutting.
This command sets the print position to the beginning of the line.
[Relative] ESC FF, ESC L, ESC S
CR
[Function] When the command is enabled, it equals to LF; it is ignored when disabled,
[Format] ASCII CR
Hex 0D
Decimal 13
[Notes] Sets the print starting position to the beginning of the line.
This command is set according to the printer configuration.
[Relative] LF
ESC FF
-3-
buffering character data.
[Relative] FF, ESC L, ESC S
ESC J n
[Function] Print and feed paper for [n × motion unit in vertical or horizontal] inches.
[Format] ASCII ESC J n
Hex 1B 4A n
Decimal 27 74 n
[Range] 0 ≤n ≤ 255
[Notes] After printing is completed, this command sets the print starting position to the beginning of the line.
The paper feed amount set by this command is not affected by the values set by ESC 2 or ESC 3.
The horizontal and vertical motion unit is specified by GS P.
In standard mode, the printer uses the vertical motion unit (y).
In page mode, this command functions as follows, depending on the starting position of the printable area:
1) When the starting position is set to the upper left or lower right of the printable area by ESC T, the vertical
motion unit (y) is used.
2) When the starting position is set to the upper right or lower left of the print able area by ESC T, the
horizontal motion unit (x) is used.
The maximum paper feed amount is 1016 mm (40 inches). When the setting value exceeds the maximum, it is
converted to the maximum automatically.
[Relative] GS P
[Example] 1B 40 (initialize printer)
1D 50 CB CB (set the resolution 203 × 203)
41 41 41 41 41 41 41(data to be printed)
1B 4A 50 (print and feed paper 80/203 inches)
42 42 42 42 42 42 42 0A (data to be printed)
Results:
ESC d n
-4-
• This command does not affect the line spacing set by ESC 2 or ESC 3.
• The maximum paper feed amount is 1016 mm. If the paper feed amount is more than 1016 mm , the printer feeds
paper only 1016 mm.
[Relative] ESC 2, ESC 3
[Example] 1B 40 (initialize printer)
41 41 41 41 41 41 41(data to be printed)
1B 64 02 (print and feed two-character line spacing, 2/6 inches)
42 42 42 42 42 42 42 0A (data to be printed)
Results:
HT
-5-
33 33 33 33
09 (the same as above)
33 33 33 33
09 (the same as above)
33 33 33 33
0A (print)
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
0A (print)
Results:
ESC $ nL nH
[Function] The distance from the beginning of the line to the print position is [(nL + nH × 256) × (vertical or
horizontal motion unit)] inches.
[Format] ASCII ESC $ nL nH
Hex 1B 24 nL nH
Decimal 27 36 nL nH
[Range] 0≤nL ≤ 255
0 ≤nH≤255
[Notes] • Settings outside the specified printable area are ignored.
• The horizontal and vertical motion units are specified by GS P.
• In standard mode, the horizontal motion unit (x) is used.
• In page mode, horizontal or vertical motion unit differs depending on the starting position of the printable area as
follows:
1) When the starting position is set to the upper left or lower right of the printable area by ESC T,
the horizontal motion unit (x) is used.
2) When the starting position is set to the upper right or lower left of the printable area using ESC
T, the vertical motion unit (y) is used.
[Relative] ESC \, GS $, GS \, GS P
[Example] Refer to ESC W
-6-
[Format] ASCII ESC D n1...nk NUL
Hex 1B 44 n1...nk 00
Decimal 27 68 n1...nk 0
[Range] 1 ≤ n ≤ 255
0 ≤ k ≤ 32
[Notes] • The horizontal tab position is stored as a value of [character width × n] measured from the beginning
of the line. The character width includes the right-side character spacing, and double-width characters are set with
twice the width of normal characters.
• This command cancels the previous horizontal tab settings.
• When setting n = 8, the print position is moved to column 9 by sending HT.
• Up to 32 tab positions (k = 32) can be set. Data exceeding 32 tab positions is processed as normal data.
• Transmit [n] k in ascending order and place a NUL code 0 at the end.
• When [n] k is less than or equal to the preceding value [n] k-1, tab setting is finished and the following data is
processed as normal data.
• ESC D NUL cancels all horizontal tab positions settings.
• The previously specified horizontal tab positions do not change, even if the character width changes.
• The character width is memorized for each standard and page mode.
[Default] The default tab positions are at intervals of 8 characters (columns 9, 17, 25...) for font A (12 × 24).
[Relative] HT
[Example] Refer to HT
ESC T n
[Function] Select the print direction and starting position in page mode.
[Format] ASCII ESC T n
Hex 1B 54 n
Decimal 27 84 n
[Range] 0≤n≤3 48 ≤ n ≤ 51
n specifes print direction and starting position:
[Notes] • When the command is input in standard mode, the printer executes only internal flag operation. This
command does not affect printing in standard mode.
• This command sets the position where data is buffered within the printing area.
-7-
• Parameters for horizontal or vertical motion units (x or y) differ as follows, depending on the starting position of
the printing area:
1) If the starting position is the upper left or lower right of the printing area, data is buffered in the
direction perpendicular to the paper feed direction:
Commands using character width: ESC SP, ESC $, ESC \
Commands using vertical motion units: ESC 3, ESC J, GS $, GS \
2) If the starting position is the upper right or lower left of the printing area, data is buffered in the
paper feed direction:
Commands using horizontal motion units: ESC 3, ESC J, GS $, GS \
Commands using vertical motion units: ESC SP, ESC $, ESC \
[Default] n=0
[Relative] ESC $, ESC L, ESC W, ESC \, GS $, GS P, GS \
[Example] 1B 4C (enter page mode)
1D 50 CB CB (set printer resolution)
1B 57 20 00 00 00 40 02 90 02 (set the print area in page mode)
1B 54 00 (select the print area direction in page mode)
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0A (newline)
1B 54 01 (select the print area direction in page mode)
31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 0A (newline)
1B 54 02 (select the print area direction in page mode)
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 0A (newline)
1B 54 03 (select the print area direction in page mode)
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 0A (print)
50 72 69 6E 74 20 45 6E 64
0C (print)
Results:
[Function] Define the horizontal starting position, vertical starting position, printing area width, and printing area
height.
-8-
Horizontal starting position: x0 = [(xL + xH × 256) × (horizontal motion unit)]
Vertical starting posirion: y0 = [(yL + yH × 256) × (vertical motion unit)]
Print area width: dx = [(dxL + dxH × 256) × (horizontal motion unit)]
Print area height: dy = [(dyL + dyH × 256) × (vertical motion unit)]
[Format] ASCII ESC W xL xH yL yH dxL dxH dyL dyH
Hex 1B 57 xL xH yL yH dxL dxH dyL dyH
Decimal 27 87 xL xH yL yH dxL dxH dyL dyH
[Range] 0 ≤ xL, xH, yL, yH, dxL, dxH, dyL, dyH ≤ 255 (except dxL= dxH=0 or dyL= dyH=0)
[Notes] • If this command is input in standard mode, the printer executes only internal flag operation. This
command does not affect printing in standard mode.
• If the horizontal or vertical starting position is set outside the printable area, the printer stops command processing
and processes the following data as normal data.
• If the printing area width or height is set to 0, the printer stops command processing and processes the following
data as normal data.
• This command sets the position where data is buffered to the position specified by ESC T within the printing area.
• If (horizontal starting position + printing area width) exceeds the printable area, the printing area width is
automatically set to (horizontal printable area - horizontal starting position).
• If (vertical starting position + printing area height) exceeds the printable area, the printing area height is
automatically set to (vertical printable area – vertical starting position).
• The horizontal and vertical motion units are specified by GS P. Changing the horizontal or vertical motion unit does
not affect the current printing area.
• Use the horizontal motion unit (x) for setting the horizontal starting position and printing area width, and use the
vertical motion unit (y) for setting the vertical starting position and printing area height.
• When the horizontal starting position, vertical starting position, printing area width, and printing area height are
defined as X, Y, Dx, and Dy respectively, the printing area is set as shown in the figure below.
ESC \ nL nH
[Function] Set the print starting position based on the current position by using the horizontal or vertical motion
unit.
This command sets the distance from the current position to the print position to be [(nL + nH × 256) × horizontal or
vertical motion unit]
[Format] ASCII ESC \ nL nH
Hex 1B 5C nL nH
Decimal 27 92 nL nH
[Range] 0 ≤ nL ≤ 255
0 ≤ nH ≤ 255
[Notes] • Any setting that exceeds the printable area is ignored.
• When pitch N is specified to the right: nL+ nH × 256 = N
• When pitch N is specified to the left: nL+ nH × 256 = 65536 - N
• The print starting position moves from the current position to [N × horizontal or vertical motion unit]
• The horizontal and vertical motion units are specified by GS P.
• In standard mode, the horizontal motion unit is used.
- 10 -
• In page mode, the horizontal or vertical motion unit differs as follows, depending on the direction and starting
point of the printing area:
1) When the starting position is set to the upper left or lower right of the printable area
using ESC T, the horizontal motion unit (x) is used.
2) When the starting position is set to the upper right or lower left of the printable area using ESC
T, the vertical motion unit (y) is used.
[Relative] ESC $, GS P
ESC a n
[Function] Align all the data in one line to the specified position
[Format] ASCII ESC a n
Hex 1B 61 n
Decimal 27 97 n
[Range] 0 ≤ n ≤ 2, 48 ≤ n ≤ 50
n selects the justification as follows:
n Justification
0, 48 Left justification
1, 49 Centering
2, 50 Right justificatoin
[Notes] • This command is enabled only when processed at the beginning of the line in the standard mode.
• If this command is input in page mode, the printer performs only internal flag operations.
• This command adjusts the space area according to HT, ESC $ or ESC\.
[Default] n = 0
[Example] 0A (Entering line mode)
1B 40 (Initialization)
1B 61 00 (Setting left justification)
41 42 43 0A
41 42 43 44 0A
41 42 43 44 45 0A
1B 61 01 (Setting centering)
41 42 43 0A
41 42 43 44 0A
41 42 43 44 45 0A
1B 61 02 (Setting right justification)
41 42 43 0A
41 42 43 44 0A
41 42 43 44 45 0A
- 11 -
Results:
GS $ nL nH
GS L nL nH
[Function] Set left margin to [(nL + nH × 256) × horizontal motion unit)] inches
[Format] ASCII GS L nL nH
Hex 1D 4C nL nH
Decimal 29 76 nL nH
[Range] 0 ≤ nL ≤ 255
0 ≤ nH ≤ 255
- 12 -
[Notes] • This command is effective only when processed at the beginning of the line in standard mode.
• If this command is input in page mode, it is disabled.
• This command does not affect printing in page mode.
• If the setting exceeds the printable area, the maximum value of the printable area is used.
• The horizontal and vertical motion units are specified by GS P. Changing the horizontal and vertical motion unit
does not affect the current left margin.
[Default] nL = 0, nH = 0
[Relative] GS P, GS W
[Example] 0A (Setting printing position at the beginning of the line)
1B 40 (Initialization)
30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 0A
1D 4C 30 00 (Setting left margin to 48/203 inches)
30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 0A
1D 57 C8 00 (Setting printing width to 200/203 inches)
30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 0A
Results:
GS P x y
[Function] Set the horizontal and vertical motion units to approximately 25.4/ x mm {1/ x inches} and
approximately 25.4/ y mm {1/ y inches}, respectively.
[Format] ASCII GS P x y
Hex 1D 50 x y
Decimal 29 80 x y
[Range] 0 ≤ x ≤ 255
0 ≤ y ≤255
[Notes] • When x and y are set to 0, the default setting of each value is used.
• The horizontal direction is perpendicular to the paper feed direction and the vertical direction is the paper feed
direction.
• In standard mode, the following commands use x or y, regardless of character rotation (upside-down or 90°
clockwise rotation):
1) Commands using x: ESC SP, ESC $, ESC \, FS S, GS L, GS W
2) Commands using y: ESC 3, ESC J, GS V
• In page mode, the following commands use x or y, depending on the direction and starting position of print area:
1) When the print starting position is set to the upper left (Printing direction from left to right)or
lower right (printing direction from right to left) of the printing area by ESC T:
- 13 -
Commands using x: ESC SP, ESC $, ESC W, ESC \, FS S
Commands using y: ESC 3, ESC J, ESC W, GS $, GS \, GS V
2) When the print starting position is set to the upper right(Printing direction from top to down)
or lower left (Printing direction from down to top)of the printing area by ESC T:
Commands using x: ESC 3, ESC J, ESC W, GS $, GS \
Commands using y: ESC SP, ESC $, ESC W, ESC \,FS S, GS V
• The command does not affect the previously specified values.
• The minimum motion unit is the compositive result of this command and other commands.
• 1 inch=25.4mm.
[Default] x = 203, y =203, at this time, one motion unit is a printing dot. The horizontal distance is about 1/8
mm and the vertical distance is about 1/8 mm.
[Relative] ESC SP, ESC $, ESC 3, ESC J, ESC W, ESC \, GS $, GS L, GS V, GS W, GS \
GS W nL nH
• In standard mode, the command is enabled only when processed at the beginning of the line.
• In page mode, this command is disabled.
• This command does not affect the printing in page mode.
• If the [left margin + printing area width] exceeds the printable area, [printable area width - left margin) is used.
• The horizontal and vertical motion units are specified by GS P. Changing the horizontal and vertical motion units
does not affect the current left margin or print area width.
• The horizontal motion unit (x) is used for calculating the printing area width.
[Default] nL = 76, nH = 2
[Relative] GS L, GS P
[Example] See GS L
GS \ nL nH
- 14 -
Hex 1D 5C nL nH
Decimal 29 92 nL nH
[Range] 0 ≤ nL ≤ 255
0 ≤ nH ≤ 255
[Notes] • This command sets the distance from the current position to [(nL + nH × 256) × vertical or horizontal
motion unit] inches.
• This command is ignored unless page mode is selected.
• When pitch N is specified to the movement downward:nL + nH × 256 = N
• When pitch N is specified to the movement upward:nL + nH × 256 = 65536 – N
• Any setting that exceeds the specified printing area is ignored.
• This command functions as follows, depending on the print starting position set by ESC T:
1) When the starting position is set to the upper left (printing from left to right) or lowerright (printing from
right to left) of the printing, the vertical motion unit (y) is used.
2) When the starting position is set to the upper right (printing from up to down) or lower left (printing from
down to up) of the printing area, the horizontal motion unit (x) is used.
• The horizontal and vertical motion units are specified by GS P.
• The horizontal and vertical motion units can be changed by GS P.
[Relative] ESC $, ESC T, ESC W, ESC \, GS $, GS P
CAN
[Function] In page mode, delete all the print data in current area.
[Format] ASCII CAN
Hex 18
Decimal 24
[Notes] This command is enabled only in page mode.
If the previously specified printing data also exists in the currently specified printing area, it is deleted.
[Relative] ESC L, ESC W
[Example] 1B 40 (Initialization)
1D 50 CB CB (Setting resolution 203×203)
1B 4C (Enter page mode)
1B 57 00 00 00 00 20 02 E8 00(Setting printing width and height in page mode)
31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79
7A 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78
79 7A 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77
78 79 7A 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76
77 78 79 7A 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75
76 77 78 79 7A 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74
- 15 -
75 76 77 78 79 7A 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73
74 75 76 77 78 79 31 32 33 34 35 36 37 38 39 30 61 62 63 64 65 64 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71
72 73 74 75 76 77 78 79
1B 57 44 00 10 00 7C 01 AA 00(Setting the size of page needed to be deleted)
18 (Delete data in page buffer)
1B 24 64 00 (Setting absolute horizontal print position as 100 dots)
1D 24 60 00 (Setting abosulute vertical print position as 96 dots)
43 61 6E 63 65 6C 20 74 68 65 20 64 61 74 61 20
0A 0C (Printing)
Results:
ESC SP n
ESC ! n
- 17 -
• When some characters in a line are double or higher, all the characters in the line are aligned at the baseline.
• ESC E can also turn on or off emphasized mode. However, the setting of the last received command is effective.
• ESC – can also turn on or off underline mode. However, the setting of the last received command is effective.
• GS ! can also select character size. However, the setting of the last received command is effective.
[Default] n = 0
[Relative] ESC -, ESC E, GS !
[Example] 1B 40 (Initialize printer)
1B 21 00 (Select normal print mode)
48
1B 21 01 (Select compressed font mode)
48
1B 21 08 (Select emphasized mode)
48
1B 21 10 (Select double-height mode)
48
1B 21 20 (Select double-width mode)
48
1B 21 80 (Select underline mode)
48
1B 21 B9 (Select compressed, emphasized, double-width, double-height and underline mode)
48 0A
Results:
ESC % n
- 18 -
When the LSB of n is 1, the user-defined character set is selected.
When the user-defined character set is canceled, the internal character set is automatically selected.
n is available only for the least significant bit.
[Default] n = 0
[Relative] ESC &, ESC ?
- 19 -
• When standard ASCII font (12 × 24) is selected
- 20 -
ESC – n
ESC ? n
- 21 -
[Format] ASCII ESC ? n
Hex 1B 3F n
Decimal 27 63 n
[Range] 32 ≤n ≤127
[Notes] This command cancels the pattern defined for the character code specified by n. After the user-defined
characters are canceled, the corresponding pattern for the internal character is printed.
If a user-defined character has not been defined for the specified character code, the printer ignores this command.
[Relative] ESC &, ESC %
ESC E n
ESC G n
- 22 -
Only the lowest bit of n is enabled.
Printer output is the same in double-strike mode and in emphasized mode.
[Default] n = 0
[Relative] ESC E
[Example] See ESC E
ESC M n
ESC R n
0 U.S.A
1 France
2 Germany
- 23 -
3 U.K
4 Denmark I
5 Sweden
6 Italy
7 Spain I
8 Japan
9 Norway
10 Denmark II
11 Spain II
12 Latin America
13 Korea
[Default] n=0
ESC V n
- 24 -
Results:
ESC t n
- 25 -
34 855[Cyrillic]
36 862[hebrew]
37 864[Arabic]
38 869[Greek]
41 Frasi
43 772[Lithuanian]
45 1250[Latin-2]
46 1251[Cyrillic]
47 1253[Greek]
48 1254[Turkish]
49 1255[Hebrew]
50 1256[Arabic]
51 1257[Baltic]
54 771
56 774[Lithuanian]
64 3840 (IBM-Russian)
65 3841 (Gost)
66 3843 (Polish)
67 3844 (CS2)
68 3845 (Hungarian)
69 3846 (Turkish)
70 3847 (Brazil-ABNT)
71 3848 (Brazil-ABICOMP)
72 1001
73 2001
74 3001 (Estonian-1)
75 3002 (Estonian-2)
76 3011 (Latvian-1)
77 3012 (Latvian-2)
78 3021 (Bulgarian)
79 3041 (Maltese)
80 8859
81 Persia
[Notes] This command is disabled in Chinese font.
[Default] PC437 code
ESC { n
- 26 -
[Format] ASCII ESC { n
Hex 1B 7B n
Decimal 27 123 n
[Range] 0 ≤ n ≤ 255
[Notes] • When the LSB of n is 0, upside-down printing mode is turned off.
• When the LSB of n is 1, upside-down printing mode is turned on.
• Only the lowest bit of n is valid.
• This command is enabled only when processed at the beginning of the line in standard mode.
• When this command is input in page mode, the printer performs only internal flag operations.
• This command does not affect printing in page mode.
• In upside-down printing mode, the printer rotates the line to be printed by 180° and then prints it.
[Default] n = 0
[Example] 1B 40
1B 7B 01 (Turn on upside-down printing mode)
41 42 43 44 45 46 0A
30 31 32 33 34 35 0A
1B 7B 00 (Turn off upside-down printing mode)
41 42 43 44 45 46 0A
30 31 32 33 34 35 0A
[Results]:
GS ! n
- 27 -
Hex Decimal Width Hex Decimal Height
00 00 1 (Normal) 00 0 1 (Normal)
10 16 2(Double width) 01 1 2(Double 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
• This command is effective to all characters (ASCII and Chinese characters) except for HRI characters.
• If n is outside of the defined range, this command will be ignored.
• In standard mode, the vertical direction is the paper feed direction, and the horizontal direction is perpendicular
to the paper feed direction. However, when character orientation changes in 90° clockwise-rotation, the relationship
between vertical and horizontal directions is reversed.
• In page mode, vertical and horizontal directions are based on the direction of print area.
• When characters in one line are enlarged to different sizes, all the characters are aligned at the baseline.
• The ESC ! command can also turn double-width and double-height modes on or off. However, the setting of the
last received command is effective.
[Default] n=0
[Relative] ESC !
[Example] Refer to ESC !
GS B n
- 28 -
41 41 41 42 42 42 0A
1D 42 00 (Turn white/black reverse mode off)
41 41 41 42 42 42 0A
[Results]:
FS ! n
- 29 -
FS &
FS - n
FS .
- 30 -
• Chinese character mode is selected when the power is turned on.
[Relative] FS &, FS C
FS 2 c1 c2 d1...dk
FS C n
FS S n1 n2
FS W n
- 32 -
Decimal 28 87 n
[Range] 0 ≤ n ≤ 255
[Description] When the LSB of n is 0, quadruple-size mode for Chinese characters is turned off.
When the LSB of n is 1, quadruple-size mode for Chinese characters is turned on.
[Notes] • Only the lowest bit of n is enabled.
• In quadruple-size mode, the printer prints characters of the same size as when double-width and double-height
modes are both turned on.
• When quadruple-size mode is turned off by this command, the following Chinese characters are printed in normal
size.
• When some of the characters in one line are different in height, all the characters in the line are aligned at the
baseline.
• FS ! or GS ! can also select or cancel quadruple-size mode by selecting double-height and double-width modes,
and the setting of the last received command is effective.
[Default] n = 0
[Relative] FS !, GS !
ESC * m nL nH d1... dk
- 33 -
• The nL and nH indicate the number of dots of the bitmap in the horizontal direction. The number of dots is
calculated by nL + nH × 256.
• If the bitmap data input exceeds the number of dots to be printed in a line, the excess data is ignored.
• d indicates the bitmap data. Set a corresponding bit to 1 to print a dot or to 0 to not print a dot.
• After printing a bitmap, the printer returns to normal data processing mode.
• This command is not affected by print modes (emphasized, double-strike, underline, character size enlargement
or white/black reverse printing), except upside-down printing mode.
• The relationship between the image data and the dots to be printed is as follows:
When 8-dot bitmap is selected:
GS # n
[Function] Specify a number for the bitmap to be downloaded. This number is to be used when downloading and
printing this bitmap.
[Format] ASCII GS # n
Hex 1D 23 n
Decimal 29 33 n
[Range] 0≤n≤7
[Notes] The command is only enabled for bitmaps in RAM and the settings are erased when the printer is turned
off.
- 34 -
The number does not apply to the bitmap to be downloaded in FLASH.
GS * x y d1...d(x × y × 8)
[Relative] GS /
GS / m
- 35 -
height
3, 51 Quadruple 101 101
[Notes] • This command is ignored if a downloaded bitmap has not been defined.
• This command has no effect in the print modes (emphasized, double-strike, underline, character size enlargement,
or white/black reverse printing), except for upside-down printing mode.
• If the downloaded bitmap to be printed exceeds the printable area, the excess data is not printed.
• This command print bitmap in RAM but not in FLASH, the number of bitmap is defined by GS #.
[Relative] GS *, GS #
GS v 0 m xL xH yL yH d1....dk
- 36 -
FS p n m
- 37 -
• xL, xH specifies (xL + xH × 256) × 8 dots in the horizontal direction for the flash bitmap.
• yL, yH specifies (yL + yH × 256) × 8 dots in the vertical direction for the flash bitmap.
• Frequent execution of the command may damage the FLASH memory. Therefore, it is recommended to write the
FLASH memory 10 times or less a day.
• This command cancels all flash bitmaps that have already been defined by this command. The printer can not
redefine only one of several data definitions previously defined. In this case, all data needs to be sent again.
• During the processing of this command, it writes data in Flash and stops receiving other commands, so sending
other commands including real-time command to the printer are forbidden.
• Flash bitmap refers to a bitmap which is defined by FS q, stored in a FLASH memory and printed by FS p.
• In standard mode, this command is effective only when processed at the beginning of the line.
• The 7 bytes <from FS~yH> is command data but not data of image.
• When the amount of data exceeds the capacity left in the range defined by xL, xH, yL, yH, the printer only processes
xL, xH, yL, yH inside the defined range.
• In the first group of Flash bitmaps, when any of the parameters xL, xH, yL, yH is out of the defined range, this
command is disabled.
• When downloading more than one bitmap, if any of xL, xH, yL, yH is out of the defined range, it stops processing
this command. At this time, Flash bitmaps that haven’t been defined are disabled (undefined), but any Vbitmaps
before that are enabled.
• The d indicates the definition data. In data (d) a 1 bit specifies a dot to be printed and a 0 bit specifies a dot not to
be printed.
• This command defines n as the number of Flash bitmap. Numbers rise in order from Flash bitmap 1. Therefore,
the first data group [xL xH yL yH d1...dk] is Flash bitmap 1, and the last data group [xL xH yL yH d1...dk] is Flash
bitmap n. The total agrees with the number of Flash bitmaps specified by command FS p.
• A definition data of a Flash bitmap consists of [xL xH yL yH d1...dk]. Therefore, when there is only one Flash bitmap,
n=1. The number of bytes in Flash memory occupied by the printer is as follows:
• The printer uses ([data: (xL + xH × 256) × (yL + yH × 256) × 8] + [header:4]) bytes of FLASH memory.
[Example] When xL = 64, xH = 0, yL = 96, yH = 0
- 38 -
• The maximum flash downloading space in printer is 64K bits (8K bytes). This command can define several flash
bitmaps, but cannot define a bitmap data whose total capacity exceeds 64K bits (The download area is different
according to different configuration).
• When processing this command, the printer does not process other commands.
• When this command is received during macro definition, the printer ends macro definition, and begins performing
this command.
• After a Flash bitmap is defined, it is not erased by performing ESC @, resetting the device, or turning off the device.
• This command performs only definition of a Flash bitmap and does not perform printing. Printing of the Flash
bitmap is performed by the FS p command.
[Relative] FS p
DLE EOT n
- 39 -
Bit 0/1 Hex Decimal Function
4 1 10 16 Fixed to 1.
5,6 - - - Undefined.
7 0 00 00 Fixed to 0.
n = 2: Off-line status
Bit 0/1 Hex Decimal Function
0 0 00 0 Fixed to 0.
1 1 02 2 Fixed to 1.
0 00 0 Cover is closed.
2
1 04 4 Cover is open.
FEED button has not been
0 00 0
3 pushed.
1 08 8 FEED button has been pushed.
4 1 10 16 Fixed to 1.
0 00 0 Paper is not end.
5
1 20 32 Paper is end.
0 00 0 No error.
6
1 40 64 Error has occured.
7 0 00 0 Fixed to 0.
n = 3: Error status
Bit 0/1 Hex Decimal Function
0 0 00 0 Fixed to 0.
1 1 02 2 Fixed to 1.
2 - - - Undefined.
0 00 0 No auto-cutter error.
3
1 08 8 Auto-cutter error has occured.
4 1 10 16 Fixed to 1.
5 0 00 00 Fixed to 0.
0 00 0 Temperature of print head is normal.
6 Temperature of print head is
1 40 64
abnormal.
7 0 00 0 Fixed to 0.
n = 4: Paper feeding status
Bit 0/1 Hex Decimal Function
0 0 00 0 Fixed to 0.
1 1 02 2 Fixed to 1.
2,3 0 00 0 Non-paper near status.
- 40 -
1 0C 12 Paper near end status.
4 1 10 16 Fixed to 1.
0 00 0 Paper present.
5,6
1 60 96 Paper end.
7 0 00 0 Fixed to 0.
Please avoid inserting this command between 2 or more byte commands.
For example:
In the process of sending ESC 3 n to printer, DTR turns into MARK(DSR is used to host computer) before sending n
and DLE EOT 3 is interrupted before receiving n, then the printer take code<10>H of DLE EOT 3 as code <10>H of
ESC 3.
[Relative] DLE ENQ, GS a, GS r
GS a n
- 42 -
GS r n
GS H n
[Function] Select the printing position of HRI characters when printing a barcode.
- 43 -
[Format] ASCII GS H n
Hex 1D 48 n
Decimal 29 72 n
[Range] 0 ≤ n ≤ 3, 48 ≤ n ≤ 51
[Notes] n specifies the printing position for HRI as follows:
n Printing position
0, 48 Not printed.
1, 49 Above the barcode.
2, 50 Below the barcode.
3, 51 Both above and below the barcode.
• HRI refers ro the character which applies notes to barcodes.
• HRI character font is specified by GS f.
[Default] n=0
[Relative] GS f, GS k
GS f n
[Function] Select a font for the HRI characters when printing a barcode.
[Format] ASCII GS f n
Hex 1D 66 n
Decimal 29 102 n
[Range] n = 0, 1, 48, 49
[Notes] n selects a font as follows:
n Font
0,48 Standard ASCII character (12 × 24)
1,49 Compressed ASCII character (9 × 17)
• HRI refers to the character which applies notes to barcodes.
• HRI characters are printed at the position specified by GS H.
[Default] n=0
[Relative] GS H, GS k
GS h n
- 44 -
① GS k m d1...dk NUL②GS k m n d1...dn
- 45 -
75 PDF417 1 ≤ n ≤ 255 0 ≤ d ≤ 255
76 QRCODE 1 ≤ n ≤ 255 0 ≤ d ≤ 255
77 MAXICODE 1 ≤ n ≤ 84 48 ≤ d ≤ 57,65 ≤ d ≤ 90
78 GS1 1 ≤ n ≤255 Decided by GS1
[Notes ①]
• This command ends with a NULL code.
• When UPC-A or UPC-E is selected, the characters after the first 12 bytes will be processed as normal characters
after receiving 12 bytes of barcode data.
• When JAN13 (EAN13) is selected, the characters after the first 13 bytes will be processed as normal characters
after receiving 12 bytes of barcode data.
• When JAN8 (EAN8) is selected, the characters after the first 8 bytes will be processed as normal characters after
receiving 8 bytes of barcode data.
• The number of data for ITF bar code must be even numbers. When an odd number of data is input, the printer
ignores the last received data.
• The beginning code and the ending code of CODEBAR barcode must be one of A, B, C and D. The ending codes can
be replaced with T, E, * and N.
• When QRCODE is selected, d1...d k(d1…dn)consist of 5 parts and the format is shown as below:
(1) Daabbcc
D: Link structure mode, input specific mark symbol “D”. This mode is optional and the following three
paramaters and separator should be assigned if this mode is selected.
aa: The position of the specific symbol; input 2 bytes decimal data
bb: The total number of the symbols; input 2 bytes decimal data
cc: The even and odd data; input 2bytes hexadecimal data
,,: are fixed separator symbol
(2) E: Error correction grade Range: L,M,Q,H. The correction grade is increasing from L to H.
(3) M: Mask image reference. Range: Default as automatic mask.
(4) M: Data input mode Range: A or M, A means automatic mode (Recommended).M means manual input mode.
If A is selected, the character mode is not necessary to be assigned; If M selected, the character mode must be
assigned. The default is A mode.
(5) <Character mode><DATA1>,
< Character mode ><DATA2>,
< Character mode ><DATA3>,
……………………….
< Character mode ><DATAn>
Note: n>=200
Character input mode<N,A,B,K>
N: Numbers(0~9)
A: Mixed by alphabet and numbers(0~9)(A~Z)(SP,$,%,*,+,-,.,/,:)
Bxxxx: 8 Bit byte mode(0x00~0xFF)
- 46 -
K: JIS
The legal width of the bar: The ratio of the bar is not changeable.
Example:
1D 6B 0B 51 41 2C 30 31 32 33 34 35 36 37 38 39 41 42 43 44 20 32 44 20 63 6F 64 65 00(Automatic mode
is recommended and the character symbol A can be omitted)
1D 6B 4c 12 48 4D 2C 4E 31 32 33 34 35 36 37 38 39 31 32 33 34 35
1D 6B 0B 4D 4D 2C 41 41 43 2D 34 32 00
1D 6B 0B 4C 4D 2C 4E 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 2C 41 41 42 43 2C 42 30 30 30 36
71 72 63 6F 64 65 00
1D 6B 0B 46 2C 4C 4D 2C 4E 30 31 32 33 34 35 36 37 38 39 2C 41 31 32 41 41 42 42 2C 42 30 30 30 36 71
72 63 6F 64 65 00
• When MAXICODE is selected, the length of d1...d k(d1…dn)should be less than 84 characters and it consists of 5
parts. The format is shown as below:
(1) The basic postal code in 5 numbers;
(2) The second postal code in 4 numbers;
(3) The country code in 3 numbers;
(4) The service class in 3 numbers;
(5) The character strings
Legal character: alphabet and numbers;
Length of variable: changeble;
Legal length of the bar: The ratio of the bar is not changeable.
Example:
1D 6B 0C 33 32 37 38 39 35 35 35 35 38 34 30 36 36 36 54 48 49 53 20 50 41 43 4B 41 47 45 49 53 20 47
4F 49 4E 47 20 54 4F 20 44 41 54 41 4D 41 58 43 4F 52 50 2E 00
[Notes ②]
• n indicates the number of barcode data, and the printer processes n bytes from the next character data as barcode
data.
• If n is outside the specified range, the printer stops command processing and processes the following data as
normal data.
[Notes (standard mode)]
• If d is outside the specified range, the command is disabled.
• If the horizontal size of the barcode exceeds printing area, the command is disabled.
• This command feeds as much paper as is required to print the barcode, regardless of the line spacing specified by
ESC 2 or ESC 3.
• This command is enabled only when no data exists in the print buffer. When data exists in the print buffer, the
command is ignored.
• After printing a barcode, this command sets the print position to the beginning of the line.
• This command is not affected by print modes (emphasized, double-strike,underline, character size, white/black
reverse printing, or 90° clockwise rotated character, etc.), except for upside-down printing mode.
- 47 -
[Notes in page mode]
• This command develops bar code data in the print buffer, but does not print it. After processing barcode data, this
command moves the print position to the right-side dot of the barcode.
• If d is out of the specified range, this command is ignored.
• If barcode width exceeds the printing area, this command is ignored.
When CODE128 (m = 73) is used:
• Refer to Appendix A for the information of the CODE 128 barcode and ithe character set.
• When using the CODE 128 in this printer, take the following points into account for data transmission:
1) Character set must be selected before the barcode data (one of CODE A, CODE B or CODE C).
2) Special characters are defined by combining two characters "{" and one character. The ASCII
character "{" is defined by transmitting "{" twice consecutively.
Transmit data
Specific character set
ASCII Hex Decimal
SHIFT {S 7B, 53 123,83
CODE A {A 7B, 41 123, 65
CODE B {B 7B, 42 123, 66
CODE C {C 7B, 43 123, 67
FNC1 {1 7B, 31 123, 49
FNC2 {2 7B, 32 123, 50
FNC3 {3 7B, 33 123, 51
FNC4 {4 7B, 34 123, 52
"{" {{ 7B, 7B 123, 123
[Demo] Example data for printing "No. 123456"
In this example, the printer first prints "No." using CODE B, then prints the
following numbers using CODE C.
GS k 73 10 123 66 78 111 46 123 67 12 34 56
• If the top of the barcode data is not the code set selection character, the printer stops command processing and
processes the following data as normal data.
• If combination of "{" and the following character does not apply to any special character, the printer stops
command processing and processes the following data as normal data.
• If the printer receives characters that cannot be used in the special code set, the printer stops command
processing and processes the following data as normal data.
• The printer does not print HRI characters that correspond to the shift characters or code set selection characters.
- 48 -
• HRI characters for the function characters are not printed.
• HRI characters for the control characters (<00>H to <1F>H and <7F>H) are not printed.
• The left- and right-side spacing which varies from one barcode type to another rmust be assured.
[Relative] GS H, GS f, GS h, GS w, GS s Appendix A
[Notes] 1B 40(Initialize printer)
4A 41 4E 31 33 0A
1D 48 01 (Set the width of the barcode unit 1)
1D 66 01 (HRI characters use condensed character)
1D 77 01 (HRI characters print above the barcode)
1D 68 40 (Barcode height is 64/203 inch)
1D 6B 02 30 31 32 33 34 35 36 37 38 39 30 35 39 00 0A
1D 48 02 (Set the width of the barcode unit 2)
1D 66 01 (HRI characters use condensed character)
1D 77 02 (HRI characters print under the barcode)
1D 68 80 (Barcode height is 128/203 inch)
1D 6B 02 30 31 32 33 34 35 36 37 38 39 30 35 39 00 0A
1D 48 03 (Set the width of the barcode unit 3)
1D 66 00 (HRI characters use standard character)
1D 77 03 (HRI characters print both above and under the barcode)
1D 68 C8 (Barcode height is 162/203 inch)
1D 6B 02 30 31 32 33 34 35 36 37 38 39 30 35 39 00 0A
[Result]:
GS s n1 n2 n3 n4 n5 n6 n7 n8
- 49 -
[Range] 1 ≤ n1≤ 7
1 ≤ n2≤ 6
2 ≤ n3≤250
1 ≤ n4≤ 10
1 ≤ n5≤ 10
2 ≤ n6≤20 , 4 ≤ n6≤ 20
1 ≤ n7≤ 4
0≤ n8≤1
[Notes] • Whether GS1 barcode is separate or composite barcode is distinguished by data
separator”|” If there is “|” in the programmed data, it is a composite barcode; otherwise, it is a separate DataBar. The
part before | is DataBar of the composite barcode and the part after it is the data of 2D barcode.
• n1 indicates barcode type and character set as below:
- 50 -
ExpandedStacked ~z !"%&'()* or 41 letters
+ , - ./ : ; < = > ? _
space FNC1
• If the length is 13 bits, it will append the check character from the calculation of the first 13 bits to the right of the
data; If the length is 14 bits, the check character from the calculation of the first 13 bits will replace the 14th
character(the printed 14th bit may be different from the inputted character); if the length is shorter than 13 bits, add
0 to the left of the data, and the bits after the first 14th bits will not be printed out.
• The character set of 2D barcode in composite barcode: 0 ~ 9, A ~ Z, a ~ z ! " % & ' ( ) * +, - ./ : ; < = > ? _ space
FNC1(FNC1 is indicated by “{1”}.
• n2 indicates width of basic element
• n3 indicates the height of the DataBar,. Stacked, stacked omnidirectional, expanded stacked barcode indicate the
height of each line of barcode.
• n4 indicates the basic element height of the 2D barcode in the composite barcode.
• n5 indicates the height of the separator. This parameter should be set in DataBar composite barcode or separate
stacked, stacked omnidirectional, expanded stacked barcodes.
• n6 indicates the number of segments of each line of barcode. Only in expanded stacked barcode should this
parameter be set.
• Range of separate expanded stacked barcodes 2 ~ 20; range of composite expanded stacked barcodes 4 ~ 20.
• n7 indicates the content of the note character
Parameter Note character
DataBar and 2D in composite barcode
1
DataBar only in separate barcode
2 Print DataBar in composite or separate barcode
3 Print 2D in composite barcode, no print in separate barcode
4 No note character
• n8 indicates whether to use AI(use identifier): 0 indicates to not use AI; 1 indicates to use AI.
[Reference] GS k
GS o n
- 51 -
Symbol type
nC
1:Original type 2:Enhanced type(Recommended)
[Notes] When the value of parameter is outside the specified range, the command is not valid.
GS p n
GS q n
GS w n
- 52 -
n specifies the barcode width as follows:
Module width (mm) for Module width (mm) for binary-level barcode
N
single-level barcode Thin basic module (mm) Thick basic module (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-level barcodes are as follows:
UPC-A, UPC-E, JAN13 (EAN13), JAN8 (EAN8), CODE93, CODE128
• Binary-level barcodes are as follows:
CODE39, ITF, CODABAR
[Default] n = 2
[Relative] GS k
ESC r n
- 53 -
0A (print)
1B 72 01 (exit bi-color print mode)
[Result]:
ESC C n
GS (N pL pH fn a
[Function] bi-color print setting command, set to enter/exit bi-color mode and print color
[Format] ASCII GS ( N pL pH fn a
Hex 1D 28 4E pL pH fn a
Decimal 27 67 n
[Range] pL = 2, pH = 0, fn = 48, a = 48, 49, 50
[Notes] • a=48, exit bi-color print mode.
• a=49, enter bi-color print mode and choose color one.
•a=50, enter bi-color print mode and choose color two.
[Reference] ESC r, ESC C
GS (z nL nH 0 S
- 54 -
• This command is used at the beginning of the upside-down page. The part behind the command is to be printed.
It cannot be printed out immediately, but it is stored in the buffer. When the printer incepts the command to cut
paper (GS V) or to exit upside-down print mode, the printer print upside down.
• This command can only be used at the beginning of the line, otherwise it will be ignored.
• This command should cooperate with cut paper command or exit upside-down print mode command; otherwise
it will not be able to print upside down.
• The data to be printed in upside-down mode must be smaller than the command buffer (the capacity of buffer
can be checked by priting self-test pages), for pages larger than command buffer:
a) Printer ignores print data;
b) If ending with exiting upside-down printing mode, the printer will enter normal print mode with no action;
c) If ending with cut paper command, the printer will enter normal print mode after the action of cutting paper.
• Forbid command
The following commands are not supported under upside-down printing mode. If sending the following commands
under upside-down printing mode, the printer may not perform the expected result.
Command Function
GS : Start / end macro definition
GS ^ Perform macro definition
ESC D Set horizontal tab position
FS q Define NV bitmap
ESC = Select printer
GS ( A Perform testing print
ESC c 7 Greyscale print function
Note: Although FS q command is not supported under upside-down printing mode, FS p command is supported. If
NV bitmap is to be printed, enter upside-down printing mode by command. Before entering upside-down printing
mode, first send FS q command to define NV bitmap. Example is as follows:
1C 71 01 (defineNV bitmap,……..stand for bitmap data)
1D 28 7A 02 00 30 53 (enter upside-down printing mode)
1C 70 01 00 (print the bitmap downloaded in FLASH)
1D 28 7A 02 00 30 45 (print NV bitmap and exit upside-down printing mode)
• Perform the command immediately
In upside-down printing mode, this kind of command will be performed before printing. Details are as follows:
Command Function
GS a Automatically back to state
DLE ENQ n Real-time request
DLE DC4 Real-time cash drawer pulse
GS r Back to state
ESC p Produce cash drawer control pulse
Steps to enter upside-down printing mode through command:
- 55 -
a) Send command of entering upside-down printing mode;
b) Send page;
c) Send command of exiting upside-down printing mode or cutting paper and print sample page.
[Example] 1D 28 7A 02 00 30 53 (enter upside-down printing mode)
41 42 43 44 45 46 47 2E 2E 2E 0A 0A
31 32 33 34 35 36 37 38 2E 2E 2E 0A (print sample page)
1D 56 42 00 (cut paper and exit upside-down printing mode)
Normal print mode and upside-down print:
GS (z nL nH 0 E
[Function] print page data and exit upside-down printing mode and enter normal print mode.
[Format] ASCII GS ( z nL nH 0 E
Hex 1D 28 7A nL nH 30 45
Decimal 29 40 122 nL nH 4 8 69
[Range] nL = 2
nH = 0
[Notes] • This command should be used at the end of the upside-down page. After receiving the command,
the page data will be printed upside down.
• This command can only be used at the beginning of each line, otherwise it will be ignored.
• This command should be used together with the command to enter upside-down printing mode, otherwise
upside-down printing will not be able to perform.
GS { w f n1 n2 n3 n4 n5
[Function] Set water-based print bitmap parameters and enter water-based print mode.
[Format] ASCII GS { w f n1 n2 n3 n4 n5
Hex 1D 7B 77 02 n1 n2 n3 n4 n5
Decimal 29 123 119 02 n1 n2 n3 n4 n5
[Range] 0 ≤ n1 ≤ 1
0 ≤ n2 ≤ 2
- 56 -
1 ≤ n3≤ 255
0 ≤ n4 ≤ 255
1 ≤ n5 ≤ 255
[Notes] • n1 indicates water-based print mode:
n1 = 0: print water-based print bitmap when feeding paper
n1 = 1: print water-based print bitmap when printing
• n2 indicates water-based print justification mode
n2 = 0: left justification
n2 = 1: centering
n2 = 2: right justification
• n3 indicates water based print enlargement mode, 0-3 selects height, 4-7 selects width, values are as follows:
Width Height
Horizontal Vertical
Hex Decimal Hex Decimal
enlargement enlargement
10 16 1 (normal) 01 1 1 (normal)
20 32 2 (2double-width) 02 2 2 (2double-height)
30 48 3 03 3 3
40 64 4 04 4 4
50 80 5 05 5 5
60 96 6 06 6 6
• n4 indicates water-based print greyscale and luminosity adjustment, recommended value 0x20.
• n5 indicates the number of bitmap (defined by FS q command).
• This command should be used at the beginning of each line, otherwise it is dsabled.
• This command is valid only in line mode, not valid under page mode.
• Before using this command, use FS q to define NV bitmap.
[Example] 1D 7B 77 02 01 00 22 40 01
Explanation:
n1 = 0x01: Water-based print bitmap is only printed when there is a printing task.
n2 = 0x00: Water-based print bitmap left justification.
n3 = 0x22: Water-based print bitmap is enlarged twice horizontally and vertically respectively.
n4 = 0x40: Luminosity of water-based print is 0x40.
n1 = 0x01: regard number 1 NV bitmap as water-based print bitmap.
GS { w n
- 57 -
[Notes]
• n = 0:exit water-based print mode
• n = 1:enter water-based print mode
• This command is valid only at the beginning of each line.
• Before using this command, use water-based print setting command to set water based print parameters.
• After using this command to exit water-based print mode, the printer comes back to normal printing mode.
FS r n xl xh yl yh zl zh d1 d2 d3...d(k)
Data of the first Data of the Data of the third Data of the fourth
Real greyscale rank
dot line second dot line dot line dot line
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
- 59 -
[Reference] FS p
ESC c 6 n yl yh zl zh d1 d2 d3 ...d(k)
Data of the first Data of the Data of the third Data of the fourth
Real greyscale rank
dot line second dot line dot line dot line
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 0 1 1 1
8 1 0 0 0
- 60 -
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
ESC c 7 n RAM
[Function] Print downloaded RAM greyscale bitmap and set print mode.
[Format] ASCII ESC c 7 n
Hex 1B 63 37 n
Decimal 27 99 55 n
[Range] 0 ≤ n ≤ 255
(0 ≤ print mode ≤3, 0 ≤ bitmap number ≤ 7)
[Notes] • If the downloaded bitmap is not defined, the command will be ignored.
• If the downloaded bitmap is not defined, the command will be ignored.
• The command is disabled in upside-down mode.
• If the downloaded bit-image to be printed exceeds the printable area, the excess data is not printed.
• This command print bitmap in RAM but not in FLASH, the number of bitmap is defined by ESC c.
Choose print mode Choose bitmap number
Hex Decimal mode Hex Decimal 位图号
00 0 Normal
10 16 Double-width
00~07 00~07 00~07
20 32 Double-height
30 48 Quadruple
[Example] 1B 63 37 01 (choose bitmap one, normal mode)
1B 63 37 02 (choose bitmap two, normal mode)
1B 63 37 11 (choose bitmap one, double-width mode)
1B 63 37 21 (choose bitmap one, double-height)
1B 63 37 31 (choose bitmap one, choose quadruple mode)
ESC c : n
- 61 -
Decimal 27 99 58 n
[Range] 0 ≤ n ≤ 4
[Notes] • Paper-saving function refers to vertical compression according to a proportionality factor set by user
to reach the goal of saving paper.
• The command only refers to vertical compression.
• The command only works on compressible space. Compressible space includes: space between print data (except
space caused by space characters); 1D barcode (The minimal height 1D barcode can be compressed is 30 dots).
• The command compresses compressible space according to a certain proportionality factor, which is set as follows:
m Proportionality factor setting
0 No compression
1 Compress 25%
2 Compress 50%
3 Compress 75%
4 Compress 100%
• The command only works on the ticket sending this command.
• This command is enabled only in standard mode.
[Default] n=0
DLE ENQ n
- 62 -
DLE DC4 n m t
ESC 2
[Function] Select default line spacing to 1/6 inch (about 4.23 mm)
[Format] ASCII ESC 2
Hex 1B 32
Decimal 27 50
[Notes] The line spacing can be set independently in standard mode and in page mode.
[Relative] ESC 3
ESC 3 n
- 63 -
• In standard mode, the vertical motion unit (y) is used.
• In page mode, this command functions as follows, depending on the direction and starting position of the printable
area:
1) When the starting position is set to the upper left or lower right of the printable area by ESC T,
the vertical motion unit (y) is used.
2) When the starting position is set to the upper right or lower left of the printable area by ESC T,
the horizontal motion unit (x) is used.
• The maximum paper feed amount is 1016 mm (40 inches). Even if a paper feed amount of more than 1016 mm
(40 inches) is set, the printer feeds the paper only 1016 mm (40 inches).
[Default] The default line spacing is approximately 4.23 mm (1/6 inches).
[Relative] ESC 2, GS P
ESC = n
ESC @
[Function] Initialize printer, clear data in print buffer and set print mode to the default mode when powered on.
[Format] ASCII ESC @
Hex 1B 40
Decimal 27 64
[Notes] • The data in the receive buffer is not cleared.
• The macro definition is not cleared.
• The NV bitmap data is not cleared.
ESC L
- 64 -
Hex 1B 4C
Decimal 27 76
[Notes] • This command is enabled only when processed at the beginning of a line in standard mode.
• This command has no effect in page mode.
• After executing FF or ESC S, the printer returns to standard mode.
• This command sets the position where data is buffered to the position specified by ESC T within the printing area
defined by ESC W.
• This command switches the settings for the following commands to those for page mode:
1) Set right-side character spacing: ESC SP, FS S
2) Set line spacing: ESC 2, ESC 3
• This command can only change the indication bit and perform after switching to standard mode.
1) Turn 90° clockwise rotation mode on/off: ESC V
2) Select justification: ESC a
3) Turn upside-down printing mode on/off: ESC {
4) Set left margin: GS L
5) Set printable area width: GS W
• The printer returns to standard mode when power is turned on, the printer is reset, or ESC @ is used.
[Relative] FF, CAN, ESC FF, ESC S, ESC T, ESC W, GS $, GS \
ESC S
- 65 -
ESC c 0 n
ESC c 3 n
ESC c 5 n
ESC p m t1 t2
[Function] Output the cash drawer control pulse to specified connector pin.
[Format] ASCII ESC p m t1 t2
Hex 1B 70 m t1 t2
Decimal 27 112 m t1 t2
[Range] 0 ≤ m ≤ 1, 48≤m ≤ 49
0 ≤ t1 ≤ 255, 0≤ t2 ≤ 255
[Notes] M selects drawer kick-out connector pin as follows:
m Connector pin
- 67 -
0, 48 Drawer kick-out connector pin 2
1, 49 Drawer kick-out connector pin 5
• The pulse ON time is [t1 × 2 ms] and the OFF time is [t2 × 2 ms].
• If t2 < t1, the OFF time is [t1 × 2 ms].
[Relative] DLE DC4
GS (A pL pH n m
GS
- 68 -
• Macro definition is off when powered on.
• ESC @ cannot clear macro definition, so it can be included in macro definition.
• The data of macro definition can be 2048 bytes. Data out of 2048 bytes will be processed as normal data.
[Relative] GS ^
①GS V m ②GS V m n
GS ^ r t m
- 70 -
3 Programming Process Guide
Because the different printing status and error can be transmitted by Auto Status Back (ASB) command, it is
recommended that you can use ASB command to inquiry status. ASB command is effective when the printer is
powered on and can be directly sent to inquiry the status.
The recommended programming process is as follows:
1) Verify the printer status.
Make sure that the printer status is normal before sending data to print.
2) Start the printer.
Make sure that the previous setting does not affect the current printing.
3) Set the print content.
Set the print content such as character property, bitmap property, barcode property, and so on for the needed
printing effect.
4) Send the data for printing, including the setup command before printing.
If the printing data is bitmap data, please do not send the status inquiry command before sending printing data.
5) Verify the printer status after printing.
If ASB is enabled, the printer returns the printer status automatically.
- 71 -
Appendix
Appendix A: Code128
In CODE128 bar code system, it is possible to represent 128 ASCII characters, the one hundred numbers from 00 to
99 and some special characters with three code sets: A, B and C. Each code set is used for representing the following
characters:
• Code set A: ASCII characters 00H to 5FH
• Code set B: ASCII characters 20H to 7FH
• Code set C: 100 numerals from 00 to 99
The following special characters are also available in CODE128:
• SHIFT characters
In code set A, the character just after SHIFT is processed as a character for code set B. In code set B, the character
just after SHIFT is processed as a character for code set A. SHIFT characters cannot be used in code set C.
• Code set selection character (CODE A, CODE B, CODE C).
This character switches the following code set to code set A, B, or C.
• Function character (FNC1, FNC2, FNC3, FNC4)
The usage of function characters depends on the application software. In code set C, only FNC1 is available.
- 72 -
A.2 Code Tables
Characters in CODE A
Transmit Data Transmit Data Transmit Data
Character Character Character
Hex Decimal Hex Decimal Hex Decimal
NULL 00 0 ( 28 40 P 50 80
SOH 01 1 ) 29 41 Q 51 81
STX 02 2 * 2A 42 R 52 82
ETX 03 3 + 2B 43 S 53 83
EOT 04 4 , 2C 44 T 54 84
ENQ 05 5 - 2D 45 U 55 85
ACK 06 6 . 2E 46 V 56 86
BEL 07 7 / 2F 47 W 57 87
BS 08 8 0 30 48 X 58 88
HT 09 9 1 31 49 Y 59 89
LF 0A 10 2 32 50 Z 5A 90
VT 0B 11 3 33 51 [ 5B 91
FF 0C 12 4 34 52 \ 5C 92
CR 0D 13 5 35 53 ] 5D 93
SO 0E 14 6 36 54 ^ 5E 94
SI 0F 15 7 37 55 _ 5F 95
DLE 10 16 8 38 56 FNC1 7B,31 123,49
HC1 11 17 9 39 57 FNC2 7B,32 123,50
HC2 12 18 : 3A 58 FNC3 7B,33 123,51
HC3 13 19 ; 3B 59 FNC4 7B,34 123,52
HC4 14 20 < 3C 60 SHIFT 7B,53 123,83
NAK 15 21 = 3D 61 CODEB 7B,42 123,66
SYN 16 22 > 3E 62 CODEC 7B,43 123,67
ETB 17 23 ? 3F 63
CAN 18 24 @ 40 64
EM 19 25 A 41 65
SUB 1A 26 B 42 66
ESC 1B 27 C 43 67
FS 1C 28 D 44 68
GS 1D 29 E 45 69
RS 1E 30 F 46 70
US 1F 31 G 47 71
SP 20 32 H 48 72
- 73 -
! 21 33 I 49 73
" 22 34 J 4A 74
# 23 35 K 4B 75
$ 24 36 L 4C 76
% 25 37 M 4D 77
& 26 38 N 4E 78
' 27 39 O 4F 79
- 74 -
Characters in CODE B
Transmit Data Transmit Data Transmit Data
Character Character Character
Hex Decimal Hex Decimal Hex Decimal
SP 20 32 H 48 72 p 70 112
! 21 33 I 49 73 q 71 113
" 22 34 J 4A 74 r 72 114
# 23 35 K 4B 75 s 73 115
$ 24 36 L 4C 76 t 74 116
% 25 37 M 4D 77 u 75 117
& 26 38 N 4E 78 v 76 118
' 27 39 O 4F 79 w 77 119
( 28 40 P 50 80 x 78 120
) 29 41 Q 51 81 y 79 121
* 2A 42 R 52 82 z 7A 122
+ 2B 43 S 53 83 { 7B,7B 123,123
, 2C 44 T 54 84 | 7C 124
- 2D 45 U 55 85 } 7D 125
. 2E 46 V 56 86 — 7E 126
/ 2F 47 W 57 87 DEL 7F 127
0 30 48 X 58 88 FNC1 7B,31 123,49
1 31 49 Y 59 89 FNC2 7B,32 123,50
2 32 50 Z 5A 90 FNC3 7B,33 123,51
3 33 51 [ 5B 91 FNC4 7B,34 123,52
4 34 52 \ 5C 92 SHIFT 7B,53 123,83
5 35 53 ] 5D 93 CODEA 7B,41 123,65
6 36 54 ^ 5E 94 CODEC 7B,43 123,67
7 37 55 _ 5F 95
8 38 56 ` 60 96
9 39 57 a 61 97
: 3A 58 b 62 98
; 3B 59 c 63 99
< 3C 60 d 64 100
= 3D 61 e 65 101
> 3E 62 f 66 102
? 3F 63 g 67 103
@ 40 64 H 68 104
A 41 65 i 69 105
B 42 66 j 6A 106
C 43 67 k 6B 107
- 75 -
D 44 68 l 6C 108
E 45 69 m 6D 109
F 46 70 n 6E 110
G 47 71 o 6F 111
Characters in CODE C
Transmit Data Transmit Data Transmit Data
Character Character Character
Hex Decimal Hex Decimal Hex Decimal
00 00 0 40 28 40 80 50 80
01 01 1 41 29 41 81 51 81
02 02 2 42 2A 42 82 52 82
03 03 3 43 2B 43 83 53 83
04 04 4 44 2C 44 84 54 84
05 05 5 45 2D 45 85 55 85
06 06 6 46 2E 46 86 56 86
07 07 7 47 2F 47 87 57 87
08 08 8 48 30 48 88 58 88
09 09 9 49 31 49 89 59 89
10 0A 10 50 32 50 90 5A 90
11 0B 11 51 33 51 91 5B 91
12 0C 12 52 34 52 92 5C 92
13 0D 13 53 35 53 93 5D 93
14 0E 14 54 36 54 94 5E 94
15 0F 15 55 37 55 95 5F 95
16 10 16 56 38 56 96 60 96
17 11 17 57 39 57 97 61 97
18 12 18 58 3A 58 98 62 98
19 13 19 59 3B 59 99 63 99
20 14 20 60 3C 60 FNC1 7B,31 123,49
21 15 21 61 3D 61 CODEA 7B,41 123,65
22 16 22 62 3E 62 CODEB 7B,42 123,66
23 17 23 63 3F 63
24 18 24 64 40 64
25 19 25 65 41 65
26 1A 26 66 42 66
27 1B 27 67 43 67
28 1C 28 68 44 68
29 1D 29 69 45 69
30 1E 30 70 46 70
31 1F 31 71 47 71
- 76 -
32 20 32 72 48 72
33 21 33 73 49 73
34 22 34 74 4A 74
35 23 35 75 4B 75
36 24 36 76 4C 76
37 25 37 77 4D 77
38 26 38 78 4E 78
39 27 39 79 4F 79
The printer operates in two print modes: standard mode and page mode. In standard mode, the printer prints and
feeds paper each time it receives print data or paper feed commands. In page mode, all the received print data and
paper feed commands are processed in the specified memory, and the printer executes no operation. All the data in
the memory is then printed when an ESC FF or FF command is received.
For example, when the printer receives the data "ABCDEF" <LF> in standard mode, it prints "ABCDEF" and feeds the
paper by one line. In page mode, "ABCDEF" is written to the specified printing area in memory, and the position in
memory for the next print data is shifted by one line.
The ESC L command puts the printer into page mode, and all commands received thereafter are processed in page
mode. Executing an ESC FF command prints the received data collectively, and executing an FF command restores
the printer to standard mode after the received data is printed collectively. Executing an ESC S command restores
the printer to standard mode without printing the received data in page mode; the received data is cleared from
memory instead.
The available commands and parameters are the same for both standard and page modes. However, these values
can be set independently in each mode for the ESC SP, ESC 2, ESC 3, and FS S commands. For these commands,
different settings can be stored for each mode.
B.3 Formatting of Print Data in the Printable Area
1) The printable area is set by ESC W. If all printing and feeding operations are complete before the printer receives
the ESC W command, the left side (as you face the printer) is taken as the origin (x0, y0) of the printable area.
The printable rectangular area is defined by the length (dx dots) extending from and including the origin (x0, y0)
in the x direction (perpendicular to the paper feed direction), and by the length (dy dots) in the y direction (paper
- 77 -
feed direction). (If the ESC W command is not used, the printable area remains the default value.)
2) When the printer receives print data after ESC W sets the printable area and ESC T sets the printing direction,
the print data is formatted within the printable area so that point A in Figure B.2 is at the beginning of the
printable area as a default value. (When a character is printed, point A is the baseline.) Print data containing
downloaded bit images or bar codes is formatted so that the bottom point of the left side of the image data
(point B in Figure B.3) is aligned with the baseline.
3) If the print data (including character spacing) exceeds the printable area before the printer receives a command
(e.g., LF or ESC J) that includes line feeding, a line feed is executed automatically within the printable area. The
print position, therefore, moves to the beginning of the next line. The line feed amount depends on the values
set by commands (such as ESC 2 and ESC 3).
4) The default value of the line spacing is set to 1/6 inch and corresponds to 31 dots in the vertical direction. If
print data for the next line contains extended characters that are higher than double-height characters, bit
images taking up two or more lines, or bar codes higher than normal characters, the amount of line feeding
may be insufficient, resulting in overlapping of the characters' higher-order dots with the previous line. To avoid
this, increase the amount of line spacing.
Example
When printing a downloaded bit image of six bytes in the vertical direction, use the following formula:
{number of vertical dots (8×6) - number of dots for feeding at the beginning of the printable area (24)} × vertical
motion unit (203/203) = 24
Therefore, 24 dots are required for feeding.
Use the following commands:
ESC W xL, xH, yL, yH, dxL, dxH, dyL, dyH
ESC T n
ESC 3 24 Set line spacing to be added.
LF
GS / 1
ESC 2 Reset the line spacing to 1/6 inch.
Command Function
HT Horizontal tab
LF Print and line feed
- 78 -
FF Print and paper feed
CR Print and carriage return
CAN In page mode, delete all the print data in buffer area.
DLE EOT Real-time status transmission
DLE ENQ Real-time request
ESC FF Print data in page mode
ESC SP Set right-side character spacing
ESC ! Select print mode
ESC $ Set horizontal absolute print position.
ESC % Select/cancel user-defined character set
ESC & Define user-defined characters
ESC * Select bitmap mode
ESC - Select/cancel underline mode
ESC 2 Select default line spacing
ESC 3 n Select line spacing
ESC ? Cancel user-defined characters
ESC @ Initialize printer
ESC D Set horizontal tab positions
ESC E Select/cancel emphasized mode
ESC G Select/cancel double-strike printing mode
ESC J Print and feed paper
ESC L Select page mode
ESC M Select character font
ESC R Select an international character set
ESC S Select standard mode
ESC T Select the print direction in page mode.
ESC V Turn 90° clockwise rotation mode on/off
ESC W Set printing areain page mode
ESC \ Set relative horizontal printing area
ESC a Select justification
ESC c 5 Enable/disable panel buttons
ESC d Print and feed n lines
ESC t Select the code page
ESC { Turn on/off upside-down printing mode
GS FF Position the marked paper
GS ! Select character size
GS $ Set the absolute vertical position in page mode
- 79 -
GS * Define the bitmap to be downloaded
GS / Print downloaded bitmap
GS : Turn on/off micro definition
GS B Turn on/off white/black reverse printing mode
GS H Select the printing position of HRI characters
GS L Set left margin
GS V Select cut paper mode
GS W Set printable area width
GS \ Set relative vertical position in page mode
GS ^ Execute macro definition
GS a Enable/Disable Automatic Status Back (ASB)
GS f Select a font for the HRI characters
GS h Select barcode height
GS k Print barcode
GS r Status back
GS v 0 Print raster bitmap
GS w Set barcode width
FS ! Set the print mode for Chinese characters
FS & Select Chinese character mode
FS - Turn underline mode on/off for Chinese characters
FS . Cancel Chinese character mode
FS 2 Define user-defined Chinese characters
FS S Set left-side and right-side Chinese character spacing
FS W Turn quadruple-size mode on/off for Chinese characters
FS p Print NV bitmap
FS q Define NV bitmap
GS s Set parameters of GS1 barcode
ESC r Enter\Exit double color mode
ESC C Select print color
ESC c : Choose paper-saving mode
GS ( Upside-downmode command
GS { Watermark mode command
FS r NV grayscale bitmap download
ESC c RAM grayscale bitmap command
- 80 -