Você está na página 1de 14

4/1/13 Epson ESC/P and ESC/P2 Printer Codes

Shop Now!-100%Rs. 1Rs. 849 Shop Now!-31%Rs. 1990Rs. 2890 Shop

Fidcal
TECHZONE

The Epson
ESC/P &
ESC/P2
Printer
Codes
Many printer code lists are either in code order (OK for hacking but
useless for setting up a print job!) or grouped in types (so for 'bold print'
you would need to first find out then always remember that it's in the
'style' group (or some other name); for a new line you would probably
have to know that it's in the 'move' group. But THIS list is in simple
alphabetic order of the function needed. So, if, for example, you want to
start a new line, you simply look under N for New Line.

Many functions are entered several times under different names, eg, 'new
line' is also under 'line feed' because not everyone uses the same
definitions. If any of YOUR preferred definitions are not there you can edit
or add to the list in a web page editor or in any plain ASCII text editor if
you know how to edit simple html text.

The codes themselves are decimal values (separated by commas where


there is more than one value for a function). They can be used from most
programming languages as well as some applications such as text
editors which permit you to enter printer codes.

Typically in BASIC you would enter them by using LPRINT CHR$(n). For
www.fidcal.com/printercodes/ 1/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

Typically in BASIC you would enter them by using LPRINT CHR$(n). For
example, to print with emphasised characters, the codes are 27,69 which
would be entered in BASIC as LPRINT CHR$(27);CHR$(69).

Note that when a value is the ASCII code for a quotable character then
the character can be used (within quotes) instead. So, whereas 27 is not
quotable, 69 is because it is the ASCII value for the capital letter "E". So,
instead of LPRINT CHR$(27);CHR$(69) you could, if you prefer, use
LPRINT CHR$(27);"E" which sends exactly the same codes to a printer.

Where a code uses 0 and 1 as ON and OFF flags then you can normally
use 48 ("0") and 49 ("1") as alternatives.

Some BASIC language versions in some modes always add a line feed
after LPRINT. If you keep getting extra line spaces then you might try
adding a semi-colon (;) at the end of the LPRINT string, for example,
LPRINT CHR$(27);CHR$(69);

QUICK BASIC has some terrible quirks if sending codes. You might well
find it sending a line feed code in the middle of sending graphic data! If
you get problems with some codes not doing what they should then
instead of LPRINT try instead the following...

OPEN "PRN" FOR BINARY AS #3


PRINT #3;CHR$(27);CHR$(69);

The above 'OPEN' line need only be used once at the start of the program
and need not be used before every PRINT #.

The #3 at the end of the 'OPEN' line can be any value from 1 to 15 but you
cannot use the same number as is being used for some other operation
at the same time (eg, if you have opened a file for reading or writing).

"LPT1" or "LPT2" can be used instead of "PRN" but "PRN" works for
both whereas "LPT1" would fail on a system configured for "LPT2"

In BASIC, string variables can be used to represent codes, for example..

esc$=CHR$(27)
emph$=esc$+"E"
emphOFF$=esc$+"F"
dubStrike$=esc$+"G"
dubStrikeOFF$=esc$+"H"

Then you can build up multiples like...

bold$=emph$ + dubStrike$
boldOFF$=emphOFF$+dubStrikeOFF$

Thus, when you want to print in bold print...

LPRINT "This is "; bold$;"bold";boldOFF$


www.fidcal.com/printercodes/ 2/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

LPRINT "This is "; bold$;"bold";boldOFF$

In the list, variable codes are represented by labels which you need to
replace with actual values (or programming varaibles) when used. For
example, you might substitute 5 for n (depending on what you want to
achieve and what the range of the parameter allows). Where more
explanation is needed an asterisk with a number is shown, eg, *1 and *2.
Details of these are explained at the end of the list.

In the list, lo, hi means a two byte value between 0 and 65535. You
replace lo and hi with the values you want. To calculate lo and hi, take
your original value (example: the length of image data, let's say 700 bytes
long. Divide it by 256 which is 2 and a remainder of 188. hi is the 2 and lo
is the remainder so it would be put in as 188,2 to replace lo,hi when
actually applying any of the code sequences listed below. lo,hi must
never be greater than the graphics mode selected will allow of dots on
one line.

Not all printers will implement all the codes nor is the list complete so
some printers might implement more codes. The list shows the most
commonly-used codes.

These codes will not be effective from many Windows programs (that is,
from the user's point of view) so don't expect Notepad to print wide print
after you have sent the wide code!

Some codes are not implemented immediately but for example after the
next line feed. So if nothing seems to happen it does not necessarily
mean there is a fault. However, if when printing images you do not send
the correct data length, the printer might be expecting more image data
and will treat further codes or even text as more image data. This might
be buffered and the printer will do nothing. Even using 27,64 will not clear
the printer; you might have to switch it off or send enough image data.

Here's the reference list...

The Epson ESC/P & ESC/P2 Printer Codes


DECIMAL CODES FUNCTION (ALPHABETICAL ORDER)

27,52 Alternate characters ON (usually italic) *2

27,53 Alternate characters OFF *2

8 Back Space

27,85,0 Bi-directional printing


www.fidcal.com/printercodes/ 3/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

7 Beep or bell

27,114,0 Black ink

27,69 Bold semi (emphasized) characters ON

27,70 Bold semi (emphasized) characters OFF

27,85,0 Both directions printing

27,78,n Bottom margin n lines ON *4

27,79 Bottom margin OFF *4

24 Cancel line

13 Carriage Return (return to start of line)

27,97,1 Centre text

27,105,1 Character-by-character printing (immediate)

27,52 Characters (alternate) ON *2 (usually italic)

27,53 Characters (alternate) OFF *2

27,82,n Characters (national) set n *5

27,37,0 character set = normal

27,37,1 character set = user-defined

27,38,n,n,n... character set DEFINE

27,58,0 character set Roman to RAM

27,58,1 characters Sans Serif to RAM

27,64 Clear all codes

127 Clear printer buffer

27,114,0 Colour Black

27,114,1 Colour Magenta

27,114,2 Colour Cyan

27,114,3 Colour Violet

www.fidcal.com/printercodes/ 4/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

27,114,4 Colour Yellow

27,114,5 Colour Red

27,114,6 Colour Green

15 Condensed Characters ON

18 Condensed Characters OFF

27,114,2 Cyan ink

27,64 Defaults set all (initialize printer)

127 Delete (from buffer) last character

24 Delete(from buffer) last line

19 Deselect printer

27,71 Double-strike ON

27,72 Double-strike OFF

14 Double-width characters ON *6

20 Double-width characters OFF *6

27,87,1 Double-width characters ON *6

27,87,0 Double-width characters OFF *6

27,101,1,n Down tab SET n (regular)

27,66,n,n,n... Down tab SET (irregular)

27,98,c,n,n... Down tab SET channels

27,47,c Down tab channel SELECT

11 Down tab as set

27,102,1,n Down tab n lines

120,0 Draft quality ON (LQ or NLQ off) *8

120,1 Draft quality OFF (LQ or NLQ) *8

27,25,82 Eject page

www.fidcal.com/printercodes/ 5/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

27,77 Elite (12 cpi) characters ON

27,80 Elite (12 cpi) characters OFF

27,69 Emphasized characters ON

27,70 Emphasized characters OFF

27,56 Empty paper disable

27,57 Empty paper enable

127 Empty the printer buffer

14 Enlarged (wide) characters ON (one-line) *6

20 Enlarged (wide) chars OFF (one-line) *6

27,87,1 Enlarged characters ON *6

27,87,0 Enlarged characters OFF *6

127 Erase (from buffer) last character

24 Erase (from buffer) last line

27,115,1 Faint/fast print ON

27,115,0 Faint/fast print OFF

27,115,1 Fast/half-tone ON

27,115,0 Fast/half-tone OFF

27,115,1 Feint/fast print ON

27,115,0 Feint/fast print OFF

27,37,0 font = normal

27,37,1 font = user-defined

27,116,n Font select n

12 Feed Form (form feed)

12 Feed Page (form feed)

12 Feed Sheet (form feed)

www.fidcal.com/printercodes/ 6/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

27,38,n,n,n... font DEFINE

27,58,0 font Roman to RAM

27,58,1 font Sans Serif to RAM

12 Form Feed (new page)

27,67,n Form length n lines

27,67,0,n Form length n inches

27,42,*1,lo,hi Graphics (variable resolution)

27,75,lo,hi Graphics (480 dots-per-line resolution)

27,76,lo,hi Graphics (960 dots-per-line resolution)

27,89,lo,hi Graphics (960 dots-per-line faint/fast)

27,90,lo,hi Graphics (1920 dots-per-line resolution)

27,114,6 Green ink

27,115,1 Half-tone/fast ON

27,115,0 Half-tone/fast OFF

27,60 Home (line restart)

27,42,*1,lo,hi Image mode (variable) *1

27,75,lo,hi Image (480 dots-per-line resolution)

27,76,lo,hi Image (960 dots-per-line resolution)

27,89,lo,hi Image (960 dots-per-line resolution faint/fast)

27,90,lo,hi Image (1920 dots-per-line resolution)

27,105,1 Immediate print character-by-character

27,64 Initialize printer (clear all codes)

27,52 Italic characters ON *2

27,53 Italic characters OFF *2

27,97,0 Justify left

27,97,2 Justify right


www.fidcal.com/printercodes/ 7/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes
27,97,2 Justify right

27,97,3 Justify both

27,108,n Left margin n characters

120,1 Letter quality ON *8

120,0 Letter quality OFF *8

27,105,0 Line buffering

10 Line Feed (new line)

27,105,0 Line printing (buffered)

27,60 Line restart

27,48 Line space 1/8th"

27,49 Line space 7/72th"

27,50 Line space 1/6th"

27,51,n Line space n/216th"

27,74,n Line space n/216th" *3

27,65,n Line space n/72th"

120,1 LQ letter quality ON *8

120,0 LQ letter quality OFF *8

27,114,1 Magenta ink

27,108,n Margin (left) n characters

27,81,n Margin (right) n characters

27,78,n Margin(vertical) n lines ON*4

27,79 Margin (vertical) OFF *4

27,33,n Master style select *7

27,82,n National character set n *5

10 New Line (line feed)

12 New Page (form feed)


www.fidcal.com/printercodes/ 8/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

12 New Sheet (form feed)

120,1 NLQ letter quality ON *8

120,0 NLQ letter quality OFF *8

27,107,0 NLQ font = Roman

27,107,1 NLQ font = Sans Serif

27,85,1 One-direction printing

27,56 Out of paper disable

27,57 Out of paper enable

27,106,n Page backwards n/216"

27,25,82 Page eject

12 Page feed (form feed)

27,25,49 Page feed 1 SET

27,25,50 Page feed 2 SET

27,25,70 Page front tractor SET

27,25,66 Page rear tractor SET

27,67,n Page length (n lines)

27,67,0,n Page length (n inches)

27,106,n Page upwards n/216"

27,25,82 Paper eject

27,56 Paper empty disable

27,57 Paper empty enable

12 Paper feed (form feed)

27,25,49 Paper feed 1 SET

27,25,50 Paper feed 2 SET

27,25,70 Paper front tractor SET

www.fidcal.com/printercodes/ 27,25,66 Paper rear tractor SET 9/14


4/1/13 Epson ESC/P and ESC/P2 Printer Codes

27,25,66 Paper rear tractor SET

27,56 Paper out disable

27,57 Paper out enable

27,67,n Paper length n lines

27,67,0,n Paper length n inches

27,78,n Perforation skip n lines ON

27,79 Perforation skip OFF

27,80 Pica (10 cpi) characters ON

27,77 Pica (10 cpi) characters OFF

27,42,*1,lo,hi Picture mode (variable)

27,75,lo,hi Picture (480 dots-per-line resolution)

27,76,lo,hi Picture (960 dots-per-line resolution)

27,89,lo,hi Picture (960 dots-per-line resolution faint/fast)

27,90,lo,hi Picture (1920 dots-per-line resolution)

17 Printer select

19 Printer deselect

27,114,5 Red ink

127 Remove (from buffer) last character

24 Remove(from buffer) last line

27,60 Restart line (home)

27,106,n Reverse line feed n/216"

27,81,n Right margin n characters

9 Right tab as set

27,101,0,n Right tab SET n (regular)

27,68,n,n,n... Right tab SET (variable)

27,107,0 Roman (NLQ font)


www.fidcal.com/printercodes/ 10/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes
27,107,0 Roman (NLQ font)

27,107,1 Sans Serif (NLQ font)

17 Select printer

27,69 Semi-bold (emphasized) characters ON

27,70 Semi-bold (emphasized) characters OFF

27,25,82 Sheet eject

12 Sheet feed (form feed)

27,25,49 Sheet feed 1 SELECT

27,25,50 Sheet feed 2 SELECT

27,25,70 Sheet front tractor SET

27,25,66 Sheet rear tractor SET

27,67,n Sheet length n lines

27,67,0,n Sheet length n inches

27,85,1 Single-direction print

27,78,n Skip perforation n lines ON *4

27,79 Skip perforation OFF *4

13 Start of line (CR)

27,60 Start of line (home)

27,33,n Style Master select *7

27,83,0 Superscript ON

27,84 Superscript OFF

27,83,1 Subscript ON

27,84 Subscript OFF

27,101,0,n Tab right SET n (regular)

27,68,n,n,n... Tab right SET (variable)

9 Tab right as set


www.fidcal.com/printercodes/ 11/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

27,102,0,n Tab right n characters

27,101,1,n Tab down SET n (regular)

27,66,n,n,n... Tab down SET (irregular)

27,98,c,n,n... Tab down SET channels

27,47,c Tab down channel SELECT

11 Tab down as set

27,102,1,n Tab down n lines

27,78,n Top margin n lines ON *4

27,79 Top margin OFF *4

27,85,0 Two-directional printing

27,105,1 Typewriter mode

27,45,1 Underline ON

27,45,0 Underline OFF

27,85,1 Uni-directional printing

27,106,n Upward line feed n/216"

11 Vertically tab down

27,114,3 Violet ink

14 Wide characters ON (one-line) *6

20 Wide characters OFF (one-line) *6

27,87,1 Wide characters ON *6

27,87,0 Wide characters OFF *6

27,114,4 Yellow ink

*1 is the mode in Graphics(variable resolution) The *1 should be replaced with:


0 = single density = 480 dots a line
www.fidcal.com/printercodes/ 12/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

0 = single density = 480 dots a line


1 = double density = 960 dots a line
2 = 1 but faint+fast = 960 dots a line
3 = quad density = 1260 dots a line
4 = screen monitor 1 = 640 dots a line
5 = screen monitor 2 = 576 dots a line
6 = screen monitor 3 = 720 dots a line

lo,hi must not be greater than the dots a line shown because that is the maximum (it can of
course be less)

*2 Alternate Characters. Many printers have an alternate character set that can be switched to.
Typically this might be the same character set as the main one but in italic (sloping) form.

*3 Line space n/216th" (27,74,n) is temporary for that line only and de- faults to previous setting
after a line feed. That is, it clears itself. To set up n/216th" line spacing permanently (until you
clear it with another code) use 27,51,n

*4 Top and Bottom margins: 27,78,n and 27,79 are actually skip perforation ON and OFF. The
printer normally counts DOWN the number of lines left to print on the page (default total normally
66 but can be changed with the Page Length code).

If this skip perforation code is ON then when the printer counts down to 'n' it prints 'n' blank lines.

If you initially line up the top of the paper in line with the print head then you will get no margin at
the top(unless blank lines are included in the text being printed) but 'n' blank lines at the bottom.

To get an equal margin top and bottom you need to either wind down or manually line feed the
paper down half of n lines at the top of the first page (these line feeds can be included in a
program that is printing a document). When the printer tries to print n blank lines at the bottom of
each page it will then only print half at the bottom and half at the start of the next page.

*5 National character set. There are variations in the character set for different countries. For
example, Character 35 is the hash sign "#" in the American selection but a pound sign "" in the
UK. The codes are 27,82,n where n is:

0=USA
1=France
2=Germany
3=UK
4=Denmark 1
5=Sweden
6=Italy
7=Spain 1
www.fidcal.com/printercodes/ 13/14
4/1/13 Epson ESC/P and ESC/P2 Printer Codes

8=Japan
9=Norway
10=Denmark 2
11=Spain 2
12=Latin America

Probably most printers are set for USA by default. Not all printers cover all the countries shown.
The first four are most common.

*6 Wide (enlarged) characters mode using 27,14 is only temporary for that line and is cleared
when printing starts a new line. Likewise 27,20 only cancels one-line wide print. Wide characters
using 27,87,1 are permanent until switched off with code 27,87,0.

*7 Master style select 27,33,n where n=


0=Pica (10 characters per inch)
1=Elite (12 characters per inch)
4=condensed
8=emphasised
16=Double Strike
32=Double Width
64=Italic
128=Underline

*8 Whether codes 27,120,1 will provide Letter Quality (LQ) or Near Letter Quality (NLQ) depends
on your printer. 9-pin printers typically will only give NLQ. Draft quality is simply disabling LQ or
NLQ to print normally.

Shop Now!-100%Rs. 1Rs. 849 Shop Now!-31%Rs. 1990Rs. 2890 Shop

contact: email us!

www.fidcal.com/printercodes/ 14/14

Você também pode gostar