ESC/ P Command Reference
Table Of Contents
- ESC/P Command Reference
- IMPORTANT - PLEASE READ CAREFULLY
- Contents
- Introduction
- What is ESC/P?
- 1. Using ESC/P Commands
- 2. Examples of Using ESC/P Commands
- 3. ESC/P Command Limitations
- 4. Control Code List
- 5. Control Command Details
- 5.1 Character/style selection commands
- 5.2 Text printing commands
- ESC 4 Apply italic style
- ESC 5 Cancel italic style
- ESC E Apply bold style
- ESC F Cancel bold style
- ESC G Apply double-strike printing
- ESC H Cancel double-strike printing
- ESC P Apply pica pitch (10 cpi)
- ESC M Apply elite pitch (12 cpi)
- ESC g Apply micron pitch (15 cpi)
- ESC p Specify proportional characters
- ESC W Specify double-width characters
- SO Specify auto-canceling stretched characters
- ESC SO Specify auto-canceling stretched characters
- SI Specify compressed characters
- ESC SI Specify compressed characters
- DC2 Cancel compressed characters
- DC4 Cancel auto-canceling double-width characters
- ESC – Apply/cancel underlining
- ESC ! Global formatting
- ESC SP Specify character spacing
- ESC X Specify character size
- 5.3 Line feed commands
- 5.4 Horizontal movement commands
- 5.5 Vertical movement commands
- 5.6 Paper formatting commands
- 5.7 Printer control commands
- 5.8 Graphics commands
- 5.9 Advanced commands
- ESC i B Barcode
- ESC i Q 2D barcode (QR Code)
- ESC i P QR Code version
- ESC i V 2D barcode (PDF417)
- ESC i D 2D barcode (DataMatrix)
- ESC i M 2D barcode (MaxiCode)
- ESC i J 2D barcode (Aztec)
- ESC i G Specify font
- ESC i F P Print downloaded data
- ESC i a Switch command mode
- ESC i S Status information request
- ESC i L Specify landscape orientation
- ESC i C Specify cutting
- ESC i H Specify recovery setting
- 5.10 Advanced static commands
- ESC iXQ2 Select default character style
- ESC iXQ1 Retrieve default character style
- ESC iXk2 Select default font
- ESC iXk1 Retrieve default font
- ESC iXX2 Specify default character size
- ESC iXX1 Retrieve default character size
- ESC iX32 Specify default line feed
- ESC iX31 Retrieve default line feed
- ESC iXA2 Select default alignment
- ESC iXA1 Retrieve default alignment
- ESC iX(2 Specify default page length
- ESC iX(1 Retrieve default page length
- ESC iXL2 Select default landscape orientation
- ESC iXL1 Retrieve default landscape orientation
- ESC iXj2 Select default international character set
- ESC iXj1 Retrieve default international character set
- ESC iXm2 Select default character code set
- ESC iXm1 Retrieve default character code set
- ESC iXd2 Specify recovery setting
- ESC iXd1 Retrieve recovery setting
- ESC iXv2 (0Ch) Specify recovery count
- ESC iXv1 (0Ch) Retrieve recovery count
- ESC iXE2 Specify barcode margin setting
- ESC iXE1 Retrieve barcode margin setting
- ESC iX_2 (00h) Specify line print setting
- ESC iX_1 (00h) Retrieve line print setting
- ESC iX_2 (01h) Specify line print timeout setting
- ESC iX_1 (01h) Retrieve line print timeout setting
- ESC i DC1 SQ(01h) Specify self-printing QR code content
- ESC i DC1 SQ(00h) Retrieve self-printing QR code content
- ESC i DC1 SR(01h) Select setting change lock
- ESC i DC1 SR(00h) Retrieve setting change lock
- Appendix A: Supported Printers
- Appendix B: Specifications
- Appendix C: Character Code Tables
- Appendix D: Introducing the Brother Developer Center
- brother US ENG
ESC/P Command Reference
- 79 -
5. Control Command Details
(*1) With Micro QR, the Structured Append setting is invalid, and the default setting is used.
(*2) With Micro QR, error correction level 4 is invalid, and the default setting is used.
(*3) Some barcode readers cannot recognize a barcode with the cell size specified as 1 dot or 2 dots.
What is the QR Code Structured Append setting?
QR Codes have Structured Append settings.
A long character string can be partitioned into 2 to 16 partitions and printed.
With ESC/P commands, it is necessary to enter only the number of partitions.
For example, if the print data is partitioned into 3 partitions, the barcode data is as follows:
ESC i Q or q [1st parameter] [1st set of barcode data] \\\
ESC i Q or q [2nd parameter] [2nd set of barcode data] \\\
ESC i Q or q [3rd parameter] [3rd set of barcode data] \\\
Refer to the following for specifying settings for 3 through 6 in [Parameters].
3. Structured append
setting:
This determines whether or not the barcode data is partitioned. If the data is
not partitioned, enter 0.
When not partitioning, the values of 4 (code number), 5 (number of
partitions), and 6 (parity data) are ignored; therefore, enter 0 as a dummy
value for these parameters.
4. Code number:
This indicates which number the ESC/P command for that QR Code is.
For example, if it is for the second of four partitions, this is 2; for the fourth
this is 4.
5. Number of partitions:
This is the number of partitions.
6. Parity data:
This is the value (in bytes) of exclusively OR’ing all the print data (print data
before partition). Entering the same value as for the partitioned QR Code
ESC/P command indicates that these codes are linked.
What is exclusive OR’ing in bytes?
The data is exclusively OR’ed (XOR’ed) in bytes and in order.
For example, putting a character string into hexadecimal gives 31h, 32h, 33h, 34h.
Character
OR’ed (XOR’ed) in bytes
Results
XOR of 31h and 32h
0011 0001 ^= 0011 0010
0000 0011 (03h)
XOR of 03h and 33h
0000 0011 ^= 0011 0011
0011 0000 (30h)
XOR of 30h and 34h 0011 0000 ^= 0011 0100
0000 0100 (04h)
Therefore, the parity is 04h.
Note
If this parity value is incorrect, the correct QR Code is not generated.