EPSON ESC/P 2 PRINTER COMMAND CODES 
  ( Courtesy of Colin Bryant ) 
© Copyright 1995-1998 All rights reserved

07/13/1998

This list has been compiled from a variety of sources by Colin Bryant (bryant@interchg.ubc.ca). Thanks to those who have added to the list or told Colin where to find codes.

Colin is always interested in how people apply the list. Please let him know what software you use the codes with. If you learn any more codes, please let him know what they are so that he can continue to pass them on. It is all North American market information, unless otherwise stated. While the codes are all ESC/P2, many will also work with the older ESC/P printers.

Link to Epson's on line ESC/P2 manual in PDF format from Epson's UK site.

Link to an online ESC/P2 manual in PDF format from what appears to be a personal site in Korea.


(Colin's words below)

My experience with sending printer command codes is with Paradox for DOS (a relational database). When designing a report, I create a calculated field and enter the Esc sequence within quotes. The quotes indicate that it's a string to be passed on, rather than a command for Paradox. "Esc" tells the printer that all characters before the next space are part of a printer command. It seems to be necessary to convert the "Esc" to ASCII but optional to convert the rest of the command. The "\027" is simply the ASCII equivalent of "Esc".
 

I've picked some examples from a report;

"\027x0\015" puts my ESC600 into compressed mode (17 char. per inch)

"\027w\001" turns expanded mode on (large characters)

"\027w\000" turns expanded mode off (back to 10 char per inch)


blue = from the Paradox for DOS manual for LQ-1500 (dot matrix)

navy = from the Epson's escp2.txt file

fuchsia = from ESCODE.TXT, was pulled from the Epson bbs.

purple = from Peter Curran's MX-100 (dot matrix) manual
 
 
 
  • Code 
  • Purpose 
  • Details 
    • General Operation 
    • ESC @ 
  • reset 
  •  
    • ESC U 
  • unidirectional on/off 
  •  
    • ESC EM n 
  • cut sheet feeder operation 
  • n = 0 Disable CSF  

  • n = 1 Select Bin 1 
    n = 2 Select Bin 2 
    n = 4 Enable CSF 
    n = R Eject Sheet
    • ESC s 
  • half speed on/off 
  •  
    • Paper feeding 
    • CR 
  • Prints buffer contents and resets buffer count to 0 
  •  
    • FF 
  • Advances paper to next logical TOF (top of form) 
  •  
    • LF 
  • Printer empties its buffer and does line feed at current line spacing and resets buffer pointer to zero. 
  •  
    • ESC 0 
  • 8 lines per inch 
  • reset perforation skip to 0 lines 
    • ESC 2 
  • single-space text (6 lines per inch) 
  •  
    • ESC 3 n 
  • line spacing 
  • n/180-inch  

  • n/216-inch
    • ESC A n 
  • line spacing 
  • n/60-inch  

  • n/72-inch
    • ESC + n 
  • line spacing 
  • n/360-inch 
    • ESC \065\020 
  • double-space text (3 lines per inch) 
  •  
    • Page format 
    • ESC i n 
  • Immediate mode on/off 
  •  
    • ESC ( C m1 m2 n1 n2 
  • Set Page Length in Defined Units 
  • ESC ( C m1 m2 n1 n2 is the command for setting the page length in units where m1, m2, n1 and n2 are variables. The "unit" is usually 1/360 of an inch unless defined otherwise by the "ESC ( U" command. Currently, the values for m1 and m2 MUST be m1=2 and m2=0.  

  • To determine the values for n1 and n2 perform the following steps. 
    1. Determine the desired page length in inches. 
    2. Multiply the page length by 360. 
    3. Divide the result by 256 using long division. 
    4. The remainder in the quotient from step 3 is the value for n1. 
    5. The whole number in the quotient from step 3 is the value for n2. 
    EXAMPLE 
    1. The page length is 8.5 inches. 
    2. 8.5 x 360 = 3060 
    3. 3060 divided by 256 = 11 with a remainder of 244. 
    4. n1=244 
    5. n2=11
    • ESC C n 
  • page length in lines 
  •  
    • ESC C NUL n 
  • page length in inches 
  •  
    • ESC Q n 
  • set right margin  
  •  
    • ESC 1 n 
  • set left margin  
  •  
    • ESC ( c 
  • tell me if you know 
  •  
    • ESC N n 
  • skip over perforation  
  •  
    • ESC O 
  • tell me if you know 
  •  
    • ESC SP n 
  • intercharacter spacing  
  •  
    • Print position 
    • ESC V n data 
  • repeat data  
  •  
    • ESC $ n1 n2 
  • set absolute print position  
  •  
    • ESC \ n1 n2 
  • set relative print position  
  •  
    • ESC ( V m1 m2 n1 n2 
  • Set Absolute Vertical Position 
  • ESC ( V m1 m2 n1 n2 is the command for changing the print position vertically (with respect to the Top of Form position) in units where m1, m2, n1 and n2 are variables. The "unit" is usually 1/360 of an inch unless defined otherwise by the "ESC ( U" command. Currently, the values for m1 and m2 MUST be m1=2 and m2=0.  

  • To determine the values for n1 and n2 perform the following steps. 
    1. Determine the desired vertical distance from the Top of Form in inches. 
    2. Multiply the distance by 360. 
    3. Divide the result by 256 using long division. 
    4. The remainder in the quotient from step 3 is the value for n1. 
    5. The whole number in the quotient from step 3 is the value for n2. 
    EXAMPLE 
    1. The desired distance from the Top of Form is 1 inch. 
    2. 1 x 360 = 360 
    3. 360 divided by 256 = 1 with a remainder of 104. 
    4. n1=104 
    5. n2=1 
    • ESC D n1 n2..NUL 
  • horizontal tab stops 
  •  
    • HT 
  • horizontal tab 
  •  
    • ESC e NUL n 
  • horizontal set tab increment 
  •  
    • ESC f NUL n 
  • set horizontal tabs in spaces 
  •  
    • ESC B n1 n2..NUL 
  • vertical tab stops 
  •  
    • ESC b c n1 n2..NUL 
  • set VTabs in channel 
  •  
    • ESC e 1 n 
  • set vertical tab increment 
  •  
    • ESC f 1 n 
  • vertical skip 
  •  
    • VT 
  • vertical tab 
  •  
    • ESC b x n1 n2..NUL 
  • set VFU tab channel 
  •  
    • ESC / x 
  • select VFU tab channel 
  •  
    • ESC / n 
  • set VTab channel 
  •  
    • ESC J n 
  • immediate feed 
  • immediate n/216 feed  

  • immediate n/180 feed
    • ESC j n 
  • reverse feed 
  • reverse feed n/216  

  • reverse feed n/180
    • FONT SELECTION 
    • `ESC k n 
  • select font 
  • n = 1 Roman  

  • n = 1 San Serif 
    n = 2 Courier 
    n = 3 Prestige 
    n = 4 Script 
    n = 5 Ocr-B 
    n = 6 Ocr-A 
    n = 7 Orator (only with mult-font module) 
    n = 8 Orator (only with mult-font module)
    • ESC x0\015 
  • compressed mode 
  • SC600 default is 10cpi...x0\015 results in 17cpi  
    • CPI 

    • 10 
      12 
      15 
      17 
      20
  • COLUMNS  

  • 80 
    96 
    120 
    137 use 10 condensed 
    160 use 12 condensed
  • ESC x1 
  • letter quality mode 
  •  
  •  
    • ESC X m n1 n2 
  • Select Pitch and Point Size 
  • The variable "m" is used to select the pitch, which is the character spacing. The variable "n1" selects the point size and the variable "n2", at this time, will always be 0 (zero).  The variables "m" and "n1" are explained below.   

  • The values used for "m" are 0, 1, 18, 21, 24, 30, 36, 42, 48, 60, and 72. If "0" is used as the value for "m", there will be no change in pitch. If "1" is used as the value for "m", the character pitch will be proportional spacing. To determine the character pitch for all other values of "m", divide 360 by "m". For example, if m=60 then 360 divided by 60 equals 6 and the character pitch is 6 characters per inch. If m=30, the character pitch is 12 characters per inch. 
    For the Roman and Sans Serif fonts, the values used for "n1" are 0, 16, 20, 21, 24, 28, 32, 36, 40, 42, 44, 48, 52, 56, 60 and 64. For all other fonts, the values used for "n1" are 0, 21, and 42. The actual point size that will print is n1 divided by 2. For example, if n1=20, the point size is 10. If n1=48, the point size is 24. 
    NOTE: When selecting a point size larger than 24 (the value for n1 is greater than 48), select proportional spacing (m=1) for the character pitch.

     
    • ESC P 
  • pica pitch (10cpi) 
  •  
  •  
    • ESC M 
  • elite pitch (12cpi) 
  • 20cpi on Stylus Color 600 
  •  
    • ESC g 
  • tiny font in SC600 
  •  
  •  
    • ESC p 
  • proportional on/off 
  •  
  •  
    • ESC 4 
  • italic character set on 
  •  
  •  
    • ESC 5 
  • italic character set off 
  •  
  •  
    • ESC E 
  • emphasized mode (bold) 
  • works with Stylus Color 600 but how to turn offf? 
  •  
    • ESC F 
  • emphasized mode on 
  •  
  •  
    • ESC ! n 
  • master select 
  • n = 0 Pica   

  • n = 1 Elite 
    n = 2 Proportional 
    n = 4 Condensed 
    n = 8 Emphasized 
    n = 16 Double Strike 
    n = 32 Double Wide 
    n = 64 Italic 
    n = 128 Underline
     
    • FONT ENHANCEMENT 
     
    • ESC W 
  • expanded print on/off 
  •  
  •  
    • DC4 
  • Turns off double width mode (shift out only) 
  •  
  •  
    • SO 
  • Turns off double width mode to end of line unless cancelled by DC4 
  •  
  •  
    • DC2 
  • Turns off compressed characters and empties buffer 
  •  
  •  
    • SI 
  • Turns on compressed character mode. 
  • Does not work with emphasized mode. Stays on until cancelled by DC2. 
  •  
    • ESC w 
  • double on/off 
  •  
  •  
    • ESC w\000 
  • expanded mode off 
  •  
  •  
    • ESC w\001 
  • expanded mode on 
  •  
  •  
    • ESC G 
  • double strike on 
  •  
  •  
    • ESC H 
  • double strike, superscript and subscript off 
  •  
  •  
    • ESC T 
  • Resets superscript, subscript, and unidirectional printing 
  • Does not turn off double strike from script modes  

  •  
     
    • ESC S 
  • super/subscript 
  •  
  •  
    • ESC - 
  • underlining on/off 
  •  
  •  
    • ESC -\001 
  • underlining 
  •  
  •  
    • ESC ( - n1 n2 m d1 d2 
  • select score 
  • n1 Must be 3   

  • n2 Must be 0 
    m Must be 1 
    d1 = 1 Underscore 
    d1 = 2 Strike-Through 
    d1 = 3 Overscore 
    d2 = 0 Cancel selected score 
    d2 = 1 Single line continuous 
    d2 = 2 Double Line continuous 
    d2 = 5 Single Line broken 
    d2 = 6 Double Line broken
     
    • ESC q n 
  • character style 
  • n = 0 Normal   

  • n = 1 Outline 
    n = 2 Shadow 
    n = 3 Outline & Shadow
     
    • ESC +(s1 S 
  • italic 
  •  
  •  
    • SPACING 
     
    • ESC Space 
  • Sets character spacing by adding n columns of blank dots between characters.
  • ESC space n
  • n = 0-127 
  • ESC space 40 would put 40 dot spaces between chars l     i    k     e     t    h    i    s     .
  •  
    • ESC c 
  • tell me if you know 
  •  
  •  
    • ESC ( U 
  • tell me if you know 
  •  
  •  
    • CHARACTER HANDLING 
     
    • ESC a n 
  • justification 
  • n = 0 flush left   

  • n = 1 centering 
    n = 2 flush right 
    n = 3 justified
     
    • ESC t n 
  • Select Character Table 
  • ESC t n is the command for selecting a character table to be used for printing where n is a variable. The following table lists the values for n and the character table associated with the value.   

  • 0 Italic 
    1 Graphic set/PC437 (US) 
    2 User-defined Characters (remap to 80h-FFh) 
    3 PC437 (US)
     
    • ESC ( t n1 n2 d1 d2 d3 
  • Assign Character Table 
  • ESC ( t n1 n2 d1 d2 d3 is the command for assigning character tables where n1,n2, d1, d2, and d3 are variables. Currently, variables n1, n2 and d3 MUST be n1=3, n2=0, and d3=0. Variable d1 is a number corresponding to one of the four tables selectable with the ESC t n command. This is the table that will be replaced. Valid values for d1 are 0, 1, 2, and 3 (see Table 1 below). Variable d2 is a number corresponding to a registered table. This is the table that will replace the table indicated by variable d1. Valid values for d2 are 0, 1, 3, 7, 8, and 9 (see Table 2 below).  
  •  
    • Table 1 (d1 Selectable Table)  

    • 0 Italic 
      1 PC437 (US) 
      2 User-defined Characters 
      3 PC437 (US)
  • Table 2 (d2 Registered Table) 

  • 0 Italic 
    1 PC437 (US) 
    3 PC850 (International) 
    7 PC860 (Portugal) 
    8 PC863 (Canada - French) 
    9 PC865 (Norway)
    • After using the ESC ( t command, the ESC t n command MUST be sent to select the table before printing from the new table. For example, the command ESC ( t 3 0 1 3 0 is sent (assign Registered Table 3 (PC850) to Selectable Table 1 (PC437). In order to print the character (ASCII 245), the command ESC t 1 must be sent.  

    • Some ESC/P2 documentation may illustrate as many as 22 different Registered Tables. The Registered Tables are a part of the character set, therefore, they are contained in the Character Generator ROM. The CG ROM differs based upon the destination country. For this reason, only the above Registered Tables are available on LQ-570, LQ-1070, LQ-870 and LQ-1170 printers sold for the U.S. market. Foreign Character Generator ROMs ARE NOT available in the United States. The following page contains a print sample of the Registered Tables available in printers sold in the U.S. In order to print the first 31 characters in Tables 1 through 9, the ESC ( ^ command must be sent. 

    • ESC R n 
  • select international character set 
  • n = 0 USA  

  • n = 1 France 
    n = 2 Germany 
    n = 3 United Kingdom 
    n = 4 Denmark I 
    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 Korea 
    n = 64 Legal
     
    • ESC % 
  • select character set 
  •  
  •  
    • ESC & NUL n1 n2 a1 data 
  • define user defined character 
  •  
  •  
    • ESC : 
  • Copy resident ROM character set to downloadable-character-set RAM. This allows you to be able to redefine a few characters and select the downloadable characters without having to define all 256 characters.  Must be done before redefining any characters.
  • ESC :  \000  n  \000
  • n=  0 = Roman font

  • >        1 = Sans Serif font
    >        2 = Courier
     
    • ESC 6 
  • sets characters 128 to 159 as printable characters,

  • expanding the printable character set.
     
    • ESC 7 
  • sets characters 128 to 159 to act as control characters identical to characters 0 to 31.
  •  
  •  
    • ESC ( ^ n1 n2 d1 . . . dk 
  • Print Data as Characters 
  • ESC ( ^ n1 n2 d1 . . . dk is the command for printing control codes as data where n1 and n2 are variables and d1 . . . dk represent the data that is to be printed as characters. The variables n1 and n2 tell the printer "the next xx ASCII codes are to be interpreted as characters instead of control codes". This command is used primarily to print displayable characters such as ASCII values 0 through 31 in Registered Tables 1 through 9 which are normally used as control codes (LF, FF, ESC, etc.)  

  • To determine the values for n1 and n2 perform the following steps. 
    1. Determine how many ASCII codes will be sent sequentially immediately following n1 and n2. 
    2. Using long division, divide the quantity of ASCII codes that will be sent sequentially immediately following n1 and n2 by 255. 
    3. The remainder in the quotient is the value for n1. 
    4. The whole number in the quotient is the value for n2. 

    EXAMPLE 
    1. The symbols for the different suits of a card deck (hearts, diamonds, clubs, and spades) are to be printed. These are each separate ASCII codes (ASCII codes 2, 3, 4, and 5 when using the PC437 Character table). 
    2. 4 divided by 255 = 0 with a remainder of 4. 
    3. n1 = 4 
    4. n2 = 0

     
    • BIT IMAGE  
     
    • ESC * m n1 n2 data 
  • select graphic mode 
  • 8-Pin Graphics:  

  • m = 0 = 60 DPI 
    m = 1 = 120 DPI 
    m = 2 = 120 DPI Hi Spd 
    m = 3 = 240 DPI 
    m = 4 = 80 DPI 
    m = 5 = 72 DPI 
    m = 6 = 90 DPI 
    m = 7 = 144 DPI 
    24-Pin Graphics: 
    m = 32 = 60 DPI 
    m = 33 = 120 DPI 
    m = 38 = 90 DPI 
    m = 39 = 180 DPI 
    m = 40 = 360 DPI
     
    • GRAPHICS 
     
    • ESC K n1 n2 data 
  • single-density 60DPI 
  •  
  •  
    • ESC L n1 n2 data 
  • double-density 120DPI 
  •  
  •  
    • ESC Y n1 n2 data 
  • hi-speed double 120 DPI 
  •  
  •  
    • ESC Z n1 n2 data 
  • quad density 240DPI 
  •  
  •  
    • ESC ^ 0 n1 n2 data 
  • 9-pin 60DPI 
  •  
  •  
    • ESC ^ 1 n1 n2 data 
  • 9-pin 120DPI 
  •  
  •  
    • ESC ? n 
  • reassign graphics mode 
  •  
  •  
    • ESC ( G 
  • tell me if you know 
  •  
  •  
    • ESC . 
  • tell me if you know 
  •  
  •  
    • ESC ( i 
  • tell me if you know 
  •  
  •  
    • ESC ( e 
  • tell me if you know 
  •  
  •  
    • ESC ( \ 
  • tell me if you know 
  •  
  •  
    • ESC ( s 
  • tell me if you know 
  •  
  •  
    • COLOR 
  • tell me if you know 
  •  
  •  
    • ESC r n 
  • color selection 
  • n = 0 Black  

  • n = 1 Red (Magenta) 
    n = 2 Blue (Cyan) 
    n = 3 Violet 
    n = 4 Yellow 
    n = 5 Orange 
    n = 6 Green
     
    • ESC ( r 
  • tell me if you know 
  •  
  •  
    • PRINTING MODE 
     
    • ESC ( K 
  • tell me if you know 
  •