Brother QL-810W, QL-820NWB Software Developer's Manual ESC/P Command Reference

Software Developer's Manual
ESC/P Command Reference
QL-810W/820NWB
Version 1.00
The Brother logo is a registered trademark of Brother Industries, Ltd. Brother is a registered trademark of Brother Industries, Ltd. © 2018 Brother Industries, Ltd. All rights reserved.
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-8XX (where “8XX” 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
3. ESC/P Command Limitations ··························································· 10
3.1 Print area................................................................................................. 10
3.2 Characters .............................................................................................. 13
3.2.1 Character sizes......................................................................................... 13
3.2.2 Character pitches ..................................................................................... 15
3.3 Print position ........................................................................................... 16
3.3.1 Characters ................................................................................................ 16
3.3.2 Bitmaps, barcodes and downloaded images ............................................ 17
3.3.3 Same line ................................................................................................. 17
3.4 Line feed amount .................................................................................... 18
4. Control Code List ·········································································· 19
5. Control Command Details ······························································· 23
5.1 Character/style selection commands ...................................................... 23
ESC R Select international character set .................................................. 23
ESC q Select character style .................................................................... 24
ESC k Select font ...................................................................................... 25
5.2 Text printing commands .......................................................................... 26
ESC 4 Apply italic style ............................................................................. 26
ESC 5 Cancel italic style ........................................................................... 26
ESC E Apply bold style ............................................................................. 27
ESC F Cancel bold style ........................................................................... 27
ESC G Apply double-strike printing ........................................................... 28
ESC H Cancel double-strike printing ......................................................... 28
ESC P Apply pica pitch (10 cpi) ................................................................. 29
ESC M Apply elite pitch (12 cpi) ................................................................. 30
ESC g Apply micron pitch ......................................................................... 31
ESC p Specify proportional characters ..................................................... 32
ESC W Specify double-width characters .................................................... 32
SO Specify auto-canceling stretched characters ................................. 33
ESC SO Specify auto-canceling stretched characters ................................. 33
SI Specify compressed characters ..................................................... 34
ESC SI Specify compressed characters ..................................................... 34
DC2 Cancel compressed characters ..................................................... 35
DC4 Cancel auto-canceling double-width characters ............................ 35
ESC – Apply/cancel underlining ................................................................ 36
ESC ! Global formatting ........................................................................... 37
ESC SP Specify character spacing .............................................................. 38
ESC X Specify character size .................................................................... 39
5.3 Line feed commands ............................................................................... 40
ESC 0 Specify line feed of 1/8 inch ........................................................... 40
ESC 2 Specify line feed of 1/6 inch ........................................................... 40
ESC 3 Specify minimum line feed ............................................................. 41
ESC A Specify line feed of n/60 inch ......................................................... 41
5.4 Horizontal movement commands ........................................................... 42
ESC l Specify left margin ......................................................................... 42
ESC Q Specify right margin ....................................................................... 44
- i -
ESC/P Command Reference
CR Carriage return .............................................................................. 45
ESC D Specify horizontal tab position ....................................................... 46
HT Perform horizontal tab ................................................................... 47
ESC $ Specify absolute horizontal position ............................................... 48
ESC \ Specify relative horizontal position ................................................. 48
ESC a Specify alignment .......................................................................... 49
5.5 Vertical movement commands ................................................................ 50
LF Line feed ........................................................................................ 50
FF Page feed ...................................................................................... 50
ESC J Forward paper feed ....................................................................... 51
ESC B Specify vertical tab position ........................................................... 52
VT Perform vertical tab ........................................................................ 53
ESC (V Specify absolute vertical position ................................................... 54
ESC (v Specify relative vertical position ..................................................... 55
5.6 Paper formatting commands ................................................................... 56
ESC (c Specify page format ....................................................................... 56
ESC (C Specify page length ....................................................................... 57
ESC U Specify minimum margin................................................................ 58
5.7 Printer control commands ....................................................................... 59
ESC @ Initialize .......................................................................................... 59
5.8 Graphics commands ............................................................................... 60
ESC * Select bit image ............................................................................. 60
ESC K 8-dot single-density bit image ........................................................ 66
ESC L 8-dot double-density bit image ....................................................... 67
ESC Y 8-dot double-speed double-density bit image ................................ 68
ESC Z 8-dot quadruple-density bit image ................................................. 68
5.9 Chinese character commands ................................................................ 69
FS & Specify Chinese character mode ................................................... 69
FS . Cancel Chinese character mode ................................................... 69
FS J Specify vertical writing ................................................................... 70
FS K Specify horizontal writing ............................................................... 70
FS S Specify size of space for full size characters ................................. 71
FS T Specify size of space for half size characters ................................ 71
FS U Space adjustment between half size characters ............................ 72
FS V Cancel space adjustment between half size characters ................ 72
FS W Select double height and width characters .................................... 73
FS Y Specify Chinese character size ...................................................... 74
FS r Specify quarter square characters ................................................. 75
FS - Apply Chinese character underlining ............................................. 76
FS ! Global Formatting for Chinese character ....................................... 77
FS SI Specify half-width characters ......................................................... 77
FS DC2 Cancel half-width characters ......................................................... 78
FS SO Specify auto-canceling double-width character .............................. 78
FS DC4 Cancel auto-canceling double-width character .............................. 78
5.10 Advanced commands ............................................................................ 79
ESC i B Barcode ......................................................................................... 79
ESC i Q 2D barcode (QR Code) .................................................................. 83
ESC i P Specify QR Code version............................................................... 86
ESC i V 2D barcode (PDF417).................................................................... 87
ESC i D 2D barcode (DataMatrix) ............................................................... 90
ESC i M 2D barcode (MaxiCode) ................................................................. 93
ESC i J 2D barcode (Aztec) ........................................................................ 95
ESC i F Print downloaded data ................................................................... 97
ESC i a Switch command mode ............................................................... 101
ESC i S Status information request ........................................................... 102
- ii -
ESC/P Command Reference
ESC i L Specify landscape orientation ...................................................... 104
ESC i C Specify cutting ............................................................................. 105
ESC i W Specify character color ................................................................ 106
5.11 Advanced static commands ................................................................ 107
ESC iXQ2 Select default character style ....................................................... 107
ESC iXQ1 Retrieve default character style ................................................... 108
ESC iXX2 Specify default ANK character size .............................................. 109
ESC iXX1 Retrieve default ANK character size ............................................ 110
ESC iX32 Specify default line feed ............................................................... 11 0
ESC iX31 Retrieve default line feed ............................................................. 111
ESC iXA2 Select default alignment .............................................................. 111
ESC iXA1 Retrieve default alignment ........................................................... 112
ESC iX(2 Specify default page length .......................................................... 113
ESC iX(1 Retrieve default page length ........................................................ 113
ESC iXL2 Select default landscape orientation ............................................ 114
ESC iXL1 Retrieve default landscape orientation ......................................... 114
ESC iXj2 Select default international character set ..................................... 115
ESC iXj1 Retrieve default international character set ................................. 116
ESC iXU2 Specify default minimum margin .................................................. 11 7
ESC iXU1 Retrieve default minimum margin ................................................ 117
Appendix A: Specifications ······························································· 118 Appendix B: Character Code Tables ··················································· 119
Character code tables ................................................................................. 119
International character set table.................................................................. 120
Chinese character catalog (based on GB18030) ........................................ 121
Appendix C: Introducing the Brother Developer Center ························ 153
- iii -
ESC/P Command Reference

Introduction

This material provides the necessary information for directly controlling QL-8XX. This information is provided assuming that the user has full understanding of the operating system being used and basic mastery of communication interfaces in a developer's environment. Read the model names that appear in the screens in this manual as the name of your printer.
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-8XX, 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.
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) 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)
5. Specify tab positions.
- Specify horizontal tab position (ESC D)
- Specify vertical tab position (ESC B)
(3) Print operations
1. Specify the print position.
- Specify the vertical position (ESC ( v, ESC ( V, VT, ESC J)
- Specify the horizontal position (ESC $, ESC \, HT, ESC a)
2. Transfer the print data (one line).
- Transfer necessary text operation codes (see (4)), bit images, barcodes, and downloaded data (see (5))
3. End of the line.
- Feed the paper (CR, LF)
4. Repeat 1–3 above.
5. End of the page.
- Specify cutting (ESC i C)
- Feed the page (FF)
6. Repeat 1–5 above.
7. End of the document.

1. Using ESC/P Commands

Below is a description of the flow for creating documents. Also refer to “2. Examples of Using ESC/P Commands”.
ESC/P Command Reference
- 3 -
1. Using ESC/P Commands
ESC/P Command Reference
(4) Text operations
1. Specify the character set.
- Select font (ESC k)
- Specify the character spacing (ESC P, ESC M, ESC g, ESC SP)
2. Specify the character style.
- Specify character style
ESC SO, SI, ESC SI, DC2, DC4, ESC -, ESC !)
3. Specify character codes.
4. Specify the ANK mode/ Chinese character mode.
- (FS &, FS .)
5. Specify the character set for Chinese characters.
- Specify character size (FS Y)
- Specify the character spacing (FS S, FS T, FS U, FS V)
6. Specify the character style for Chinese characters.
- Specify character style (FS J, FS K, FS W, FS r, FS -, FS ! , FS SI, FS DC2, FS SO, FS DC4)
7. Specify character codes for
Chinese characters.
Repeat 1–7 above as necessary.
(5) Image data
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)
the printer.
- Select international character set (ESC R)
- Specify character size (ESC X)
(ESC 4, ESC 5, ESC E, ESC F, ESC G, ESC H, ESC W, SO,
Downloaded image data must first be downloaded and saved on
- 4 -
1. Using ESC/P Commands
4 inches
0.5 inch
1 inch
Step 1:
Landscape
Step 2:
Page length
Step 3:
Horizontal position
Step 4:
Vertical position
Step 6:
Character size: 67 dots
Step 5:
Font type: Helsinki
Entered command
ESC i L
01h
n

2. Examples of Using ESC/P Commands

This is the label that will be made.
ESC/P Command Reference
In order to make this label, the following six steps are required after entering ESC/P mode.
Step 1: Select the landscape orientation.
- 5 -
2. Examples of Using ESC/P Commands
4 inches
*The page length does not include the margins.
For the margins, subtract 6 mm (
72 dots) from the page length.
nL
nH
mL
mH
ESC ( C 02h 00h 68h 04h
Entered command
4 inches=1200 dots
1200 dots–72 dots=1128 dots
Page length=mL+mH*256=1128
4
04h
104
68h
0.5 inch
0.5
inch=150
dots
Horizontal position=n1+n2*256=150
ESC $ 96h 00h
n1
n2
Entered command
= =
150
96h
0
00h
= =
Step 2: Specify the page length.
ESC/P Command Reference
Step 3: Specify the horizontal position.
- 6 -
2. Examples of Using ESC/P Commands
1 inch
1 inch=300
dots
Vertical position=mL+mH*256+18 dots=300
26
1Ah
1
01h
ESC ( V 02h 00h 1Ah 01h
nL
nH mL
mH
Entered command
Entered command
ESC k 08h
n
n=08=08h
Font type: Helsinki
Outline Font
Step 4: Specify the vertical position.
ESC/P Command Reference
Step 5: Select the font type.
- 7 -
2. Examples of Using ESC/P Commands
Character size
=nL+nH*256=67 dots
Character size: 67 dots
ESC X 00h 43h 00h
m
nL
nH
Entered command
67
43h
0
00h
Step 6: Specify the character size.
ESC/P Command Reference
- 8 -
2. Examples of Using ESC/P Commands
ESC i a 00h ESC @ ESC i L 01h ESC ( C 02h 00h 68h 04h ESC $
96h 00h
ESC ( V 02h 00h 1A
h 01h ESC k 08h ESC X 00h 43h 00h At your side FF
Select ESC/P mode
Binary command: 1B 69 61 00
Initialize ESC/P mode
Binary
command: 1B 40
6 steps explained above
Print start command
Binary command: 0C
Text to be print
Binary command
: 41 74 20 79 6F 75
72 20 73 69 64 65
All commands together will make the example label shown below.
ESC/P Command Reference
However, these commands should be converted to binary data before sent to the printer, as shown below. Here is the captured converted binary data.
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
Unprintable area
Left margin
Right margin
Top margin
Top margin position (TOF position)
Bottom margin
Unprintable area
Space above physically printable area
Space left of
physically printable
area
Physically printable area

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
- 10 -
3. ESC/P Command Limitations
Printable area
(5) Left margin
(6) Right margin (8) Length of printable area
(4) Bottom margin
(3) Top margin
(2) Label length
(1) Label width
(7) Height of
printable area
No.001 No.720
(9) Label spacing
Thermal head
Sensor
segmenting
Standard Address
1
No
29mm
90.3mm
1.5mm
3mm
25.92mm
83.94mm
408 - 713
Large Address
2
No
38mm
90.3mm
1.5mm
3mm
34.98mm
83.94mm
295 - 707
Small Address
3
No
62mm
28.93mm
1.5mm
3mm
58.95mm
22.95mm
012 - 707
Sipping 4 No
62mm
100.36mm
1.5mm
3mm
58.95mm
93.93mm
012 - 707
Multi purpose
5
No
17mm
54.32mm
1.5mm
3mm
13.98mm
47.94mm
555 - 719
File Folder
6
No
17mm
87.13mm
1.5mm
3mm
13.98mm
80.97mm
555 - 719
CD/DVD (MKP)
7
Yes
58.29mm
58.29mm
3mm
3mm
52.34mm
52.34mm
051 - 668
29mmx42mm
29mmX52mm
(only for U.S.A)
(23mm)
39mmX48mm
(continued to the next page)
The print area for each media is described below.
Print area
The maximum length of continuous length label is 1 meter.
ESC/P Command Reference
Die Cut Labels
Die Cut Labels
Continuous Length Paper 62 Postage Print
Head-
Applied
No.
10 No 52mm 28.93mm 1.5mm 3mm 48.96mm 22.95mm 142 - 719
11 No 62mm - 1.5mm 3mm 58.95mm - 012 - 707
Forced
8 No 29mm 42.1mm 1.5mm 3mm 25.92mm 36mm 408 - 713
(1) (2) (3) (4) (5) (6) (7) (8)
Drive
Head No.
Square Paper
Die Cut Labels
12 No 23.0mm 23.03mm 1.5mm 3mm 19.99mm 17.11mm 443 - 678
13 No 39mm 47.98mm 1.5mm 3mm 36mm 41.93mm 289 - 713
- 11 -
3. ESC/P Command Limitations
ESC/P Command Reference
(continued from the previous page)
Sensor
segmenting
(only for U.S.A)
Round Paper
17
No
12.0mm
12.0mm
2mm
2mm
7.96mm
7.96mm
513 - 606
Round Paper
18
No
24.0mm
24.0mm
2mm
2mm
19.99mm
19.99mm
442 - 677
Paper (38mm)
Paper (29mm)
Paper (62mm)
Film-White (29mm)
Film-White (62mm)
Film-Yellow (62mm)
Film-Clear (62mm)
Paper (12mm)
Paper (50mm)
Paper (54mm)
(62mm)
(29mmX54mm)
Head-
No.
Applied
Forced
(1) (2) (3) (4) (5) (6) (7) (8)
Drive
Head No.
Postage Print
Continuous Length
Continuous Length
Continuous Length
Continuous Length
Continuous Length
Continuous Length
Continuous Length
14 No 32.9mm 47.62mm 1.5mm 3mm 29.9mm 41.59mm 325 - 677
19 No 38mm - 1.5mm 3mm 34.98mm - 295 - 707
20 No 29mm - 1.5mm 3mm 25.92mm - 408 - 713
21 No 62mm - 1.5mm 3mm 58.95mm - 012 - 707
22 Yes 29mm - 1.5mm 3mm 25.92mm - 408 - 713
23 Yes 62mm - 1.5mm 3mm 58.95mm - 012 - 707
24 Yes 62mm - 1.5mm 3mm 58.95mm - 012 - 707
25 Yes 62mm - 1.5mm 3mm 58.95mm - 012 - 707
Continuous Length
Continuous Length
Continuous Length Non-Adhesive
Continuous Length Paper Tape Red/Black on White
Removable Adhesive Small Labels
26 No 12mm - 1.5mm 3mm 8.98mm - 584 - 689
27 No 50 mm - 1.5mm 3mm 46.92mm - 154 - 707
28 Yes 54mm -
35 No 62mm 1.5mm 3mm 58.95mm 012-707
36 No 54mm 28.93mm 1.5mm 3mm 49.97mm 22.95mm 130 - 719
2.5mm/
1.5mm
3mm 49.97mm - 130 - 719
- 12 -
3. ESC/P Command Limitations
ESC/P Command Reference
Full size
Double width
Double height
Half width
Double height and
half
width
Double height
and
width

3.2 Characters

The character codes vary depending on ANK mode or Chinese character mode.
ANK mode 1Byte character codes are available.
1 bitmap font with 3 sizes: 16, 24, 32 dots 1 outline font with 22 sizes: 33, 38, 42, 46, 50, 58, 67, 75, 83, 92, 100, 117, 133, 150, 167, 200, 233, 267, 300, 333, 367, 400 dots
Chinese character mode * 2 or 4 Bytes character codes are available.
1 bitmap font with 3 sizes: 16, 24, 32 dots 1 outline font with 22 sizes: 33, 38, 42, 46, 50, 58, 67, 75, 83, 92, 100, 117, 133, 150, 167, 200, 233, 267, 300, 333, 367, 400 dots
*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.
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. If the half width and the quarter square character are used together, half width specification is ignored.
- 13 -
3. ESC/P Command Limitations
Full size
Double width
Double height
Half width
A
A
Double height
and width
Superscript
quarter square
Subscript
quarter square
Full size
Double width
Double height
Half width
Double width
and half width
Double height
and width
A
A
Superscript
quarter square
Subscript
quarter square
Full size
Double width
Double height
Half width
Double height and half width
Double height
and width
A
A
Superscript
quarter square
Subscript
quarter square
Example of a combination
ESC/P Command Reference
1) When vertical writing
2) When horizontal writing
- 14 -
3. ESC/P Command Limitations
ESC/P Command Reference
Fixed spacing
c
a
b
c b
a
Fixed spacing
W
Variable spacing
C
I
W
Variable spacing
C
I
W
Variable spacing
C
I
W
Fixed spacing
C
I
Variable spacing
W
Fixed spacing
C
I
W
C
I

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.
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.
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.
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.
- 15 -
3. ESC/P Command Limitations
ESC/P Command Reference
A
Print position
Baseline position
A
Start position
A
A
Baseline position
A
A
A
A
A
A
Baseline position Start position

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
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.
- 16 -
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
Line feed amount
HHHHHHHHHHHHH
HHHHHHHHHHHHH
HHHHHHHHHHHHH

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.
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. 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
ASCII Code
Binary Code
Description
ESC R
1B 52
Select international character set
ESC q
1B 71
Select character style
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
SI
0F
Specify compressed characters
ESC SI
1B 0F
Specify compressed characters
DC2
12
Cancel compressed characters
DC4
14
Cancel auto-canceling double-width characters
ESC -
1B 2D
Apply/cancel underlining
ESC !
1B 21
Global formatting
ESC SP
1B 20
Specify ANK character spacing
ESC X
1B 58
Specify ANK character size

4. Control Code List

Character/style selection commands (Refer to section 5.1 Character/style selection commands.)
Text printing commands (Refer to section 5.2 Text printing commands.)
- 19 -
4. Control Code List
ASCII Code
Binary Code
Description
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
ASCII Code
Binary Code
Description
ESC l
1B 6C
Specify left margin
ESC Q
1B 51
Specify right margin
CR
0D
Carriage return
ESC D
1B 44
Specify horizontal tab position
HT
09
Perform horizontal tab
ESC $
1B 24
Specify absolute horizontal position
ESC \
1B 5C
Specify relative horizontal position
ESC a
1B 61
Specify alignment
ASCII Code
Binary Code
Description
LF
0A
Line feed
FF
0C
Page feed
ESC J
1B 4A
Forward paper feed
ESC B
1B 42
Specify vertical tab position
VT
0B
Perform vertical tab
ESC ( V
1B 28 56
Specify absolute vertical position
ESC ( v
1B 28 76
Specify relative vertical position
ASCII Code
Binary Code
Description
ESC ( c
1B 28 63
Specify page format
ESC ( C
1B 28 43
Specify page length
ESC U
1B 55
Specify minimum margin
Line feed commands (Refer to section 5.3 Line feed commands.)
Horizontal movement commands (Refer to section 5.4 Horizontal movement commands.)
ESC/P Command Reference
Vertical movement commands (Refer to section 5.5 Vertical movement commands.)
Paper formatting commands (Refer to section 5.6 Paper formatting commands.)
- 20 -
4. Control Code List
ASCII Code
Binary Code
Description
ESC @
1B 40
Initialize (defaults)
ASCII Code
Binary Code
Description
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
ASCII Code
Binary Code
Description
FS &
1C 26
Specify Chinese character mode
FS .
1C 2E
Cancel Chinese character mode
FS J
1C 4A
Specify vertical writing
FS K
1C 4B
Specify horizontal writing
FS S
1C 53
Specify size of space for full size characters
FS T
1C 54
Specify size of space for half size characters
FS U
1C 55
Space adjustment between half size characters
Cancel space adjustment between half size characters
FS W
1C 57
Select double height and width characters
FS Y
1C 59
Specify Chinese character size
FS r
1C 72
Specify quarter square characters
FS -
1C 2D
Apply Chinese character underlining
FS !
1C 21
Global Formatting for Chinese character
FS SI
1C 0F
Specify half-width characters
FS DC2
1C 12
Cancel half-width characters
FS SO
1C 0E
Specify auto-canceling double-width character
FS DC4
1C 14
Cancel auto-canceling double-width character
Printer control commands (Refer to section 5.7 Printer control commands.)
Graphics commands (Refer to section 5.8 Graphics commands.)
Chinese character Commands (Refer to section 5.9 Chinese character commands.)
ESC/P Command Reference
FS V 1C 56
- 21 -
4. Control Code List
ASCII Code
Binary Code
Description
ESC i B
1B 69 42
Barcode
ESC i Q
1B 69 51
2D barcode (QR Code)
ESC i P
1B 69 50
Specify QR Code version
ESC i V
1B 69 56
2D barcode (PDF417)
ESC i D
1B 69 44
2D barcode (DataMatrix)
ESC i M
1B 69 4D
2D barcode (MaxiCode)
ESC i J
1B 69 4A
2D barcode (Aztec)
ESC i F
1B 69 46
Print downloaded data
ESC i a
1B 69 61
Switch command mode
ESC i S
1B 69 53
Status information request
ESC i L
1B 69 4C
Specify landscape orientation
ESC i C
1B 69 43
Specify cutting
ESC i W
1B 69 57
Specify character color
ASCII Code
Binary Code
Description
ESC iXQ2
1B 69 58 51 32
Select default character style
ESC iXQ1
1B 69 58 51 31
Retrieve default character style
ESC iXX2
1B 69 58 58 32
Specify default ANK character size
ESC iXX1
1B 69 58 58 31
Retrieve default ANK character size
ESC iX32
1B 69 58 33 32
Specify default line feed
ESC iX31
1B 69 58 33 31
Retrieve default line feed
ESC iXA2
1B 69 58 41 32
Select default alignment
ESC iXA1
1B 69 58 41 31
Retrieve default alignment
ESC iX(2
1B 69 58 28 32
Specify default page length
ESC iX(1
1B 69 58 28 31
Retrieve default page length
ESC iXL2
1B 69 58 4C 32
Select default landscape orientation
ESC iXL1
1B 69 58 4C 31
Retrieve default landscape orientation
ESC iXj2
1B 69 58 6A 32
Select default international character set
ESC iXj1
1B 69 58 6A 31
Retrieve default international character set
ESC iXU2
1B 69 58 55 32
Specify default minimum margin
ESC iXU1
1B 69 58 55 31
Retrieve default minimum margin
Advanced commands (Refer to section 5.10 Advanced commands.)
ESC/P Command Reference
Advanced static commands (Refer to section 5.11 Advanced static commands.)
- 22 -
4. Control Code List
ESC/P Command Reference
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

5. Control Command Details

5.1 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, and switches some of the character codes in the code table according to the
value of n.
The following 12 codes are switched.
The default setting is n=0 (U.S.A.)
Example
23h, 24h, 40h, 5Bh, 5Ch, 5Dh, 5Eh, 60h, 7Bh, 7Ch, 7Dh, 7Eh
Code: 5Ch ESC R 08h 5Ch FF
Print result: \
- 23 -
5. Control Command Details
n=0:
None (normal characters)
n=1:
Outline
n=2:
Shadow
n=3:
Shadow and outline

ESC q Select character style

ASCII: ESC q n Decimal: 27 113 n Hexadecimal: 1B 71 n
Parameters
0≤n≤3
Description Selects the character style.
ESC/P Command Reference
Example
Code: ABC ESC q 03h ABC ESC q 00h ABC FF Print result: ABCAAABBBCCCABC
- 24 -
5. Control Command Details
Loading...
+ 130 hidden pages