Vous êtes sur la page 1sur 23

Epson Escape Codes (ESC/P-83)

Compatible with Epson LQ and FX series Dot Matrix printers.

See the examples at the end of the table

© Copyright 1995-1998 All rights reserved

07/13/1998

ASCII DEC HEX Description

BEL 7 7 Beeper

BS 8 8 Backspace

Tab
HT 9 9 horizontally

LF 10 0A Line feed

VT 11 0B Tab vertically

FF 12 0C Form feed

CR 13 0D Carriage return

Select double-
SO 14 0E wide (1 line)

Select
condensed
SI 15 0F mode
DC1 17 11 Select printer

Cancel
condensed
DC2 18 12 mode

Deselect
DC3 19 13 printer

Cancel double-
DC4 20 14 wide (1 line)

CAN 24 18 Cancel line

Delete
DEL 127 7F character

Select double-
ESC SO 14 0E wide (1 line)

Select
condensed
ESC SI 15 0F mode

Cut sheet
ESC EM 25 19 feeder on/off

Set inter
character
ESC SP 32 20 space

ESC ! 33 21 Master select


Cancel MSB
ESC # 35 23 control

Set absolute
ESC $ 36 24 print position

Select user-
ESC % 37 25 defined set

Define user-
defined
ESC & 38 26 characters

