epson printer codes
TRANSCRIPT
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
BEL 7 7
BS 8 8
HT 9 9
LF 10 0A
VT 11 0B
FF 12 0C
CR 13 0D
SO 14 0E
SI 15 0F
DC1 17 11
DC2 18 12
DC3 19 13
DC4 20 14
CAN 24 18
DEL 127 7F
ESC SO 14 0E
ESC SI 15 0F
ESC EM 25 19
ESC SP 32 20
ESC ! 33 21
ESC # 35 23
ESC $ 36 24
ESC % 37 25
ESC & 38 26
ESC (- 40 28
ESC * 42 2A
ESC + 43 2B
ESC - 45 2D
ESC / 47 2F
ESC 0 48 30
ESC 2 50 32
ESC 3 51 33
ESC 4 52 34
ESC 5 53 35
ESC 6 54 36
ESC 7 55 37
ESC : 58 3A
ESC < 60 3C
ESC = 61 3D
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.
ASCII…..ESC….E
Decimal…027…..069
Hex……..1B……45
EXAMPLE. To set the "emphasized" mode in the printer, either of the following character strings may be sent.
Description ASCII DEC HEX
Beeper ESC > 62 3E
Backspace ESC ? 63 3F
ESC @ 64 40
Line feed ESC A 65 41
Tab vertically ESC B 66 42
Form feed ESC C 67 43
Carriage return ESC C0 67 67
ESC D 68 44
ESC E 69 45
Select printer ESC F 70 46
Description
Set MSB to 1
Reassign graphics mode
Tab horizontally
Initialize printer
Set n/72-inch line spacing
Set vertical tabs
Set page length in lines
Set page length in inches
Select double-wide (1 line)
Set horizontal tabs
Select condensed mode
Select emphasized mode
Cancel emphasized mode
ESC G 71 47
ESC H 72 48
ESC J 74 4A
Cancel line ESC K 75 4B
ESC L 76 4C
ESC M 77 4D
ESC N 78 4E
ESC O 79 4F
ESC P 80 50
Master select ESC Q 81 51
ESC R 82 52
ESC S0 83 53
Cancel condensed mode
Select double-strike mode
Deselect printer
Cancel double-strike mode
Cancel double-wide (1 line)
Perform n/216-inch line feed
Select single-density graphics
Delete character
Select double-density graphics
Select double-wide (1 line)
Select 12 cpi
Select condensed mode
Set skip over perforation
Cut sheet feeder on/off
Cancel skip over perforation
Set inter character space
Select 10 cpi
Set right margin
Cancel MSB control
International character set
Set absolute print position
Select superscript mode
ESC S1 83 53
ESC T 84 54
Select Score ESC U 85 55
ESC W 87 57
ESC Y 89 59
ESC Z 90 5A
ESC \ 92 5C
ESC a 97 61
ESC b 98 62
ESC g 103 67
ESC k 107 6B
Select user-defined set
Select subscript mode
Define user-defined characters
Cancel superscript/subscript
Turn unidirectional mode on/off
Select graphics mode
Turn double-wide on/off
Set n/360-inch Line Spacing
High-speed dbl-density graphics
Turn underlining on/off
Quadruple-density graphics
Select vertical tab channel
Retrieve relative position
Select 1/8-inch line spacing
Select justification
Select 1/6-inch line spacing
Set vertical tabs in channels
Select n/216-inch line spacing
Select 15 CPI
Select italic mode
Select typestyle family
ESC l 108 6C
ESC p 112 70
ESC q 113 71
ESC t 116 74
ESC w 119 77
Set MSB to 0 ESC x 120 78
Cancel italic mode
Set left margin
Enable printable characters
Turn proportional mode on/off
Enable upper control codes
Select character style
Copy ROM into RAM
Select character table
Unidirectional mode (1 line)
Turn double-high on/off
Select NLQ or 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:
For a page height of 66 lines:
Select user defined paper size and enter the correct values.
Activate text out
If you have problems or want to enable better quality escape codes (bold,italic, 12cpi, 20cpi) you 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 select a driver, standard output will be used.
Microsoft Windows additonal features
With this method, the engine will select the best affordable font for the texts, but the graphic elements and images will be printed also (usually the graphic elements print slow on impact printers).
Note this print method does not output lines, but calls Windows API for any graphic and text operation, and for page size selection, the source of any problem (page displacement, garbage output) is usually the print driver.
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 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.
Page Width=80 characters with/ 10 characters per inches = 8 inchess = 8*2.54 cms = 20.32 cms
Page Height=66 lines / 6 lines per inches = 11 inchess = 11*2.54 cms = 27.94 cms
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..6cms. The characters for font B are 3.3*17=56 at this size. The physical real page width can differ.
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. The characters for font B are 3.3*12=40 at this size. The physical real page width can differ.
For receipt printers you can establish a page length of 11 inchess=27.94 cms. If you don't use page headers-footers, or repeatable group headers, will be just like there was not page breaks, the ticket printer driver does not send form feeds.
To automatically activate a report to print as a text (without driver interaction or filtering) with escape code secuences you can go to page setup, select that the report will be output to the character printer (default EPSON driver) or select the output to ticket printer (default EPSONTMU210 driver).
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 printing the report.
With Microsoft Windows and a good quality print driver installed you can still use the driver to provide fast printing with printer native fonts. You must select the blank text driver and check the Device fonts option.
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 this line), the font step (you can specify a Font Step in the designer) of this text 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). If the text element Font Step indicates By Size value, the engine will use the following table:
Font Size Step cpi<8 20
8 179 15
10 1211,12 1013-15 6>15 5
Set horizontal page size correctly or at least narrower than the real page size (printer capability), if you print a 132 column report in a 80 cols printer, the printer will skip two lines for each report line.
The final output will be a number of lines formatted with the selected driver (escape codes), or 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 Feed.
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 document, so the text go to the printer throught the selected port in printer configuration without processing in the printer driver. If oem option is checked then the text is processed first with CharToOem API function.
Linux
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 processing it, the -l indicates the lpr command to send the file directly to the device without using any print filter, and the -J gives a job title for the printer queue.
Drivers overview
Name
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 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, for example for a 10cpi report set horz. grid to 0.1 inch or 0.254 cms. Also resize the section heights to multiples of 1/6 inch, you can do it automatically by selection the option in Edit menu.
The lines are saved to a temporary file, and using unix like interprocess comunication (pipes) the engine calls lpr command line tool, if oem option is checked then the file is processed first by the recode command line tool.
Description, escape codes
PLAIN
EPSON
No escape codes are introduced , no form feed characters
Init printer, page size, 10cpi, wide escape (5cpi) and condensed escape (17cpi), form feed, underline style
EPSON-MASTER
Init printer, page size,form feed, 5-6-10-12-17-20cpi, underline-bold-italic, all with ESC ! command
EPSON-ESCP
Init printer, page size,form feed, 5-6-10-12-17-20cpi, underline-bold-italic, all with ESC/P compatible commands
EPSON-ESCPQ
Same as EPSON-ESCP but selecting the better quality (slower)
IBMPROPRINTER
Init printer, page size,form feed, 5-6-10-12-17-20cpi, underline-bold-italic, with IBM Proprinter escape commands
EPSONTMU210
Init printer, page size,form feed, 6-12-17cpi, underline-bold, all with ESC ! command, but is capable of printing red color text.
EPSONTMU210CUT
Same as EPSONTMU210 but perform a cut paper command at the end of the document
EPSONTM88II
Init printer, page size, 6-12-17cpi, underline-bold, all with ESC ! command
HP-PCL
VT-100
EPSONTM88IICUT
Same as EPSONTM88II but a cut paper command at the end of the document
Init printer, page size,form feed, 5-6-10-12-17-20cpi, underline-bold-italic, all with HP-PCL compatible commands
Try to emulate VT-100 escape codes
PLAINFULL
Same as plain but without blank spaces or blank lines
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.
If you have problems or want to enable better quality escape codes (bold,italic, 12cpi, 20cpi) you 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 select a driver, standard output will be used.
With this method, the engine will select the best affordable font for the texts, but the graphic elements and images will be printed also (usually the graphic elements print slow on impact printers).
Note this print method does not output lines, but calls Windows API for any graphic and text operation, and for page size selection, the source of any problem (page displacement, garbage output) is usually the print driver.
The graphic elements (drawings and images) are ignored, based on the page size, the number of 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.
usually the font A is 12cpi and font B is 17 cpi, so set a page with of 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.
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. The characters for font B are 3.3*12=40 at this size. The physical real page width can differ.
. If you don't use page headers-footers, or repeatable group headers, will be just like there was not page breaks, the ticket printer driver does not send form feeds.
To automatically activate a report to print as a text (without driver interaction or filtering) with escape code secuences you can go to page setup, select that the report will be output to the character printer (default EPSON driver) or select the output to ticket printer (default EPSONTMU210 driver).
(the engine will send the escape command to the printer), before or after printing the report.
With Microsoft Windows and a good quality print driver installed you can still use the driver to provide fast printing with printer native fonts. You must select the blank text driver and check the Device fonts option.
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 this line), the font step (you can specify a Font Step in the designer) of this text 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). If the text element Font Step indicates By Size value, the engine will use the following table:
Set horizontal page size correctly or at least narrower than the real page size (printer capability), if you print a 132 column report in a 80 cols printer, the printer will skip two lines for each report line.
The final output will be a number of lines formatted with the selected driver (escape codes), or 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 Feed.
A new print document is created with the Windows API, to disable the driver, the document is queued as a RAW type document, so the text go to the printer throught the selected port in printer configuration without processing in the printer driver. If oem option is checked then the text is processed first with CharToOem API function.
The -P printerqueue parameters are omited if the default printer is used. The -r will force deletion 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 filter, and the -J gives a job title for the printer queue.
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 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, for example for a 10cpi report set horz. grid to 0.1 inch or 0.254 cms. Also resize the section heights to multiples of 1/6 inch, you can do it automatically by selection the option in Edit menu.
The lines are saved to a temporary file, and using unix like interprocess comunication (pipes) the engine calls lpr command line tool, if oem option is checked then the file is processed first by the recode command line tool.
If you have problems or want to enable better quality escape codes (bold,italic, 12cpi, 20cpi) you 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 select a driver, standard output will be used.
Note this print method does not output lines, but calls Windows API for any graphic and text operation, and for page size selection, the source of any problem (page displacement, garbage output) is usually the print driver.
The graphic elements (drawings and images) are ignored, based on the page size, the number of 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.
The characters for font B are 3.3*17=56 at this size. The physical real page width can differ.
The characters for font B are 3.3*12=40 at this size. The physical real page width can differ.
. If you don't use page headers-footers, or repeatable group headers, will be just like there was not page breaks, the ticket printer driver does not send form feeds.
the character printer (default EPSON driver) or select the output to ticket printer (default EPSONTMU210 driver).
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 this line), the font step (you can specify a Font Step in the designer) of this text 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). If the text element Font Step indicates By Size value, the engine will use the following table:
The final output will be a number of lines formatted with the selected driver (escape codes), or 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 Feed.
A new print document is created with the Windows API, to disable the driver, the document is queued as a RAW type document, so the text go to the printer throught the selected port in printer configuration without processing in the printer driver. If oem option is checked then the text is processed first with CharToOem API function.
The -P printerqueue parameters are omited if the default printer is used. The -r will force deletion 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 filter, and the -J gives a job title for the printer queue.
. Also set the horz.grid size 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 multiples of 1/6 inch, you can do it automatically by selection the option in Edit menu.
command line tool.
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 this line), the font step (you can specify a Font Step in the designer) of this text 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). If the text element Font Step indicates By Size value, the engine will use the following table:
A new print document is created with the Windows API, to disable the driver, the document is queued as a RAW type document, so the text go to the printer throught the selected port in printer configuration without processing in the printer driver. If oem option is checked then the text is processed first with CharToOem API function.
resize the section heights to multiples of 1/6 inch, you can do it automatically by selection the option in Edit menu.
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 this line), the font step (you can specify a Font Step in the designer) of this text 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). If the text element Font Step indicates By Size value, the engine will use the following 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 #1End Sub