ESC Commands

From wizarPOS
Revision as of 07:25, 18 April 2018 by Zzy (talk | contribs) (→‎ESC V)

ESC Commands

HT

HT
Name Horizontal tab
Format ASCII HT

Hex 09

Decimal 9

Description Move the print position to the next tab position.
  • If no tab position is set (it is default setting), this command will be ignored
  • The tab position is set by ESC D
  • If the tab position exceeds the print area, printing position will be moved to the starting position of next line (Considering as a line is full, print the data and feed one line).


Reference ESC D

LF

LF
Name Print and feed paper
Format ASCII LF

Hex 0A

Decimal 10

Description Print the data in the printer buffer, then feed paper for one line

according to the current line space settings. After printing, the print

position moves to the beginning of the line.

Reference ESC 2,ESC 3

CR

CR
Name Carriage return
Format ASCII CR

Hex 0D

Decimal 13

Description Adjust the print position to the starting position of this line and line

feed.

Reference LF

ESC SP n

ESC SP n
Name Set the right-side character space
Format ASCII ESC SP n

Hex 1B 20 n

Decimal 27 32 n

Description Set the right right-side character space is [n×0.125mm]
  • For double width mode, the character right margin is double than normal mode.
  • The command will not effective to Chinese characte
Default n=0

ESC ! n(Ⅰ)

ESC ! n
Name set the font type
Format ASCII ESC ! n

Hex 1B 21 n

Decimal 27 33 n

Description Set the font type (italic, border, bold, double width, double height,

inverse or underline). And the bit definitions of parameter n are shown as follows table

Reference ESC -, ESC E, GS !
Default n=0

ESC ! n(Ⅱ)

Bit On/off Hex Decimal Function
0 off 00 0 Character type A (12×24)
0 on 01 1 Character type B (9×17)
4 off 00 0 Double-height mode off
4 on 10 16 Double-height mode on
5 off 00 0 Double-width mode off
5 on 20 32 Double-width mode on
7 off 00 0 Underline mode off
7 on 80 128 Underline mode on
  • If set double-width and double-height at the same time, quadrupled thecharacter size.
  • Can not underline the blank generated by HT or the rotate 90 character.
  • The width of under line set by ESC -, have not affected by the character size.
  • ESC M also can set character type.
  • ESC – also can turn on/off underline.
  • GS ! also can set character size.

ESC $ nL nH

ESC $ nL nH
Name Set the absolute print position
Format ASCII ESC $ nL nH

Hex ESC $ nL nH

Decimal 27 36 nL nH

Parameter Range
  • 0≤nL≤255
  • 0≤nH≤255
Description Moves the print position to a location in a distance of (nL + nH × 256) dots from

the starting position for printing

Reference ESC \

ESC * m nL nH

ESC * m nL nH d1...dk
Name Select bit-image mode
Format ASCII ESC * m nL nH d1...dk

Hex 1B 2A m nL nH d1...dk

Decimal 27 42 m nL nH d1...dk

Parameter Range
  • m = 0,1,32,33
  • 0≤nL≤255
  • 0≤nH≤3
  • 0≤d≤255
Description Stores the bit image data in the print buffer using the mode specified

by bit image mode m, nl and nh specifies a bit image in the horizontal direction as(nl+256×nh) dots, [d]k specifies the bit image data (column format) k indicates the amount of bit image data, but it does not need to be transmitted..

Note
  • If m is out of Parameter Range, the nL and the other data will regard as the normal data.
  • If the bit image exceeds one line of print area, the excess part will be Ignored.
  • Data [d]k specifies a bit printed to 1 and not printed to 0.
  • Bold, double-strike, underline, character size, upside-down, black/white command will not affect to the command.

ESC - n

ESC - n
Name Turn underline mode on/off
Format ASCII ESC - n

Hex 1B 2D n

Decimal 27 45 n

Description Turns underline mode on or off using n as follows
  • if n= 0 or 48, Turns off underline mode
  • if n=1 or 49, Turns on underline mode (1-dot thick)
  • if n=2 or 50, Turns on underline mode (2-dots thick)
Note
  Can not underline the blank generated by HT or the rotate 90 character.
  Default width is 1-dot thick.
  The thick is not affected by the character size.
  ESC ! can also turn on/off underline.
Default n=0
Reference ESC !

ESC 2

ESC 2
Name Set the line space to a default value 3mm
Format ASCII ESC 2

Hex 1B 32

Decimal 27 50

Description Set the line space to a default value 3mm(24×0.125mm)
Reference ESC 3

ESC 3

ESC 3
Name Set the line space to n dots
Format ASCII ESC 3 n

Hex 1B 33 n

Decimal 27 51 n

Description ASet the line space to n dots
Default n=24
Reference ESC 2

ESC SO

ESC SO
Name Turn on double width mode
Format ASCII ESC SO n

Hex 1B 0E n

Decimal 27 14 n

Parameter Range 0≤n≤255
Description Turn on double width mode
Note Use LF or ESC DC4 to turn off
Default n=2

ESC DC4

ESC DC4
Name Turn off double width mode
Format ASCII ESC DC4 n

Hex 1B 14 n

Decimal 27 20 n

Parameter Range 0≤n≤255
Description Turn off double width mode
Default n=2
Note The value of n is same with the n in turn on command

ESC @

ESC @
Name Initialize the printer
Format ASCII ESC @

Hex 1B 40

Decimal 27 64