ESC (- 40 28 Select Score

Select graphics
ESC * 42 2A mode

Set n/360-inch
ESC + 43 2B Line Spacing

Turn
underlining
ESC - 45 2D on/off

Select vertical
ESC / 47 2F tab channel

Select 1/8-inch
ESC 0 48 30 line spacing
Select 1/6-inch
ESC 2 50 32 line spacing

Select n/216-
inch line
ESC 3 51 33 spacing

Select italic
ESC 4 52 34 mode

Cancel italic
ESC 5 53 35 mode

Enable
printable
ESC 6 54 36 characters

Enable upper
ESC 7 55 37 control codes

Copy ROM into


ESC : 58 3A RAM

Unidirectional
ESC < 60 3C mode (1 line)

ESC = 61 3D Set MSB to 0


NOTE!! The ESC character is DEC 027 or HEX 1B. Use the above
table to determine which character code (Dec or Hex) that should
be sent after the ESC character.

EXAMPLE. To set the "emphasized" mode in the printer, either of


the following character strings may be sent.

ASCII…..ESC….E

Decimal…027…..069

Hex……..1B……45
Descriptio
ASCII DEC HEX n

Set MSB
ESC > 62 3E to 1

Reassign
graphics
ESC ? 63 3F mode

Initialize
ESC @ 64 40 printer

Set n/72-
inch line
ESC A 65 41 spacing

Set
vertical
ESC B 66 42 tabs

Set page
length in
ESC C 67 43 lines

Set page
length in
ESC C0 67 67 inches

Set
horizontal
ESC D 68 44 tabs

Select
emphasiz
ESC E 69 45 ed mode
Cancel
emphasiz
ESC F 70 46 ed mode

Select
double-
strike
ESC G 71 47 mode

Cancel
double-
strike
ESC H 72 48 mode

Perform
n/216-
inch line
ESC J 74 4A feed

Select
single-
density
ESC K 75 4B graphics

Select
double-
density
ESC L 76 4C graphics

Select 12
ESC M 77 4D cpi

Set skip
over
perforatio
ESC N 78 4E n

Cancel
skip over
perforatio
ESC O 79 4F n

Select 10
ESC P 80 50 cpi
Set right
ESC Q 81 51 margin
Internatio
nal
character
ESC R 82 52 set

Select
superscri
ESC S0 83 53 pt mode

Select
subscript
ESC S1 83 53 mode

Cancel
superscri
pt/subscri
ESC T 84 54 pt

Turn
unidirecti
onal
mode
ESC U 85 55 on/off

Turn
double-
wide
ESC W 87 57 on/off

High-
speed
dbl-
density
ESC Y 89 59 graphics

Quadrupl
e-density
ESC Z 90 5A graphics

Retrieve
relative
ESC \ 92 5C position

Select
justificati
ESC a 97 61 on
Set
vertical
tabs in
ESC b 98 62 channels

Select 15
ESC g 103 67 CPI

Select
typestyle
ESC k 107 6B family

Set left
ESC l 108 6C margin

Turn
proportio
nal mode
ESC p 112 70 on/off

Select
character
ESC q 113 71 style

Select
character
ESC t 116 74 table

Turn
double-
high
ESC w 119 77 on/off

Select
NLQ or
ESC x 120 78 draft
Advanced report design
Print output and design for dot matrix and pos devices

Page setup

Page size is very important to configure, else you will obtain longer lines and longer pages and not the correct output.

You can define margins to 0, because the page size will define the practical print out of the printer, that is the printable area.

For a page width of 80 columns at 10cpi the page width is calculated:

Page Width=80 characters with/ 10 characters per inches = 8 inchess = 8*2.54 cms = 20.32 cms

For a page height of 66 lines:

Page Height=66 lines / 6 lines per inches = 11 inchess = 11*2.54 cms = 27.94 cms

Select user defined paper size and enter the correct values.

For thermal receipt printers usually the font A is 12cpi and font B is 17 cpi, so set a page with of 42 /12cpi=3,3 inchess=8..6cm

For impact receipt printers usually the font A is 10cpi and font B is 12 cpi, so set a page with of 33/10cpi=3,3 inchess=8..6cms

For receipt printers you can establish a page length of 11 inchess=27.94 cms. If you don't use page headers-footers, or repeat

Activate text out

To automatically activate a report to print as a text (without driver interaction or filtering) with escape code secuences you ca

If you have problems or want to enable better quality escape codes (bold,italic, 12cpi, 20cpi) you can select another driver by

You can also select a printer queue (system printer) so the output will be done to the selected printer.

At page setup you can force cash drawer open (the engine will send the escape command to the printer), before or after prin

Microsoft Windows additonal features

With Microsoft Windows and a good quality print driver installed you can still use the driver to provide fast printing with print

With this method, the engine will select the best affordable font for the texts, but the graphic elements and images will be pri

Note this print method does not output lines, but calls Windows API for any graphic and text operation, and for page size selec
How it works and design recommendations

The graphic elements (drawings and images) are ignored, based on the page size, the number of lines of the report are determ

The length in characters of each line is determined by the first text element placed in the line (or 10cpi is selected if no text in

Font Size Step cpi


<8 20
8 17
9 15
10 12
11,12 10
13-15 6
>15 5

The text elements are placed vertically rounded to 1/6 inch, so the better way to design a report for text output is set grid hei

Set horizontal page size correctly or at least narrower than the real page size (printer capability), if you print a 132 column rep

The final output will be a number of lines formatted with the selected driver (escape codes), or no formatting at all (PLAIN driv

Internal implementation

When the final output is created in memory, the engine send it to the printer in this way:

Microsoft Windows

A new print document is created with the Windows API, to disable the driver, the document is queued as a RAW type docume

Linux

The lines are saved to a temporary file, and using unix like interprocess comunication (pipes) the engine calls lpr command lin

The recode command line tool is called with this parameters:

recode ..850/ tempfile

The lpr command line tool is called with this parameters:

lpr -P printerqueue -r -l -J Title

The -P printerqueue parameters are omited if the default printer is used. The -r will force deletion of the temporary file after p

Drivers overview
Descriptio
n, escape
Name codes

No
escape
codes are
introduce
d , no
form feed
character
PLAIN s

Init
printer,
page size,
10cpi,
wide
escape
(5cpi) and
condense
d escape
(17cpi),
form
feed,
underline
EPSON style

Init
printer,
page
size,form
feed, 5-6-
10-12-17-
20cpi,
underline
-bold-
italic, all
EPSON- with ESC !
MASTER command
Init
printer,
page
size,form
feed, 5-6-
10-12-17-
20cpi,
underline
-bold-
italic, all
with
ESC/P
compatibl
e
EPSON- command
ESCP s

Same as
EPSON-
ESCP but
selecting
the better
EPSON- quality
ESCPQ (slower)

Init
printer,
page
size,form
feed, 5-6-
10-12-17-
20cpi,
underline
-bold-
italic,
with IBM
Proprinte
r escape
IBMPROP command
RINTER s
Init
printer,
page
size,form
feed, 6-
12-17cpi,
underline
-bold, all
with ESC !
command
, but is
capable
of
printing
EPSONTM red color
U210 text.

Same as
EPSONTM
U210 but
perform a
cut paper
command
at the end
EPSONTM of the
U210CUT document

Init
printer,
page size,
6-12-
17cpi,
underline
-bold, all
EPSONTM with ESC !
88II command
Same as
EPSONTM
88II but a
cut paper
command
at the end
EPSONTM of the
88IICUT document

Init
printer,
page
size,form
feed, 5-6-
10-12-17-
20cpi,
underline
-bold-
italic, all
with HP-
PCL
compatibl
e
command
HP-PCL s

Try to
emulate
VT-100
escape
VT-100 codes

Same as
plain but
without
blank
spaces or
PLAINFUL blank
L lines
ot the correct output.

er, that is the printable area.

42 /12cpi=3,3 inchess=8..6cms. The characters for font B are 3.3*17=56 at this size. The physical real page width can differ.

33/10cpi=3,3 inchess=8..6cms. The characters for font B are 3.3*12=40 at this size. The physical real page width can differ.

age headers-footers, or repeatable group headers, will be just like there was not page breaks, the ticket printer driver does not send form f

escape code secuences you can go to page setup, select that the report will be output to the character printer (default EPSON driver) or s

u can select another driver by clicking at printer setup button. You can select a printer in the list and the driver it will use. If you don't selec

e printer), before or after printing the report.

rovide fast printing with printer native fonts. You must select the blank text driver and check the Device fonts option.

ements and images will be printed also (usually the graphic elements print slow on impact printers).

eration, and for page size selection, the source of any problem (page displacement, garbage output) is usually the print driver.
lines of the report are determined at a rate of 1/6 lines for inch so for a 11 inch page size the page will be build with 66 text lines.

r 10cpi is selected if no text in this line), the font step (you can specify a Font Step in the designer) of this text will determine the font size f

for text output is set grid height to 1/6 inch that is 0.1666 inch or 0.42333 cms. Also set the horz.grid size as the most common size of it,

if you print a 132 column report in a 80 cols printer, the printer will skip two lines for each report line.

no formatting at all (PLAIN driver). Depending on the selected driver the last line of each page will finish with a Form Feed instead a Line Fe

ueued as a RAW type document, so the text go to the printer throught the selected port in printer configuration without processing in the

engine calls lpr command line tool, if oem option is checked then the file is processed first by the recode command line tool.

on of the temporary file after processing it, the -l indicates the lpr command to send the file directly to the device without using any print fi
width can differ.

dth can differ.

er driver does not send form feeds.

er (default EPSON driver) or select the output to ticket printer (default EPSONTMU210 driver).

er it will use. If you don't select a driver, standard output will be used.

y the print driver.


uild with 66 text lines.

t will determine the font size for that line (only one font size is allowed for each line but multiple font styles can be combined in one line).

as the most common size of it, for example for a 10cpi report set horz. grid to 0.1 inch or 0.254 cms. Also resize the section heights to mu

a Form Feed instead a Line Feed.

tion without processing in the printer driver. If oem option is checked then the text is processed first with CharToOem API function.

ommand line tool.

evice without using any print filter, and the -J gives a job title for the printer queue.
can be combined in one line). If the text element Font Step indicates By Size value, the engine will use the following table:

