Each owner whose software title is mentioned in this document has a Software License Agreement specific to
its proprietary programs.
Any trade names and product names of companies appearing on Brother products, related documents and
any other materials are all trademarks or registered trademarks of those respective companies.
IMPORTANT - PLEASE READ CAREFULLY
Note
This documentation (“Documentation”) provides information that will assist you in controlling your Printer
QL-XXX (where “XXX” is the model name).
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 Printer
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 redistribute it 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 Printer 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 OR 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.
ESC/P Command Reference
Contents
Introduction ··········································································································1
What is ESC/P? ····································································································2
1. Using ESC/P Commands·················································································3
2. Examples of Using ESC/P Commands ··························································5
Appendix A: Specifications············································································· 114
Appendix B: Character Code Tables······························································ 115
Character code tables................................................................................. 115
International character set table.................................................................. 116
Chinese character catalog (based on GB18030)........................................ 117
Appendix C: Introducing the Brother Developer Center······························ 149
- iii -
ESC/P Command Reference
Introduction
This material provides the necessary information for directly controlling QL-720NW.
This information is provided assuming that the user has full understanding of the operating system being used
and basic mastery of RS-232C or USB in a developer's environment.
We accept no responsibility for any problems caused by programs that you develop using the information
provided in this material, affecting software, data or hardware, including the QL-720NW, and any problems
resulting directly or indirectly from them. Use this material only if you accept these terms.
This material shall not be reproduced, in part or in full, without prior approval. In addition, this material shall
not be used as evidence in a lawsuit or dispute in a way that is unfavorable towards our company.
Read the model names that appear in the screens in this manual as the name of your printer.
These ESC/P commands have been adapted specifically for this company.
- 1 Introduction
ESC/P Command Reference
What is ESC/P?
ESC/P is one type of control codes used for printers. With the codes introduced in this document, various
labels can be created and printed. In this document, ESC/P codes are provided as both ASCII and binary
codes.
When sending codes to the printer, make sure that the binary codes are used, otherwise the printer cannot
parse the codes.
- 2 -
What is ESC/P?
1. Using ESC/P Commands
Below is a description of the flow for creating documents.
ESC/P Command Reference
Also refer to “2. Examples of Using ESC/P Commands
”.
(1) Start ESC/P
1. Switch the command mode.
2. Initialize
- Switch command mode (ESC i a)
- Initialize (ESC @)
(2) Format settings
1. Select the orientation. - Specify landscape orientation (ESC i L)
2. Specify the page size. - Specify page length (ESC ( C)
3. Specify print area. - Specify page format (ESC ( c)
- Specify left/right margins (ESC I, ESC Q)
4. Specify the line feed amount. - Specify line feed amount (ESC 0, ESC 2, ESC 3, ESC A)
1. Specify bit images. - (ESC *, ESC K, ESC L, ESC Y, ESC Z)
2. Specify barcodes. - (ESC i B)
3. Specify 2D barcodes. - (ESC i Q, ESC i V, ESC i D, ESC i M)
4. Print the downloaded data - (ESC i F)
Downloaded image data must first be downloaded and saved on
the printer.
- 4 -
1. Using ESC/P Commands
2. Examples of Using ESC/P Commands
This is the label that will be made.
ESC/P Command Reference
Step 1:
Landscape
4 inches
1 inch
Step 2:
Page length
Step 4:
Vertical position
0.5 inch
Step 3:
Horizontal position
Step 5:
Character size: 64 dots
In order to make this label, the following six steps are required after entering ESC/P mode.
Step 1: Select the landscape orientation.
Entered command
ESC i L 01h
n
- 5 -
2. Examples of Using ESC/P Commands
Step 2: Specify the page length.
4 inches=1200 dots
1200 dots–72 dots=1128 dots
Page length=mL+mH*256=1128
==
==
104
04h
68h
4
ESC/P Command Reference
4 inches
*The page length does not include the margins.
For the margins, subtract 6 mm (72 dots) from the page length.
Entered command
ESC ( C 02h 00h 68h 04h
nLnH mL
mH
Step 3: Specify the horizontal position.
0.5 inch=150 dots
Horizontal position=n1+n2*256=150
= =
150
96h
= =
0
00h
0.5 inch
Entered command
ESC $ 96h 00h
n1 n2
- 6 -
2. Examples of Using ESC/P Commands
Step 4: Specify the vertical position.
ESC/P Command Reference
1 inch
1 inch=300 dots
Vertical position=mL+mH*256+18 dots=300
==
26
1Ah
01h
==
1
Entered command
ESC ( V 02h 00h 1Ah 01h
nLnH mL mH
- 7 -
2. Examples of Using ESC/P Commands
Step 5: Specify the character size.
ESC/P Command Reference
Character size: 64 dots
Character size=nL+nH*256=64 dots
==
64
40h
00h
==
0
Entered command
ESC X 00h 40h 00h
m nL nH
- 8 -
2. Examples of Using ESC/P Commands
All commands together will make the example label shown below.
ESC/P Command Reference
ESC i a 00h
ESC @
ESC i L 01h
ESC ( C 02h 00h 68h 04h
Select ESC/P mode
Binary command: 1B 69 61 00
Initialize ESC/P mode
Binary command: 1B 40
5 steps explained above
ESC $ 96h 00h
ESC ( V 02h 00h 1Ah 01h
ESC X 00h 40h 00h
At your side
FF
However, these commands should be converted to binary data before sent to the printer, as shown below.
Here is the captured converted binary data.
Text to be print
Binary command: 41 74 20 79 6F 75
72 20 73 69 64 65
Print start command
Binary command: 0C
When the printer receives above binary commands, the label shown below is printed.
- 9 -
2. Examples of Using ESC/P Commands
ESC/P Command Reference
3. ESC/P Command Limitations
3.1 Print area
The printing media are die-cut labels and continuous length tape.
The area that can physically be printed on depends on the size and type of the print media.
Die-cut labels
Space left of
physically printable
area
Left margin
Right margin
Top margin
Unprintable area
Bottom margin
Space above
physically printable
area
Top margin position
(TOF position)
Physically printable
area
Unprintable area
- 10 -
3. ESC/P Command Limitations
The print area for each media is described below.
Print area
ESC/P Command Reference
(2) Label length
(1) Label width
printable area
(7) Height of
(3) Top margin
(9) Label
spacing
Thermal head
No.720
Printable area
(4) Bottom margin
(5) Left margin (6) Right margin (8) Length of printable area
No.001
The maximum length of continuous length label is 1 meter.
Head-
Standard Address 1 No 29mm 90.3mm1.5mm3mm 25.92mm 83.94mm 408 - 713
Sensor
No.
Applied
Forced
segmenting
(1) (2) (3) (4) (5) (6) (7) (8)
Drive
Head No.
Large Address 2 No 38mm 90.3mm1.5mm3mm 34.98mm 83.94mm 295 - 707
Small Address 3 No 62mm 28.93mm1.5mm3mm 58.95mm 22.95mm 012 - 707
Sipping 4 No 62mm 100.36mm1.5mm3mm 58.95mm 93.93mm 012 - 707
Multi purpose 5 No 17mm 54.32mm1.5mm3mm 13.98mm 47.94mm 555 - 719
*1 ANK(Alphabets and number) is available in the Chinese character mode but it is specified by different code
from ANK mode.
*2 GB18030 is available for the Chinese character mode.
3.2.1 Character sizes
ANK mode
Each font is available in full size, compressed size (half width), double width, double height and half width,
double height, and quadruple size.
Full size
Chinese character mode
Each font is available in full size, half width, double height, double width, double height and width,
superscript and subscript quarter square character. These sizes are able to be used together.moreover
verticall or horizontal writing can be chosen.
Double width
and half width
Double heightHalf widthDouble height
Double height
and width
If the half width and the quarter square character are used together, half width specification is ignored.
- 13 -
3. ESC/P Command Limitations
ESC/P Command Reference
Full size
A
Superscript
quarter square
quarter square
Example of a combination
1) When vertical writing
Full size
A
Subscript
Double width
Double width
Double heightHalf width
Double height
and width
Double heightHalf width
Double height
and width
A
A
Superscript
quarter square
Subscript
quarter square
2) When horizontal writing
Full size
A
A
Superscript
quarter square
Subscript
quarter square
Double width
and half width
Double width
and half width
Double heightHalf widthDouble height
Double height
and width
- 14 -
3. ESC/P Command Limitations
3.2.2 Character pitches
Pitch refers to the spacing between neighboring characters.
When characters are arranged with a fixed pitch, they will be evenly spaced.
If characters extend over several lines, they will align in straight rows.
ESC/P Command Reference
a
c
b
Fixed spacing
When characters are arranged with a proportional pitch, the spacing will vary depending on the character.
(For example, “W” is wide but “I” is narrow.)
As a result, the excess space between characters is eliminated and the text appears more compact.
W
Variable spacing
If a fixed pitch is applied to a font that is better with a proportional pitch, all characters are given the same
width as the widest character in the font.
W
I
C I
C
a
b
Fixed spacing
W
Variable spacing
I
W
c
C I
C
Variable spacing
W
Variable spacing
This makes it possible to evenly space the characters of a proportional-pitch font without having to change the
font.
If a proportional pitch is applied to a font that is better with a fixed pitch, all characters are given the same
width, appearing the same as with a fixed pitch.
C I
Fixed spacing
I
Fixed spacing
W
C
- 15 -
3. ESC/P Command Limitations
ESC/P Command Reference
A
A
A
A
A
A
A
3.3 Print position
The print position is the standard position for printing characters, bitmaps, and barcodes.
There is a horizontal print position and vertical print position, which are the reference points for vertical
position movement and horizontal position movement.
3.3.1 Characters
When horizontal writing
Characters are arranged with their top edges aligned with the print position.
The baseline of each character is the bottom edge of the character, regardless of size, font, etc.
All characters on a single line are printed with a baseline positions that is the same for each character.
If a single line consists of characters with different heights, the characters are aligned with the baseline of
the tallest character on the line.
Underlines are drawn 4 dots below the baseline position.
When vertical writing
Start position
A
A
Print position
Baseline position
Baseline position
When vertical writing, a center of a character is placed onto the middle of the height of a line.
When vertical writing, an underline starts from a print position and a character starts 4dots blow from the
underline.
Start position
A
- 16 -
Baseline position
3. ESC/P Command Limitations
ESC/P Command Reference
3.3.2 Bitmaps, barcodes and downloaded images
These types of image data are treated in the same way as characters and are printed with the bottom
edge of the image aligned with the baseline.
3.3.3 Same line
Characters and images are considered to be on the same line, even if they are separated by tabs.
Horizontal movement to the right between characters or images is regarded as being on the same line;
however, horizontal movement to the left is regarded as being on separate lines if wrapping occurs.
- 17 -
3. ESC/P Command Limitations
ESC/P Command Reference
3.4 Line feed amount
The amount of line feed is the amount of vertical movement from the print position of one line to the print
position of the next line.
HHHHHHHHHHHHH
HHHHHHHHHHHHH
HHHHHHHHHHHHH
The line feed amount is specified with ESC 0, ESC 2, ESC A, and ESC 3.
Within a single line of text, the tallest character is determined, and the baseline is moved so that the top
edge of that character is at the vertical print position.
The tallest character within a line becomes the line height.
Line feed amount
If characters are underlined, 4 dots are added to the line height.
The underline is placed underneath of the characters when horizontal writing and above of the characters
when vertical writing.
When underline for both horizontal and vertical characters are existing in the same line, 8 dots are added
for the heght of the line.
If the line height is greater than the specified line feed amount, the line height is used as the actual line
feed amount.
In this way, even if the specified line feed amount is small, the upper and lower lines will not overlap.
- 18 -
3. ESC/P Command Limitations
ESC/P Command Reference
4. Control Code List
Character/style selection commands (Refer to section 5.1 Character/style selection commands.)
ASCII Code Binary Code Description
ESC R 1B 52 Select international character set
ESC q 1B 71 Select character style
Text printing commands (Refer to section 5.2 Text printing commands
ASCII Code Binary Code Description
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 P 1B 50 Apply pica pitch (10 cpi)
ESC M 1B 4D Apply elite pitch (12 cpi)
ESC g 1B 67 Apply micron pitch
ESC p 1B 70 Specify proportional characters
ESC W 1B 57 Specify double-width characters
SO 0E Specify auto-canceling stretched characters
ESC SO 1B 0E Specify auto-canceling stretched characters
ASCII: ESC R n
Decimal: 27 82 n
Hexadecimal: 1B 52 n
Parameters
0≤n≤13, 64
ESC/P Command Reference
Description
Selects the character set, and switches some of the character codes in the code table according to the
value of n.
n=0: U.S.A.
n=1: France
n=2: Germany
n=3: U.K.
n=4: Denmark I
n=5: Sweden
n=6: Italy
n=7: Spain I
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