Description Reset the printer, the print mode reset to the default setting
Note Can not clear the data in receive buffer

ESC B

ESC B
Name Set the left margin
Format ASCII ESC B n

Hex 1B 42 n

Decimal 27 66 n

Parameter Range 0≤n≤47
Description Set the left margin
Note This command just affects the character, doesn’t affect the Chinese
Default n=0

ESC D

ESC D
Name Set horizontal tab positions
Format ASCII ESC D n1...nk NUL

Hex 1B 44 n1...nk 00

Decimal 27 68 n1...nk 0

Parameter range
  • 1≤n≤255
  • 0≤k≤32
Description Set the horizontal tab positions, the meanings of parameters are as follows:

n1..nk are horizontal tab position (Unit: 8 dots), NULL is a stop character

Note
  1. Horizontal tab position stored as a data, the data value is [character width×n] measured from the line begin.
  2. When this command is used, any previous horizontal tab settings will be canceled.
  3. The tab position can be switched by HT command
  4. The max set value is 32(k=32), larger than 32, the larger data will regard as normal data.
  5. Transmit [d]k in ascending order and place a NULL code at the end.
  6. When dk is less than or equal to dk-1, horizontal tab setting is finished, and the following data will be processed as normal data.
  7. ESC D NUL will cancel the horizontal tab position.
  8. Even the character width change, the set tab position will not change.
Defualt Default tab position is character type A(12×24), the eight character space

(column 9,17,25 ...)

Reference HT

ESC E

ESC E
Name Turn bold mode on/off
Format ASCII ESC E n

Hex 1B 45 n

Decimal 27 69 n

Parameter range 0≤n≤255
Descriptiopn Turns bold mode on or off using n as follows:

If n = 0, turn off the bold, if n = 1, turn on the bold.

Default n = 0
Reference ESC !

ESC J

ESC J
Name Print and feed paper for n dots
Format ASCII ESC J n

Hex 1B 4A n

Decimal 27 74 n

Parameter range 0≤n≤255
Description Print the data in the printer buffer and feed paper for n dots(0.125mm per

dot)

Note
  • After printing, the print position moves to the beginning of the line.
  • This has not affected the set value by ESC 2 or ESC 3.

ESC G

ESC G
Name Print and feed paper
Format ASCII ESC G n

Hex 1B 47 n

Decimal 27 71 n

Parameter range 0≤n≤255
Description Turn double-strike mode on/off:
  • 0: turn off double-strike
  • 1: turn on double-strike。
Note The double-strike has the same print with bold print
Default n=0
Reference ESC E

ESC M

ESC M
Name Select the character type
Format ASCII ESC M n

Hex 1B 4D n

Decimal 27 77 n

Parameter range n = 0,1,48,49
Description Select character type:

If n=0 or 48,Character type A (12×24) If n=1 or 49,Character type B (9×17)

Reference ESC!

ESC R

ESC R
Name Select international character
Format ASCII ESC R n

Hex 1B 52 n

Decimal 27 82 n

Parameter range 0≤n≤255
Description Selects an international character set n as follows::
  • n=0 refer to U.S.A
  • n=1 refer to France
  • n=2 refer to Germany
  • n=3 refer to U.K.
  • n=4 refer to Denmark I
  • n=5 refer to Sweden
  • n=6 refer to Italy
  • n=7 refer to Spain I
  • n=8 refer to Japan
  • n=9 refer to Norway
  • n=10 refer to Denmark II
  • n=11 refer to refer to Spain II
  • n=12 refer to Latin America
  • n=13 refer to Korea
  • n=14 refer to Slovenia/Croatia
  • n=15 refer to China
  • n=16 refer to Vietnam
  • n=17 refer to Arabia
  • n=101 refer to ISO-8859-1
  • n=102 refer to ISO-8859-2
  • n=103 refer to ISO-8859-3
  • n=104 refer to ISO-8859-4
  • n=105 refer to ISO-8859-5
  • n=107 refer to ISO-8859-7
  • n=109 refer to ISO-8859-9
  • n=113 refer to ISO-8859-13
  • n=115 refer to ISO-8859-15
  • n=130 refer to GB13030-2000
Default n=0(Suggest to use n >100)

ESC V

ESC V
Name Turn 90° clockwise rotation mode on/off
Format ASCII ESC V n

Hex 1B 56 n

Decimal 27 86 n

Parameter range n = 0,1,48,49
Description Turn 90° clockwise rotation mode on/off using n as follows:

If n=0 or 48, Turns off 90°clockwise rotation mode If n=1 or 49, Turns on 90°clockwise rotation mode

Note Underline is not effective for the rotation characters
Default n=0
Reference ESC !,ESC -

CR

LF
Name Print and feed paper
Format ASCII CR

Hex 0D

Decimal 13

Description Adjust the print position to the starting position of this line and line

feed.

Reference ESC 2,ESC 3

CR

LF
Name Print and feed paper
Format ASCII CR

Hex 0D

Decimal 13

Description Adjust the print position to the starting position of this line and line

feed.

Reference ESC 2,ESC 3

CR

LF
Name Print and feed paper
Format ASCII CR

Hex 0D

Decimal 13

Description Adjust the print position to the starting position of this line and line

feed.

Reference ESC 2,ESC 3

CR

LF
Name Print and feed paper
Format ASCII CR

Hex 0D

Decimal 13

Description Adjust the print position to the starting position of this line and line

feed.

Reference ESC 2,ESC 3