size the section heights to multiples of 1/6 inch, you can do it automatically by selection the option in Edit menu.

harToOem API function.


llowing table:
dim fso as new FileSystemObject
dim ts as TextSTream

set ts = fso.CreateTExtfile(<FileName.txt>)
ts.write " Invoice "
ts.write "Date:2323 BillNo.4"
ts.write "-----------------------------"
ts.close

''Print to Printer
''For XP
Shell "CMD /C TYPE " & FilePath & " > PRN", vbNormalFocus

''For 98/Me
Shell "COMMAND /C TYPE " & FilePath & " > PRN", vbNormalFocus

''For preview on screen


'Shell "CMD /C Edit /R " & FilePath, vbNormalFocus
Private Sub cmdPrint_Click()
'This is the sample how to print in Dos Mode and How to print it Bold!
'http://www.geocities.com/mdgnn/xcontrols.htm

Open "Lpt1" For Output As #1

Print #1, Chr(27) & "@" 'Initialize printer


Print #1, Chr(27) & "A" & Chr(11)
Print #1, Chr(27) & "E" 'Set Font Bold
Print #1, "Printer is Bold"
Print #1, "Printer is Bold"
Print #1, Chr(27) & "F" ' Set Font Normal

Print #1, "Printer is Normal"


Print #1, "Printer is Normal"

Close #1
End Sub

Vous aimerez peut-être aussi