©Copyright 2011 BROTHER INDUSTRIES, LTD.
ESC/P Command Reference
Version 1.03
Model Name: PT-9800PCN/PT-9700PC
Created by: Brother Industries, Ltd.
1
Machine Model: PT-9800PCN/PT-9700PC
IMPORTANT - PLEASE READ CAREFULLY
This documentation (“Documentation”) gives you information that will assist you in controlling
your Machine Model.
You may use the Documentation only if you first agree to the following conditions.
If you do not agree to the following conditions, you may not use the Documentation.
Condition of Use
You may use and reproduce the Documentation to the extent necessary for your own use of
your Machine Model (“Purpose”). Unless expressly permitted in the Documentation, you may
not;
(i) copy or reproduce the Documentation for any purpose other than the Purpose,
(ii) modify, translate or adapt the Documentation, and/or redistribution to any third party,
(iii) rent or lease the Documentation to any third party, or,
(iv) remove or alter any copyright notices or proprietary rights legends included within the
Documentation.
No Warranty
a. Any updates, upgrades or alteration of the Documentation or Machine Model will be
performed at the sole discretion of Brother. Brother may not respond to any request or
inquiry about the Documentation.
b. THIS DOCUMENTATION IS PROVIDED TO YOU "AS IS" WITHOUT WARRANTY OF ANY
KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. BROTHER DOES
NOT REPRESENT OR WARRANT THAT THIS DOCUMENTATION IS FREE FROM
ERRORS OR DEFECTS.
c. IN NO EVENT SHALL BROTHER BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE,
INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER, ARISING OUT OF THE USE, INABILITY TO USE, OR THE RESULTS OF
USE OF THE DOCUMENTATION OR ANY SOFTWARE PROGRAM OR APPLICATION
YOU DEVELOPED IN ACCORDANCE WITH THE DOCUMENTATION.
2
[Contents]
Control code list.................................................................................................................... 6
Print area ..............................................................................................................................9
Characters ..........................................................................................................................10
Print position....................................................................................................................... 11
Line feed amount ................................................................................................................ 12
Document creation flow ......................................................................................................13
Control command details ....................................................................................................15
Character/style selection commands ..............................................................................15
ESC R Select international character set .........................................................15
ESC k Select font (Over sea model only) ........................................................17
ESC t Select character code table.................................................................. 17
Text printing commands ..................................................................................................18
ESC 4 Apply italic style....................................................................................18
ESC 5 Cancel italic style.................................................................................. 18
ESC E Apply bold style ....................................................................................18
ESC F Cancel bold style.................................................................................. 19
ESC G Apply double-strike printing ..................................................................19
ESC H Cancel double-strike printing................................................................ 19
ESC W Specify double-width characters........................................................... 20
SI Specify compressed characters............................................................20
ESC SI Specify compressed characters............................................................20
DC2 Cancel compressed characters ............................................................ 21
ESC - Apply/cancel underlining ......................................................................21
ESC ! Global formatting .................................................................................. 22
ESC X Specify character size ..........................................................................23
ESC i f Apply/cancel a frame (global)...............................................................23
CAN Clear text.............................................................................................. 24
DEL Delete one character ............................................................................25
ESC CR Not available.........................................................................................25
Line feed commands.......................................................................................................26
ESC 0 Specify line feed of 1/8 inch..................................................................26
ESC 2 Specify line feed of 1/6 inch..................................................................26
ESC 3 Specify line feed of n/180 inch..............................................................26
ESC A Specify line feed of n/60 inch................................................................ 27
Horizontal movement commands....................................................................................28
3
CR Carriage return .....................................................................................28
ESC $ Specify absolute horizontal position .....................................................28
ESC \ Specify relative horizontal position .......................................................29
ESC a Specify alignment .................................................................................29
Vertical movement commands ........................................................................................30
LF Line feed...............................................................................................30
FF Page feed .............................................................................................30
ESC J Forward paper feed ..............................................................................30
Paper formatting.............................................................................................................. 31
ESC i l Specify label length ..............................................................................31
ESC i m Specify margin width ............................................................................31
Printer control commands ...............................................................................................32
ESC @ Initialize ................................................................................................32
Graphics commands .......................................................................................................33
ESC * Select bit image....................................................................................33
ESC K 8-dot single-density bit image............................................................... 38
ESC L 8-dot double-density bit image .............................................................39
ESC Y 8-dot double-speed double-density bit image....................................... 40
ESC Z 8-dot quadruple-density bit image ........................................................40
Kanji commands..............................................................................................................41
FS & Specify kanji mode (Chinese model only) .......................................... 41
FS . Cancel kanji mode (Chinese model only) .............................................41
FS Y Specify kanji size ................................................................................41
FS - Apply kanji underlining .........................................................................42
FS SI Specify half-width characters................................................................43
FS DC2 Cancel half-width characters ................................................................43
FS k Select font (Over sea model only) ........................................................43
Advanced commands...................................................................................................... 44
ESC i B Bar code ...............................................................................................44
ESC i Q 2D bar code (QR Code) ....................................................................... 48
ESC i P Specify QR Code version .....................................................................52
ESC i V 2D bar code (PDF417) .........................................................................53
ESC i D 2D bar code (DataMatrix) .....................................................................57
ESC i M 2D bar code (MaxiCode) ......................................................................60
ESC i F Print transferred data............................................................................ 62
ESC i a Switch command mode ........................................................................66
ESC i S Request printer status ..........................................................................67
4
ESC i L Apply/cancel rotated printing ................................................................70
ESC i C Specify cut setting ................................................................................70
ESC i U B Specify baud rate .............................................................................71
ESC i U b Specify bit length .................................................................................. 71
ESC i U P Specify parity setting ........................................................................72
ESC i U C Specify busy control......................................................................... 72
Character code ...................................................................................................................73
Standard character code table for ESC/P codes (Over sea modl only)............ 73
Eastern European character code table (Windows 1250) (Over sea modl only) .... 74
Western European character code table (Windows 1252) (Over sea modl only) ... 75
Appendix CG list (Chinese modl only) ................................................................ 76
Chinese character catalog (based on GB2312).................................................... 78
BROTHER PT-9800PCN/9700PC ESC/P specifications ....................................................84
5
Control code list
Character/style selection
ESC R 1B 52 Select international character set
ESC k 1B 6B Select font
ESC t 1B 74 Select character code table
Text printing
ESC 4 1B 34 Apply italic style
ESC 5 1B 35 Cancel italic style
ESC E 1B 45 Apply bold style
ESC F 1B 46 Cancel bold style
ESC G 1B 47 Apply double-strike printing
ESC H 1B 48 Cancel double-strike printing
ESC W 1B 57 Specify double-width characters
SI 0F Specify compressed characters
ESC SI 1B 0F Specify compressed characters
DC2 12 Cancel compressed characters
ESC - 1B 2D Apply/cancel underlining
ESC ! 1B 21 Global formatting
ESC X 1B 58 Specify character size
ESC i f 1B 69 66 Apply/cancel a frame (global)
CAN 18 Clear text
DEL 7F Delete one character
ESC CR 1B 0D Not available
Line feeds
ESC 0 1B 30 Specify line feed of 1/8 inch
ESC 2 1B 32 Specify line feed of 1/6 inch
ESC 3 1B 33 Specify minimum line feed
ESC A 1B 41 Specify line feed of n/60 inch
Horizontal movement
CR 0D Carriage return
ESC $ 1B 24 Specify absolute horizontal position
ESC \ 1B 5C Specify relative horizontal position
ESC a 1B 61 Specify alignment
6
Vertical movement
LF 0A Line feed
FF 0C Page feed
ESC J 1B 4A Forward paper feed
Paper formatting
ESC i l 1B 69 6C Specify label length
ESC i m 1B 69 6D Specify margin width
Printer control
ESC @ 1B 40 Initialize
Graphics commands
ESC * 1B 2A Select bit image
ESC K 1B 4B 8-dot single-density bit image
ESC L 1B 4C 8-dot double-density bit image
ESC Y 1B 59 8-dot double-speed double-density bit
image
ESC Z 1B 5A 8-dot quadruple-density bit image
Kanji commands
FS & 1C 26 Specify kanji mode
FS . 1C 2E Cancel kanji size
FS Y 1C 59 Specify kanji size
FS - 1C 2D Apply kanji underlining
FS S 1C 0F Specify half-width characters
FS DC2 1C 12 Cancel half-width characters
FS k 1C 6B Select font
7
Advanced commands
ESC i B 1B 69 42 Bar code
ESC i Q 1B 69 51 2D bar code (QR Code)
ESC i P 1B 69 50 Specify QR Code version
ESC i V 1B 69 56 2D bar code (PDF417)
ESC i D 1B 69 44 2D bar code (DataMatrix)
ESC i M 1B 69 4D 2D bar code (MaxiCode)
ESC i F 1B 69 46 Print transferred data
ESC i a 1B 69 61 Switch command mode
ESC i S 1B 69 53 Request printer status
ESC i L 1B 69 4C Apply/cancel rotated printing
ESC i C 1B 69 43 Specify cut setting
ESC i U B 1B 69 55 42 Specify baud rate
ESC i U b 1B 69 55 62 Specify bit length
ESC i U P 1B 69 55 50 Specify parity setting
ESC i U C 1B 69 55 43 Specify busy control
8
Print area
The print area for each tape width is listed below.
Length (④ ) (label length)
Width (①)
(tape width)
②
Printable area
⑤
Top margin
(③ )
Bottom
mar
in (③
Left margin (⑥)
Right margin (⑥)
Type
Width
(mm)
Printable
area
(vertical)
(mm/dots)
Top/bottom
margins
(mm)
Length
(mm)
Printable
area
(horizontal)
mm/dots
Left/right
margins
(mm)
Dot position
*1
① ② ③ ④ ⑤ ⑥
36 36 27.1/384 4.45
24 24 22.6/320 0.71
18 18 16.5/234 0.75
12 12 10.6/150 0.71
9 9 7.5/106 0.76
6 6 4.5/64 0.74
3.5 6 4.5/64 0.74
*1
The dot position for the lowest dot is specified as 1. (1 through 384)
1 ~ 384 16
33 ~ 352 13
76 ~ 309 9
118 ~ 267 6
140 ~ 245 4
161 ~ 224 2
161 ~ 224 2
・ The maximum length (④) is 1 m, and the minimum left and right margins (⑥ ) are 1
Max. no.
of printed
lines
mm.
9
Characters
<Overseas>
This system uses single-byte character codes and is installed with two bitmap fonts (Letter
Gothic and Helsinki).
Each font has six sizes: 21 dots, 28 dots, 44 dots, 56 dots, 88 dots and 120 dots.
<Chinese>
The single-byte character codes are installed with one bitmap fonts (Helsinki).
Each font has six sizes: 24 dots, 32 dots, 48 dots, 64 dots.
The double-byte character codes are available GB 2312, one bitmap fonts (boldface).
Each font has six sizes: 24 by 24 dots, 32 by 32 dots, 48 by 48 dots, 64 by 64 dots.
Character size
<Overseas>
Each font is available in full size, compressed (half width) and double width.
Full
size
Half
width
Double width
Line-drawing characters (┘└ ┤─ ├ │ ┼ ┬ ┐┌ ) and shaded characters appear with the width
of the Letter Gothic font, regardless of the specified font setting.
10
Print position
The print position is the standard position for printing characters, bitmaps and bar codes.
With the print position, there is a horizontal print position, which is the reference point for
vertical position movement.
Each character is arranged so that their top edge aligns with the print position.
The baseline of each character is the bottom edge of the character, regardless of size, font,
etc.
All characters on the same line are printed so that the baseline position is the same for
each character.
Print position
Baseline position
If the text consists of characters with different heights, the characters are aligned on the
baseline of the tallest character in the line of text.
In addition, underlines are printed 4 dots below the baseline position.
Bitmaps, bar codes and transferred images
These types of image data are treated in the same way as characters and are printed so
that the bottom edge of the image aligns with the baseline.
Same line
Print position
A
Baseline position
・ Horizontal movement to the right between characters or images is regarded as being on
the same line; however, movement to the left is regarded as being on different lines if text
wrapping occurs.
11
Line feed amount
The line feed amount is the amount of vertical movement from the print position of one line
to the print of the next line.
HHHHHHHHHHHHH
HHHHHHHHHHHHH
HHHHHHHHHHHHH
The line feed amount is specified using ESC 0, ESC 2, ESC A and ESC 3.
Line feed amount
12
Document creation flow
The flow for creating documents is shown below.
A Switch command mode (ESC i a) and Initialize (ESC @)
B Format settings
1. Apply/cancel rotated printing (ESC i L)
2. Specify line feed amount (ESC 0, ESC 2, ESC 3 and ESC A)
C Print operations
1. Specify print position
Specify vertical position (ESC J)
Specify horizontal position (ESC $, ESC \ and ESC a)
2. Transfer print data (one line)
If necessary, transfer text processing codes (see D), bit images, bar codes
and downloaded data (see E).
3. End of line and feed paper (CR and LF)
4. Repeat 1 through 3 described above.
5. End of page, Specify cut setting (ESC i C) and Page feed (FF)
6. Repeat 1 through 6 described above.
7. End of document
13
D Text operations
1. Select character set
Select font (ESC k)
Select character code (ESC t)
Select international character set (ESC R)
Specify character size (ESC X)
2. Character style (ESC 4, ESC 5, ESC E, ESC F, ESC G, ESC H, ESC W, SI,
ESC SI, DC2, ESC – and ESC !)
3. Character code
4. ANK mode/Kanji mode select.( FS &、FS.)
5. Specify Character code for Kanji code
Character size (FS Y)
6. Decorating for Kanji. (FS -, FS !, FS SI, FS DC2.)
7. Kanji Code
*Repeat steps 1 through 7, as necessary.
The steps 4 through 7 are Chinese model only.
E Bit image (ESC *, ESC K, ESC L, ESC Y and ESC Z)
Bar code (ESC i B)
2D bar code (ESC i Q, ESC i V and ESC i D)
Downloaded data (ESC i F)
With transferred data, the image data must first be transferred and saved on
the main unit.
14
Control command details
Character/style selection commands
ESC R Select international character set
[ASCII] ESC R n
[Decimal] 27 82 n
[Hexadecimal] 1B 52 n
[Parameters] 0≤n≤ 13, 64
[Description]
・ Selects the character set for the country, and switches some character codes in the code
table according to the value of n.
n=0: USA
n=1: France
n=2: Germany
n=3: UK
n=4: Denmark
n=5: Sweden
n=6: Italy
n=7: Spain
n=8: Japan
n=9: Norway
n=10: Denmark II
n=11: Spain II
n=12: Latin America
n=13: South Korea
n=64: Legal
・ The following 12 codes are changed.
23h, 24h, 40h, 5Bh, 5Ch, 5Dh,
5Eh, 60h, 7Bh, 7Ch, 7Dh, 7Eh
・The default setting is n=0
・When using the standard character code table, printing is performed according to the
specified international character set.
15
[Example]
Code
5Ch ESC R 08h 5Ch FF
Print result
\¥
16
ESC k Select font (Over sea model only)
[ASCII] ESC k n
[Decimal] 27 107 n
[Hexadecimal] 1B 6B n
[Parameters] 0≤n≤1
[Description]
・ Selects the font.
Bitmap fonts
n=0 Helsinki
n=1 Letter Gothic
・ The default value is n=0 (Helsinki).
ESC t Select character code table
[ASCII] ESC t n
[Decimal] 27 116 n
[Hexadecimal] 1B 74 n
[Parameters] n=0, 1, 2
[Description]
・From the three built-in character code tables, select the character code table to be used.
・n=0: Standard character code table
・n=1: Eastern European character code table
・n=2: Western European character code table
・n=3: (Spare)
・The default setting is n=0.
17
Text printing commands
ESC 4 Apply italic style
[ASCII] ESC 4
[Decimal] 27 52
[Hexadecimal] 1B 34
[Parameters] None
[Description]
・ Applies the italic style to the following text.
ESC 5 Cancel italic style
[ASCII] ESC 5
[Decimal] 27 53
[Hexadecimal] 1B 35
[Parameters] None
[Description]
・ Cancels the italic style.
[Example]
Code
ABC ESC 4 DEF ESC 5 GHI FF
Print result
ABCDEFGHI
ESC E Apply bold style
[ASCII] ESC E
[Decimal] 27 69
[Hexadecimal] 1B 45
[Parameters] None
[Description]
・ Prints the following text in bold.
18
ESC F Cancel bold style
[ASCII] ESC F
[Decimal] 27 70
[Hexadecimal] 1B 46
[Parameters] None
[Description]
・ Cancels the bold style.
[Example]
Code
ABC ESC E DEF ESC F GHI FF
Print result
ABCDEFGHI
ESC G Apply double-strike printing
[ASCII] ESC G
[Decimal] 27 71
[Hexadecimal] 1B 47
[Parameters] None
[Description]
・ Prints the following text in bold.
ESC H Cancel double-strike printing
[ASCII] ESC H
[Decimal] 27 72
[Hexadecimal] 1B 48
[Parameters] None
[Description]
・ Cancels the bold style.
[Example]
Code
ABC ESC E DEF ESC F GHI FF
Print result
ABCDEFGHI
19
ESC W Specify double-width characters
[ASCII] ESC W n
[Decimal] 27 87 n
[Hexadecimal] 1B 57 n
[Parameters] n=0 and 1 or 48 and 49
[Description]
・Specifies double-width characters.
・If n=1 or 49 (“1”), double-width characters are specified.
・If n=0 or 48 (“0”), double-width characters are cancelled.
[Example]
Code
ABC ESC W 1 ABC ESC W 0 ABC FF
Print result
ABC
SI Specify compressed characters
[ASCII] SI
[Decimal] 15
[Hexadecimal] 0F
[Parameters] None
[Description]
・ Prints the following text in half-width characters.
ESC SI Specify compressed characters
[ASCII] ESC SI
[Decimal] 27 15
[Hexadecimal] 1B 0F
ABC
ABC
[Parameters] None
[Description]
・ Same as SI
20
DC2 Cancel compressed characters
[ASCII] DC2
[Decimal] 18
[Hexadecimal] 12
[Parameters] None
[Description]
・ Cancels compressed characters specified with SI.
ESC - Apply/cancel underlining
[ASCII] ESC - n
[Decimal] 27 45 n
[Hexadecimal] 1B 2D n
[Parameters] n=0 and 1 or 48 and 49
[Description]
Applies or cancels underlining.
・If n=1, underlining is applied.
・If n=0, underlining is cancelled.
・The underlining specified by this code is a continuous line.
・Spaces between characters and words are also underlined.
[Example]
Code
ABC ESC - 1 ABC ESC - 0 ABC FF
Print result
ABCABC
ABC
21
ESC ! Global formatting
[ASCII] ESC ! n
[Decimal] 27 33 n
[Hexadecimal] 1B 21 n
[Parameters] 0≤n≤255
[Description]
・Specifies a combination of the various print modes.
・Specifies modes according to the bit value of n.
・A combination of multiple print modes can be specified at one time.
B i t76543210
1
0
Underline Italics Not used Bold Bold Not used Not used Not used
Cancel Cancel Not used Cancel Cancel Not used Not used Not used
[Example] To apply underlining and the italic style at one time
Code
ABC ESC ! C0h ABC ESC ! 00h ABC FF
Print result
ABC
ABC
ABC
22
ESC X Specify character size
[ASCII] ESC X n
[Decimal] 27 88 n
[Hexadecimal] 1B 58 n
[Parameters] 0≤n≤ 6 or 30h≤n≤36h
[Description]
・ Specifies the character size.
<Over Sea>
・ The character size can be set to AUTO or a fixed size (six sizes).
If n=0 (or 30h), the AUTO size is applied.
If n=1 (or 31h), the 4-point size is applied. (21 dots)
If n=2 (or 32h), the 6-point size is applied. (28 dots)
If n=3 (or 33h), the 9-point size is applied. (44 dots)
If n=4 (or 34h), the 12-point size is applied. (56 dots)
If n=5 (or 35h), the 18-point size is applied. (88 dots)
If n=6 (or 36h), the 24-point size is applied. (120 dots)
・ Same as FS Y
<China>
If n=0 (or 30h), the AUTO size is applied.
If n=1 (or 31h), the 5-point size is applied. (24 dots)
If n=2 (or 32h), the 6-point size is applied. (32 dots)
If n=3 (or 33h), the 10-point size is applied. (48 dots)
If n=4 (or 34h), the 13-point size is applied. (64 dots)
If n=5 (or 35h), the 19-point size is applied. (48 dots × 2)
If n=6 (or 36h), the 26-point size is applied. (64 dots× 2)
・ Same as FS Y
ESC i f Apply/cancel a frame (global)
[ASCII] ESC i f
[Decimal] 27 105 102
[Hexadecimal] 1B 69 66
[Parameters] 0≤n≤ 1 or 30h≤n≤31h
[Description]
23
・ Applies a frame around the entire text.
If n=0 (or 30h), the frame is cancelled.
If n=1 (or 31h), a frame is applied.
CAN Clear text
[ASCII] CAN
[Decimal] 24
[Hexadecimal] 18
[Parameters] None
[Description]
・ Clears all text, image data and bar codes that were received.
24
DEL Delete one character
[ASCII] DEL
[Decimal] 127
[Hexadecimal] 7F
[Parameters] None
[Description]
・The immediately preceding character within the same line is deleted.
・If the immediately preceding data is a bar code, the bar code is deleted.
・Image data is not deleted.
ESC CR Not available
[ASCII] ESC CR n
[Decimal] 27 13 n
[Hexadecimal] 1B 0D n
[Parameters] 0≤n≤255
[Description]
・ Does nothing.
25
Line feed commands
ESC 0 Specify line feed of 1/8 inch
[ASCII] ESC 0
[Decimal] 27 48
[Hexadecimal] 1B 30
[Parameters] None
[Description]
・ Specifies a line feed of 1/8 inch (approximately 0.32 cm).
ESC 2 Specify line feed of 1/6 inch
[ASCII] ESC 2
[Decimal] 27 50
[Hexadecimal] 1B 32
[Parameters] None
[Description]
・ Specifies a line feed of 1/6 inch (approximately 0.42 cm).
ESC 3 Specify line feed of n/180 inch
[ASCII] ESC 3 n
[Decimal] 27 51 n
[Hexadecimal] 1B 33 n
[Parameters] 0≤n≤255
[Description]
・Specifies a line feed of n/180 inch per text line.
・If n is less than 24, the line feed amount is set to 24/180 inch (approximately 0.34 cm).
26