Software Developer's Manual ESC/P Legacy Command Reference PJ-822/823/862/863/883 Version 1.
The Brother logo is a registered trademark of Brother Industries, Ltd. Brother is a registered trademark of Brother Industries, Ltd. © 2021 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.
IMPORTANT - PLEASE READ CAREFULLY Note This documentation (“Documentation”) provides information that will assist you in controlling your Printer PJ-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”).
ESC/P Legacy Command Reference Contents Introduction ······················································································· 3 What is ESC/P? ··················································································· 4 1. Using ESC/P Legacy Commands ······················································· 5 2. Examples of Using ESC/P Legacy Commands ····································· 7 3. ESC/P Legacy Command Limitations················································ 11 3.
ESC/P Legacy Command Reference ESC W ESC w ESC E ESC F ESC G ESC H ESC – ESC SP ESC q ESC 4 ESC 5 ESC ! Specify/cancel double-width characters ......................................... 36 Specify/cancel double-height characters ....................................... 36 Apply bold style ............................................................................. 37 Cancel bold style ........................................................................... 37 Apply double-strike printing ...............
ESC/P Legacy Command Reference Introduction This material provides the necessary information for directly controlling PJ-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.
ESC/P Legacy 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 documents 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.
ESC/P Legacy Command Reference 1. Using ESC/P Legacy Commands Below is a description of the flow for creating documents. Also refer to “2. Examples of Using ESC/P Legacy Commands”. (1) Start ESC/P 1. Switch the command mode. 2. Initialize - Switch command mode (ESC i a 0) Note: ESC/P Legacy mode - Initialize (ESC @) (2) Format settings 2. Specify print area. - Specify left/right margins (ESC I, ESC Q) 3. Specify the line feed amount. - Specify line feed amount (ESC 0, ESC 2, ESC 3, ESC A) 4.
ESC/P Legacy Command Reference (4) Text operations 1. Specify the character set. - Select font (ESC k) - Select character code (ESC t) - Select international character set (ESC R) - Specify the character spacing (ESC P, ESC M, ESC SP) 2. Specify the character style. - Specify character style (ESC 4, ESC 5, ESC E, ESC F, ESC G, ESC H, ESC W, SO, ESC SO, SI, ESC SI, DC2, DC4, ESC -, ESC !) 3. Specify character codes. Repeat 1–3 above as necessary. (5) Bit images 1. Specify bit images.
ESC/P Legacy Command Reference 2. Examples of Using ESC/P Legacy Commands Set Basic setup first. Basic set up : Specify ESC/P Legacy command mode Entered Command ESC i a 00h -7- 2.
ESC/P Legacy Command Reference This is the document that will be made. 1 inch Step 2: Step 1: Font type: Serif Horizontal position In order to make this document, the following two steps are required. Step 1: Specify the horizontal position. 1 inch Entered command ESC $ n m 3Ch 00h 60 = = = = Horizontal position=n+m*256=60 0 3Ch 00h -8- 2.
ESC/P Legacy Command Reference Step 2: Select the font type. Font type: Serif Entered command n ESC k 00h -9- 2.
ESC/P Legacy Command Reference All commands together will make the example document shown below. Select ESC/P Legacy mode Binary command: 1B 69 61 00 ESC i a 00h ESC @ Initialize ESC/P mode ESC $ 3Ch 00h Binary command: 1B 40 ESC k 00h 2 steps explained above At your side FF Text to be print Binary command: 41 74 20 79 6F 75 72 20 73 69 64 65 Print start command Binary command: 0C However, these commands should be converted to binary data before sent to the printer, as shown below.
ESC/P Legacy Command Reference 3. ESC/P Legacy Command Limitations 3.1 Print area [Paper types and sizes] ・ Thermal cut paper: A4/Letter/Legal sizes and any size ・ Thermal roll paper: 210 mm (width) * Any size is within a range of 210- to 216-mm wide and 25.4- to 567.3-mm long. [Print area] The printable area differs depending on the paper type; however, with any paper listed above, the top margin, left margin and page width of the print area are the same as with A4 paper.
ESC/P Legacy Command Reference 300 dpi (300 × 300) print area (dots) A4 Letter Legal Any Paper width 2480 2550 2550 2480 ~ 2550 Paper length 3507 3300 4200 300 ~ 6700 Top margin 30 30 30 30 Bottom margin 3330 3230 4130 230 ~ 6630 Left margin 40 43 43 43 Right margin 2440 2507 2507 2507 Page width 2400 2464 2464 2464 Page length 3300 3200 4100 200 ~ 6600 203 dpi (203 × 200) print area (dots) A4 Letter Legal Any Paper width 1680 1727 1727 1680 ~ 1727 Paper
ESC/P Legacy Command Reference 3.2 Characters [Font specifications] Type ANK characters Font Serif, Sans Serif Size 10, 12, 15 CPI Proportional The conversions from CPI (characters per inch) to dots are shown below. 300 dpi (300 × 300) 203 dpi (203 × 200) 10 CPI 30 × 45 dots 20 × 45 dots 12 CPI 25 × 45 dots 17 × 45 dots 15 CPI 20 × 45 dots 14 × 45 dots 3.3 Resolution [Resolution conversion] With ESC/P Legacy, the basic resolution is 360 dpi.
ESC/P Legacy Command Reference 4. Control Code List Paper feed commands (Refer to section 5.1 Paper feed commands.
ESC/P Legacy Command Reference Character selection commands (Refer to section 5.5 Character selection commands.
ESC/P Legacy Command Reference Character definition commands (Refer to section 5.7 Character definition commands.) ASCII Code Binary Code Function ESC & 0 1Bh 26h 00h Define download characters ESC % 1Bh 25h Apply/cancel download character set ESC : 0 1Bh 3Ah 00h Copy character set ESC 6 1Bh 36h Cancel upper control codes ESC 7 1Bh 37h Apply upper control codes Supplemental function commands (Refer to section 5.8 Supplemental function commands.
ESC/P Legacy Command Reference 5. Control Command Details 5.1 Paper feed commands CR Carriage return ASCII: CR Decimal: 13 Hexadecimal: 0D Function Returns the cursor position to the left edge. Details If automatic line feed has been specified with the utility, a line feed command (LF) is performed after a carriage return command (CR) is performed. FF Form feed ASCII: FF Decimal: 12 Hexadecimal: 0C Function Feeds the paper to the next page separation.
ESC/P Legacy Command Reference LF Line feed ASCII: LF Decimal: 10 Hexadecimal: 0A Function Feeds the paper by one line, according to the specified line feed amount. Details At this time, the SO and ESC SO commands are cancelled. ESC 0 Specify line feed of 1/8 inch ASCII: ESC 0 Decimal: 27 48 Hexadecimal: 1B 30 Function Specifies a line feed of 1/8 inch (about 0.32 cm). - 18 - 5.
ESC/P Legacy Command Reference ESC 2 Specify line feed of 1/6 inch ASCII: ESC 2 Decimal: 27 50 Hexadecimal: 1B 32 Function Specifies a line feed of 1/6 inch (about 0.42 cm). Details The default line feed setting is 1/6 inch. ESC 3 Specify line feed of n/180 inch ASCII: ESC 3 n Decimal: 27 51 n Hexadecimal: 1B 33 n Function Specifies a line feed of n/180 inch. - 19 - 5.
ESC/P Legacy Command Reference ESC A Specify line feed of n/60 inch ASCII: ESC A n Decimal: 27 65 n Hexadecimal: 1B 41 n Function Specifies a line feed of n/60 inch. Details The allowable setting range is 0≤n≤85 (55h). ESC + Specify line feed of n/360 inch ASCII: ESC + n Decimal: 27 43 n Hexadecimal: 1B 2B n Function Specifies a line feed of n/360 inch..
ESC/P Legacy Command Reference 5.2 Print area setting commands ESC C Specify page length in lines ASCII: ESC C n Decimal: 27 67 n Hexadecimal: 1B 43 n Function Specifies the page length as ((line feed amount when this command is specified) * (n in lines)) inches. Details Settings that exceed 22 inches or are less than the sum of the top space (top margin) and bottom space (page length – bottom margin) are ignored.In addition, skip perforation is cancelled.The default value is 66 lines.
ESC/P Legacy Command Reference ESC N Specify skip perforation ASCII: ESC N n Decimal: 27 78 n Hexadecimal: 1B 4E n Function 1≤n≤255 Details Values that exceed the page length are ignored.The print area is the area remaining when the skip amount is subtracted from the specified page length. Cancelled with the ESC O, ESC C or ESC C 0 command. ESC O Cancel skip perforation ASCII: ESC O Decimal: 27 79 Hexadecimal: 1B 4F Function Sets the skip amount to 0. (Cancels skip perforation.
ESC/P Legacy Command Reference 5.3 Tab setting commands ESC B Specify vertical tab position ASCII: ESC B n n... NUL Decimal: 27 66 n n... 0 Hexadecimal: 1B 42 n n... 00 Function Specifies a vertical tab position. Details Specifies a vertical tab at the position where (line feed amount when this command is specified) * (specified number of lines n). A maximum of 16 tab positions can be specified. A tab setting that specifies a position extending past the bottom margin is ignored.
ESC/P Legacy Command Reference ESC D Specify horizontal tab position ASCII: ESC D n n... NUL Decimal: 27 68 n n... 0 Hexadecimal: 1B 44 n n... 00 Function Specifies a horizontal tab position. Details Specifies a horizontal tab at the position where (character width when the tab is performed) * (specified number of columns) + (left margin position). Ignored if (character width when this command is specified) * (n columns) + (left margin) extends past the right margin position.
ESC/P Legacy Command Reference 5.4 Print position setting commands ESC l Specify left margin ASCII: ESC l n Decimal: 27 108 n 6C n Hexadecimal: 1B Function Specifies the left margin position as the position from the left edge where (character width when this command is specified) * n, and specifies the area to the left of this as an unprinted area. Details A setting that causes the left margin to be to the right of the right margin is ignored.
ESC/P Legacy Command Reference ESC Q Specify right margin ASCII: ESC Q n Decimal: 27 81 n Hexadecimal: 1B 51 n Function Specifies the right margin position as the position where (character width when this command is specified) * n. Details A setting that causes the right margin to be to the left of the left margin is ignored. Clears the line buffer, and moves the cursor to the left margin position.
ESC/P Legacy Command Reference BS Backspace ASCII: BS Decimal: 8 Hexadecimal: 08 Function Moves the current position in the line buffer back one character. Details Two or more BS are ignored. ESC $ Specify absolute position ASCII: ESC $ n m Decimal: 27 36 n m Hexadecimal: 1B 24 n m Function Moves the cursor position to the position (n + m * 256) / 60 inch from the left margin.
ESC/P Legacy Command Reference ESC \ Specify relative position ASCII: ESC \ n m Decimal: 27 92 n m Hexadecimal: 1B 5C n m Function Moves the cursor position (n + m * 256) dots to the right or left of the next print position. Details Ignored if the position after being moved extends past the left or right margin position. The movement amount is the number of dots specified as a 2’s complement. This is not underlined.
ESC/P Legacy Command Reference 5.5 Character selection commands ESC k Select font ASCII: ESC k n Decimal: 27 107 n 6B n Hexadecimal: 1B Function Switches the half-width alphanumeric font that is used between “Serif” and “Sans Serif”. Details n = 30h, 00h: Serif n = 31h, 01h: Sans Serif ESC P Specify 10 cpi ASCII: ESC P Decimal: 27 80 Hexadecimal: 1B 50 Function Uses the character set at 10 cpi.
ESC/P Legacy Command Reference ESC g Specify 15 cpi ASCII: ESC g Decimal: 27 103 Hexadecimal: 1B 67 Function Uses the character set at 15 cpi. Details The “specify reduced characters” is cancelled ESC p Apply/cancel proportional characters ASCII: ESC p n Decimal: 27 112 n 70 n Hexadecimal: 1B Function Applies or cancels proportional characters for alphanumeric characters.
ESC/P Legacy Command Reference ESC S Apply superscript/subscript ASCII: ESC S n Decimal: 27 83 n Hexadecimal: 1B 53 n Function Applies superscript/subscript attributes to alphanumeric characters. Details n = 00h or 30h: Apply superscript attribute The script character is printed raised. n = 01h or 31h: Apply subscript attribute The script character is printed lowered. The character limitations are as described in the manual.
ESC/P Legacy Command Reference ESC t Select character code table ASCII: ESC t n Decimal: 27 116 n 74 n Hexadecimal: 1B Function Selects the character table for character codes 128 through 255. Details n = 00h: Select italic characters n = 01h: Select advanced graphics (default) * Precautions Graphics characters (B0h through DFh and F0h through FEh of the advanced graphics code table) are printed as normal characters. - 32 - 5.
ESC/P Legacy Command Reference ESC R Select international character set ASCII: ESC R n Decimal: 27 82 n Hexadecimal: 1B 52 n Function Changes a part of the alphanumeric character code table according to the value of n. Details 00h USA 01h France 02h Germany 03h UK 04h Denmark 05h Sweden 06h Italy 07h Spain 08h Japan 09h Norway 0Ah Denmark II 0Bh Spain II 0Ch Latin America 0Dh Korea 40h Legal - 33 - 5.
ESC/P Legacy Command Reference 5.6 Character style commands ESC x Select text quality ASCII: ESC x n Decimal: 27 120 n 78 n Hexadecimal: 1B Function Selects draft or high quality for alphanumeric characters. Details n = 00h or 30h: Draft mode (1/120" movement amount) n = 01h or 31h: Letter mode (1/180" movement amount) Since this printer is not installed with a draft font, the text quality does not change.
ESC/P Legacy Command Reference DC2 Cancel reduced characters ASCII: DC2 Decimal: 18 Hexadecimal: 12 Function Cancels reduced characters specified with the SI or ESC SI command. SO, ESC SO Specify auto-canceling double-width characters ASCII: ESC SO Decimal: 27 14 Hexadecimal: 1B 0E Function Specifies auto-cancelling double-width enlargement for alphanumeric characters. Details Cancelled with the DC4, CR, LF, FF, VT or ESC W 0 command.
ESC/P Legacy Command Reference ESC W Specify/cancel double-width characters ASCII: ESC W n Decimal: 27 87 n Hexadecimal: 1B 57 n Function Specifies or cancels double-width enlargement for alphanumeric characters.
ESC/P Legacy Command Reference ESC E Apply bold style ASCII: ESC E Decimal: 27 69 Hexadecimal: 1B 45 Function Applies the bold style to alphanumeric characters. Details Characters are shifted 1 bit to the right and OR’ed. ESC F Cancel bold style ASCII: ESC F Decimal: 27 70 Hexadecimal: 1B 46 Function Cancels the bold style. - 37 - 5.
ESC/P Legacy Command Reference ESC G Apply double-strike printing ASCII: ESC G Decimal: 27 71 Hexadecimal: 1B 47 Function Applies double-strike printing to alphanumeric characters. ESC H Cancel double-strike printing ASCII: ESC H Decimal: 27 72 Hexadecimal: 1B 48 Function Cancels double-strike printing of alphanumeric characters. - 38 - 5.
ESC/P Legacy Command Reference ESC – Apply/cancel underlining ASCII: ESC - n Decimal: 27 45 n Hexadecimal: 1B 2D n Function Specifies or cancels underlining of alphanumeric characters. Details n = 00h or 30h: Cancel underlining n = 01h or 31h: Apply underlining Underline position: No character limitations (45th line) No underlining when the print position is moved with ESC $, ESC \ or HT ESC SP Specify character spacing ASCII: ESC SP n Decimal: 27 32 n Hexadecimal: 1B 20 n Functi
ESC/P Legacy Command Reference ESC q Select character style ASCII: ESC q n Decimal: 27 113 n 71 n Hexadecimal: 1B Function Selects the character style for alphanumeric characters. Details n = 00h: Normal characters (default) n = 01h: Outline n = 02h: Shadow n = 03h: Shadow and outline No character limitations ESC 4 Apply italic ASCII: ESC 4 Decimal: 27 52 Hexadecimal: 1B 34 Function Applies italics to alphanumeric characters.
ESC/P Legacy Command Reference ESC ! Global formatting ASCII: ESC ! n Decimal: 27 33 n Hexadecimal: 1B 21 n Function Specifies the print mode for alphanumeric characters. Details The individual settings are specified according to the description for each command. With the n values listed below for each of the commands, the added values only for global formatting are specified.
ESC/P Legacy Command Reference 5.7 Character definition commands ESC & 0 Define download characters ASCII: ESC & 0 n n... Decimal: 27 38 0 n n... Hexadecimal: 1B 26 00 n n... Function Defines characters that are the same as alphanumeric characters as a download character set. Details Converts the resolution of the character line buffer from 180 dpi to 300 dpi or 203 dpi when characters are defined as 32 dots wide at 300 dpi (21 dots at 203 dpi).
ESC/P Legacy Command Reference ESC : 0 Copy character set ASCII: ESC : 0 n 0 Decimal: 27 58 0 n 0 Hexadecimal: 1B 3A 00 n 00 Function Copies the font from the Flash memory area to the DRAM area. ESC 6 Cancel upper control codes ASCII: ESC 6 Decimal: 27 54 Hexadecimal: 1B 36 Function Cancels control codes 128 (80h) through 159 (9F). Details 128 (80h) through 159 (9F) function as character codes cannot be used as control codes.
ESC/P Legacy Command Reference 5.8 Supplemental function commands ESC @ Initialize ASCII: ESC @ Decimal: 27 64 Hexadecimal: 1B 40 Function Initialize printer Details The settings that are stored depend on the setting. Other items are as listed below. Beginning of paper: The current paper position is considered as the beginning.
ESC/P Legacy Command Reference 5.9 Others ESC K 8-bit single-density bit image ASCII: ESC K n m ... Decimal: 27 75 n m... Hexadecimal: 1B 4B n m... Function With the initial settings, same as ESC * 0. Details 60 dpi bit image data, n = LSB, m = MSB ESC L 8-bit double-density bit image ASCII: ESC L n m ... Decimal: 27 76 n m ... Hexadecimal: 1B 4C n m ... Function With the initial settings, same as ESC * 1.
ESC/P Legacy Command Reference ESC Y 8-bit double-speed double-density bit image ASCII: ESC Y n m ... Decimal: 27 89 n m... Hexadecimal: 1B 59 n m... Function With the initial settings, same as ESC * 2. Details 120 dpi bit image data, n = LSB, m = MSB The details are as described in the Epson manual. - 46 - 5.
ESC/P Legacy Command Reference ESC Z 8-bit quadruple-density bit image ASCII: ESC Z n m ... Decimal: 27 90 n m ... Hexadecimal: 1B 5A n m ... Details 240 dpi bit image data, n = LSB, m = MSB The details are as described in the Epson manual. ESC * Select bit image ASCII: ESC * m n1 n2... Decimal: 27 42 m n1 n2... Hexadecimal: 1B 2A m n1 n2... Function With the initial settings, same as ESC * 3.
ESC/P Legacy Command Reference ESC ? Convert bit image ASCII: ESC ? m n Decimal: 27 63 m n Hexadecimal: 1B 3F m n Function Converts the bit images of ESC K, ESC L, ESC Y and ESC Z to the bit image of parameter n in ESC *. Details m refers to the bit image to be converted. n refers to the bit image to be converted into (m of ESC *). ESC / Select VFU channel ASCII: ESC / m Decimal: 27 47 m Hexadecimal: 1B 2F m Function Selects the VFU channel.
ESC/P Legacy Command Reference ESC b Specify VFU tab position ASCII: ESC b m n...0 Decimal: 27 98 m n...0 Hexadecimal: 1B 62 m n...00 Function Specifies a vertical tab position at VFU channel m. Details Specifies a vertical tab at the position where (line feed amount when this command is specified) * (specified number of lines n). A tab setting that specifies a position extending past the page length is ignored. - 49 - 5.
ESC/P Legacy Command Reference 5.10 Advanced commands ESC i a Switch command mode ASCII: ESC i a n Decimal: 27 105 97 n 69 61 n Hexadecimal: 1B Function Switches the command mode. Details When setting n is: 00h or 30h: ESC/P Legacy / Raster mode (default) 03h or 33h: P-touch Template mode 04h or 34h: ESC/P Brother mode Example: 1Bh 69h 61h 00h Specifies ESC/P Legacy / Raster mode. - 50 - 5.
ESC/P Legacy Command Reference ESC i S Request printer status ASCII: ESC i S Decimal: 27 105 83 69 53 Hexadecimal: 1B Function Requests the printer status. Details *Refer to the P-Touch Template Command Reference. ESC ~ e F 1 Reverse feed ASCII: ESC ~ e F 1 n m Decimal: 27 126 101 70 1 n m 7E 65 46 01 n m Hexadecimal: 1B Function Reverse feeds the paper by the specified number of lines. Details The number of lines is specified with the two bytes n m.
ESC/P Legacy Command Reference Appendix A: Character Code Tables Character code tables Advanced graphics code table MSB 2 3 5 6 7 8 9 A B C D E F 0 SP 0 @ P ` p Ç É á ░ └ ╨ α ≡ 1 ! 1 A Q a q ü æ í ▒ ┴ ╤ ß ± 2 “ 2 B R b r é Æ ó ▓ ┬ ╥ Γ ≥ 3 # 3 C S c s â ô ú │ ├ ╙ π ≤ 4 $ 4 D T d t ä ö ñ ┤ ─ ╘ ∑ ⌠ 5 % 5 E U e u à ò Ñ ╡ ┼ ╒ σ ⌡ 6 & 6 F V f v å û a ╢ ╞ ╓ µ ÷ 7 ‘ 7 G W g w ç ù o ╖ ╟ ╫
ESC/P Legacy Command Reference Italic characters code table MSB 2 3 5 6 7 A B C D E F 0 SP 0 @ P ` p SP 0 @ P ` p 1 ! 1 A Q a q ! 1 A Q a q 2 “ 2 B R b r “ 2 B R b r 3 # 3 C S c s # 3 C S c s 4 $ 4 D T d t $ 4 D T d t 5 % 5 E U e u % 5 E U e u 6 & 6 F V f v & 6 F V f v 7 ‘ 7 G W g w ‘ 7 G W g w 8 ( 8 H X h x ( 8 H X h x 9 ) 9 I Y i y ) 9 I Y i y A * : J Z j z * :
ESC/P Legacy Command Reference International characters Country 23 24 40 5B 5C 5D 5E 60 7B 7C 7D 7E 0 USA # $ @ [ \ ] ^ ` { ¦ } ~ 1 France # $ à ° Ç § ^ ` é ù é ø 2 Germany # $ § Ä Ö Ü ^ ` ä ö ü ß 3 UK £ $ @ [ \ ] ^ ` { ¦ } ~ 4 Denmark I # $ @ Æ Ø Å ^ ` æ ø å ~ 5 Sweden # ¤ É Ä Ö Å Ü é ä ö å ü 6 Italy # $ @ ° \ é ^ ù à ò è ì 7 Spain I ₧ $ @ ¡ Ñ ¿ ^ ` ø ñ } ~ 8 Japan # $ @ [ ¥ ] ^ ` {
ESC/P Legacy Command Reference Appendix B: Introducing the Brother Developer Center Useful information for developers, such as applications, tools, SDKs as well as FAQs, are provided in the Brother Developer Center. https://support.brother.com/g/s/es/dev/en/index.