Recommended Operations

Recommended Operations
Recommended Command Order ...................................................................................................... R-4
Set the Printing Area............................................................................................................................ R-5
The printable area ............................................................................................................................ R-6
Setting left and right margins......................................................................................................... R-9
Setting page length......................................................................................................................... R-10
Setting top and bottom margins................................................................................................... R-13
Setting bottom margin................................................................................................................... R-13
Select Characters ................................................................................................................................ R-15
Assign character tables.................................................................................................................. R-15
Defining user-defined characters ................................................................................................ R-17
Planning user-defined characters............................................................................................ R-19
Setting user-defined character traits ....................................................................................... R-22
Copying ROM characters to RAM memory........................................................................... R-24
Storing user-defined character data in printer memory....................................................... R-25
Switching to RAM character printing ..................................................................................... R-36
Selecting an international character set ...................................................................................... R-41
Select a Font ........................................................................................................................................ R-42
Print quality (draft, LQ, or NLQ) ................................................................................................ R-43
Standard and scalable fonts (multipoint mode)........................................................................ R-43
Selecting the character table ..................................................................................................... R-44
Selecting the point size .............................................................................................................. R-45
Selecting the typeface ................................................................................................................ R-47
Selecting the pitch ...................................................................................................................... R-48
Selecting the style....................................................................................................................... R-50
Selecting the weight................................................................................................................... R-51
Enhancements ................................................................................................................................ R-51
Double-strike .............................................................................................................................. R-51
Shadow/outline ......................................................................................................................... R-52
Score ............................................................................................................................................. R-53
Super/subscript ............................................................................................................................. R-54
Select Supporting Features ............................................................................................................... R-55
Selecting unidirectional print head movement ......................................................................... R-55
Selecting print color ....................................................................................................................... R-55
Select the Print Position .................................................................................................................... R-56
Moving the horizontal position ................................................................................................... R-57
Moving the vertical position ........................................................................................................ R-60
Send Print Data................................................................................................................................... R-64
R-1
Sending Graphics Data...................................................................................................................... R-65
Bit-image graphics ..................................................................................................................... R-66
Mixing text and bit-image graphics with ESC/P 2 printers ................................................ R-71
Graphics mode ........................................................................................................................... R-73
Standard raster graphics ........................................................................................................... R-74
Extended raster graphics (ESC . 2) .............................................................................................. R-83
Printing Bar Codes............................................................................................................................. R-84
Extended ESC/P 2 Programming Guide........................................................................................ R-99
MicroWeave technology............................................................................................................ R-99
Monochrome printing support .............................................................................................. R-100
Color bit-image graphics support.......................................................................................... R-100
ESC/P 2 color multipoint font support ................................................................................ R-100
ESC/P 2 MicroWeave color raster graphics and RLE compressed raster graphics........ R-101
ESC/P 2 MicroWeave color extended raster graphics—TIFF............................................ R-101
Programming examples .............................................................................................................. R-104
Example 1: ESC/P 2 color multipoint font driver............................................................... R-104
Example 2: MicroWeave ESC/P 2 standard color raster graphics and RLE compressed
raster graphics driver............................................................................................................... R-105
Example 3: MicroWeave ESC/P 2 extended color raster graphics and TIFF compressed
raster graphics driver............................................................................................................... R-107
R-2
This section describes the recommended method and order of performing
operations on an EPSON dot matrix printer. An outline of recommended
operation order is provided first, followed by detailed explanations of each
operation.
Basic recommendations are provided for printers featuring ESC/P 2. You should
follow these recommendations if you are writing programs for ESC/P 2 printers.
In addition, this section provides information on newly added ESC/P 2
commands, known as extended ESC/P 2, as well as programming examples for
EPSON’s high-resolution (up to 720 by 720 dpi) color printer models.
Where necessary, additional explanations are included for 24/48-pin printers at
previous ESC/P levels, as well as for 9-pin printers. Although ESC/P 2 printers
can operate using software written for earlier printers (if deleted and
nonrecommended commands are avoided), you should use the ESC/P 2 level
explanations to take full advantage of advanced ESC/P 2 features.
R-3
Recommended Command Order
Because some command results change based on the settings made with other
commands, you should send commands and data in the order described in this
section.
Once you set the printing area and page length, send data line by line from top to
bottom of each page. The printer can handle data most efficiently when received
in this order (although commands can move the vertical print position both up
and down on a page). The exception to this rule is when printing bit-image
graphics and characters on the same line, as described in “Mixing text and bitimage graphics.”
The following order is applicable to all ESC/P levels.
1.
Send an ESC @ command to initialize the printer.
2.
Set the unit of line spacing to the minimum vertical increment necessary.
3.
Set the printing area.
4.
Assign character tables to each of the four active tables as necessary (ESC/P 2
printers only).
5.
Define any user-defined characters.
6.
Select the font.
7.
Set supporting features.
8.
Set the print position.
9.
Send one line’s print data.
10. End the line of data with a CR and LF command.
11. Repeat steps 6 to 10 as necessary for each following line on the page.
12. End the page with a FF command.
13. Repeat steps 6 to 12 as necessary for each following page (always send a FF
command after the final page also).
14. End printing by sending the ESC @ command.
See the following sections in this chapter for additional information on the above
steps.
R-4
Recommended Command Order
Set the Printing Area
The method of setting the printing area differs between ESC/P 2 and former
ESC/P levels. Both methods are described in the following sections.
ESC/P 2
With ESC/P 2, the following commands allow for improved page layout control:
•
ESC ( U Set unit
This command sets the unit for horizontal and vertical movement and
measurement. You can use this command to set the unit as small as 1/360
inch, allowing for precise page layout measurement.
•
ESC ( C Set page length
The page length is based on the unit set with the ESC ( U command.
•
ESC ( c
Set page format
Based on the unit in ESC ( U, you can use this command to set the top and
bottom margins. Because you can now set a top margin, the settings you
make for the page actually match the physical page.
Because you can set the top and bottom margins for single-sheet paper, you
can handle single-sheets the same as continuous paper.
Manually fed single sheets are now treated the same as paper fed from a cutsheet feeder (cut-sheet feeder mode has been eliminated).
ESC/P 2
ESC/P
9-Pin ESC/P
Set the print area as follows:
1.
Set the left and right margins.
2.
Set the page length.
3.
Set the top and bottom margins
ESC/P 2 printers
Set the bottom margin only
Non-ESC/P 2 printers
(continuous paper only)
Set the Printing Area
R-5
The printable area
ESC/P 2
ESC/P
9-Pin ESC/P
The printable area for continuous and single-sheet paper is shown below.
Single sheets (also envelopes and
single-type multipart forms)
Continuous paper
*8.5 mm
Printable
area
Printable
area
9 mm
9 mm
**13.5 mm
3 mm
3mm
*, ** The nonprintable area varies
on some printer models.
(See Feature Summary for
details.)
3 mm
3mm
Printable
area
Note:
• Make sure your program keeps printing within this area; otherwise, print
quality cannot be assured.
•
R-6
Make sure the margins stay within the printable area. The area within these
margins is called the printing area.
Set the Printing Area
The following diagram shows the printing area for single-sheet and continuous
paper.
ESC/P 2
Single sheets
Continuous paper
Printing area = logical paper length
Physical paper length = logical paper length
Actual
page
length
ESC/P
Printing
area
Page length
setting in printer
Actual
page
length
Printing
area
Page length
setting in printer
9-Pin ESC/P
Single sheets
Continuous paper
Manual feed
Physical page length = logical page length
(same as continuous forms)
Physical page length = local page length
Actual
page
length
Printing
area
Page length
setting in printer
Actual
page
length
Printing
area
Page length
setting in printer
Cut-sheet feeder
Logical page length = printable area
Actual
page
length
Printing
area
Page length
setting in printer
Set the Printing Area
R-7
The printing area in ESC/P 2 differs for text and graphics printing.
If the point size is larger than 10.5 points, and the print position is near the top or
bottom-margin position, part of the character may print outside the printing area
(above the top-margin or below the bottom-margin). The printer prints the full
character, even though it falls outside the printing area, with the following
exception:
If part of the character falls outside the printable area on single-sheet paper
(closer than 8.5 mm to the top edge or closer than 13.5 mm to the bottom
edge), printing of that part is not assured.
When setting the vertical print position, you must place enough room at the top
and bottom of a page for a full character to print.
The following diagram illustrates the differences between graphics and character
printing areas near the top and bottom-margin positions.
Characters
Graphics
20/180 inch
Nonprintable area
Top-margin position
Baseline
19/180 inch
Bottom-margin position
Baseline
Nonprintable area
8 mm
(0.33 inch)
13.5 mm
(0.53 inch)
Note:
• You can print characters outside the top and bottom-margin positions as long
as the vertical print position is within the printing area. However, character
printing within the nonprintable area is not assured; parts of characters may
be cut off.
•
R-8
You cannot print any part of graphics outside the top and bottom-margin
positions.
Set the Printing Area
Setting left and right margins
ESC/P 2
ESC/P
9-Pin ESC/P
Use the ESC l command to set the left margin and the ESC Q command to set the
right. The format of these commands is as follows:
ESC l m
ESC Q m
The m parameter equals the number of characters from the left-most
mechanically printable position, in the current character pitch.
The following commands affect the character pitch (see individual commands in
the Command Summary for details):
ESC P
Selects 1/10-inch character width (10 cpi)
ESC M
Selects 1/12-inch character width (12 cpi)
ESC g
Selects 1/15-inch character width (15 cpi)
ESC W 1
Doubles the current character width
ESC p 1
Selects proportional spacing. When setting the
margins, the character width is considered to be 1/10
inch
ESC SP n
Adds extra space between each character (n/180 inch
for LQ characters and n/120 inch for draft characters
on 24/48-pin printers; n/120 inch on 9-pin printers).
The resulting character width is:
(current character width) = (previous character width) + (extra
space)
SI
Selects condensed printing, resulting in the following
character widths:
1/17 inch if 10-cpi is currently selected
1/20 inch if 12-cpi is currently selected
ESC c
Sets the character pitch to between 1/360 and 3
inches (available only on ESC/P 2 printers)
ESC X
Sets pitch and point of scalable fonts (available only
on ESC/P 2 printers).
Note:
• Once the margins are set, changing the character width does not affect the
margins.
Set the Printing Area
R-9
•
The margins must be set at the beginning of the line (before any printable
data is sent); otherwise, the printer ignores any data preceding these
commands.
•
Always set pitch before setting left and right margins. Do not assume what
the pitch setting will be.
The diagram below shows the margins set by sending the following commands
when 8 1/2-inch wide paper is used and the left edge of the paper is at the leftmost mechanically printable position.
ESC @
Resets printer settings
ESC P
Selects 10-cpi printing (character width of 1/10 inch)
ESC l 10
Sets a 1-inch left margin
ESC Q 75
Sets a 1-inch right margin
Margin diagram
8 1/2 inches
10 characters
75 characters
1 inch
1 inch
Setting page length
Because the method of page handling is different, the method for setting the page
length differs for ESC/P 2 and previous ESC/P versions. This section explains
both methods.
ESC/P 2
The ESC/P 2 method of setting the page length allows you to use the same
program for both single-sheet and continuous paper.
The page length setting is effective only when you are using continuous paper.
However, since the printer ignores the setting during single-sheet printing, the
printer is always ready to print on either type of paper.
R-10
Set the Printing Area
For single sheets, the printer calculates the page length as the distance between
the top and bottom margins.
Single sheets
Page length
setting in
printer
Printing
area
Continuous paper
Actual
page
Printing area
Page length
setting in
printer
Also, to simplify movement of the horizontal and vertical print position, ESC/P 2
provides the ESC ( U command for setting the unit of movement and
measurement. The page length is set with the ESC ( C command, based on this
unit.
Always set the unit before setting the page length. The unit can be set as small as
1/360 inch; set the unit to the minimum size necessary for vertical and horizontal
movement within the current print job.
Note:
• Always set the page length before paper is loaded or when the print position
is at the top-of-form position. Otherwise, the current print position becomes
the top-of-form position, results in undesirable contradictions between the
actual and logical page settings.
•
Setting the page length cancels any previously set top or bottom margins.
•
The maximum page length is 22 inches.
•
Changing the unit after the page length has been set does not affect the page
length.
The following commands set the page length to 11 inches, based on a unit of
1/360 inch.
ESC ( U 1 0 10
Sets a unit of 1/360 inch
ESC ( C 2 0 120 15
Selects a page length of 11 inches (3,960 units)
Set the Printing Area
R-11
ESC/P
9-Pin ESC/P
For non-ESC/p 2 printers, set the page length with the following commands:
ESC C
Sets the page length in lines, according to the
currentline spacing
ESC C NUL
Sets the page length in 1-inch increments
To set the page length in lines, you must first set the line spacing. The maximum
number of lines you can set with the ESC C command is 127.
Use the following commands to set the line spacing:
ESC 2
Selects 1/6-inch line spacing
ESC 0
Selects 1/8-inch line spacing
ESC + n
Selects n/360-inch line spacing (24/48-pin printers
only)
ESC 3 n
Selects n/180-inch line spacing (24/48-pin
printers)Selects n/216-inch line spacing (9-pin
printers)
Note:
• Always set the page length before paper is loaded or when the print position
is at the top-of-form position. Otherwise, the current print position becomes
the top-of-form position, which results in undesirable contradictions between
the actual and logical page settings.
•
Setting the page length cancels any previously set bottom margin.
•
The maximum page length is 22 inches.
•
Changing the line spacing after the page length has been set does not affect
the page length.
•
Always set the line spacing before setting the page length with the ESC C
command. Do not assume what the line spacing will be.
The following commands select 1/6-inch line spacing and a page length of 11
inches (66 lines).
ESC 2
Selects 1/6-inch line spacing
ESC C 66
Sets a page length of 11 inches (66 lines)
The following command also selects a page length of 11 inches.
ESC C NUL 11
R-12
Set the Printing Area
Sets a page length of 11 inches
Setting top and bottom margins
ESC/P 2
ESC/P 2 provides the ESC ( c command for setting both top and bottom margins.
This allows the printing area settings to match the actual paper.
The top and bottom margin settings are based on the unit defined with the ESC (
U command. If using continuous paper, you should have already defined this
unit when you set the page length with the ESC ( c command. If not, see the
description of the ESC ( U command in the Command Summary and “Setting the
page length” in this section.
Note:
• Measure top and bottom margins from the top edge of the page.
•
The distance from the top edge of the page to the bottom-margin position
must be less than the page length; otherwise, the end of the page length
becomes the bottom-margin position.
•
Setting the top and bottom margins cancels previous top or bottom-margin
settings.
•
Changing the defined unit does not affect previously set top and bottommargin settings.
•
Always set the top and bottom margins before paper is loaded or when the
print position is at the top-of-form position. Otherwise, the current print
position becomes the top-of-form position (this results in undesirable
contradictions between the actual and logical page settings).
The following command sets a top and bottom margin of 1 inch when the unit is
defined as 1/360 inch and 8 1/2 by 11-inch paper is used.
ESC ( c 4 0 104 1 16 14
Sets a top margin of 1 inch (360 units) and a bottom
margin 10 inches (3,600 units) below the paper’s top
edge.
Setting bottom margin
ESC/P
9-Pin ESC/P
When using continuous paper on non-ESC/P 2 printers, set the bottom margin
with the ESC N command. The printer then automatically moves the print
position to the top-of-form position of the next page when it receives a FF
command, or when the print position moves below the bottom-margin position.
The ESC N command sets the bottom margin in lines above the top-of-form
position of the following page; you must first set the line spacing.
Set the Printing Area
R-13
Use one of the following commands to set the line spacing:
ESC 2
Selects 1/6-inch line spacing
ESC 0
Selects 1/8-inch line spacing
ESC + n
Selects n/360-inch line spacing (24/48-pin printers
only)
ESC 3 n
Selects n/180-inch line spacing (24/48-pin
printers)Selects n/216-inch line spacing (9-pin
printers)
Note:
• Sending the ESC N command cancels any previous top or bottom margin
setting.
•
The bottom margin set with the ESC N command is ignored when printing
on single sheets.
•
Avoid using this command with ESC/P 2 printers. By using ESC/P 2’s ESC (
c command instead, the bottom margin is effective for both single-sheet and
continuous paper.
•
The distance from the top edge of the page to the bottom-margin position
must be less than the page length.
•
Use the ESC O command to cancel the bottom margin.
•
Always set the line spacing before setting the bottom margin with the ESC N
command. Do not assume what the line spacing setting will be.
The following commands set a bottom margin of 1 inch when 8 1/2 by 11-inch
paper is used (assuming the top-of-form position is at the perforation between
pages).
R-14
ESC 2
Selects 1/6-inch line spacing
ESC N 6
Sets a bottom margin 1 inch (6 lines) above the next
page’s top-of-form position.
Set the Printing Area
Select Characters
ESC/P 2
ESC/P
9-Pin ESC/P
Character size and variation have been greatly increased in ESC/P 2. In addition
to the basic 10.5-point characters and enhancements available in previous ESC/P
versions, scalable font capability allows for the selection of fonts based on point
size and five other font attributes. Point size can be selected from 8 to 32 points,
in two-point increments.
Also, an increased number of built-in character tables allows access to characters
and symbols not previously available.
The following sections explain how to select characters on all EPSON printers.
Differences between ESC/P 2 and previous ESC/P versions are explained when
necessary.
To select characters, follow the command order outlined below:
1.
Use the ESC ( t command to assign character tables you plan to use to one of
the four active tables selectable with the ESC t command (ESC/P 2 printers
only).
2.
Define any user-defined (download) characters you plan to use.
3.
Select the international character set you plan to use.
By making all the above settings, you have defined the initial characters. See the
following sections for details on making each of these settings.
Assign character tables
ESC/P 2
On ESC/P 2 printers, a greater variety of characters is available because of an
increased number of built-in character tables.
Previous versions of ESC/P allowed selection of an italics and graphics character
table with the ESC t command. ESC/P 2 has expanded on this by allowing access
to four active character tables with the ESC t command. Also, you can assign any
of the numerous built-in (registered) character tables to these four active tables.
Select Characters
R-15
The ESC/P 2 command for assigning these tables is ESC ( t. The diagram below
illustrates this process.
Registered
Active Table
Table 0
Current
Table
ESC t n
Table 1
Table 2
Table 3
ESC ( t 3 0 n d2 d3
d2
0
1
.
.
8
9
.
.
112
d3
0
0
.
.
0
0
.
.
0
Italic
PC437
PC863
PC865
OCR-B
Note:
• You always assign the tables at the beginning of a print job; do not assume
what the settings are.
•
You can reassign any of the tables at any time, without affecting other table
assignments.
•
Do not assign a registered table to Table 2 if you plan to use it for userdefined characters. Once you assign a registered table to Table 2, you must
reset the printer (with the ESC @ command) before you can use it for userdefined characters.
The following commands assign character tables to active tables 0 to 3.
R-16
ESC ( t 3 0 0 0 0
Assigns the italic table to active Table 0.
ESC ( t 3 0 1 1 0
Assigns the PC437 (US) table to active Table 1.
ESC ( t 3 0 2 8 0
Assigns the PC865 (Canada-French) Table to active
Table 2.
ESC ( t 3 0 3 3 0
Assigns the PC850 (Multilingual) table to active
Table 3.
Select Characters
Defining user-defined characters
ESC/P 2
ESC/P
9-Pin ESC/P
With the user-defined character function you can design your own characters
and save them in the printer’s memory for repeated use in a print job.
The printer has two types of character memory: ROM and RAM. The printer
stores its built-in character sets in ROM memory; you cannot modify ROM
memory. You can modify RAM memory, however, in two ways: you can copy
characters from ROM memory and you can save user-defined characters.
The general method of defining characters (sometimes called downloading) is
basically the same with all EPSON dot-matrix printers. However, the method of
accessing user-defined characters depends on the ESC/P version. This section
explains the basic process while describing the differences when necessary.
Note:
You can only print user-defined characters as 10.5-point characters (or 21-point
characters when double-height printing is selected). Even if you select a different
point size with the ESC X command, characters in RAM can only be printed as
10.5 or 21-point characters.
The steps below should be followed to create user-defined characters.
1
2
Plan the data for your desired characters. The amount of data required
depends on the following factors:
−
The number of dots in the print head (9 or 24/48)
−
The space you specify on the left and right of each character
−
Character spacing (10 cpi, 12 cpi, 15 cpi, or proportional)
−
The size of your characters (normal or super/subscript)
−
The print quality of your characters (draft, LQ, or NLQ mode)
Cancel italics with the ESC 5 command and set the following traits of the
characters you plan to define:
−
Print quality
−
Size (either normal or super/subscript)—24/48-pin printers only
−
Proportional or fixed character spacing—24/48-pin printers only
Select Characters
R-17
3
The printer stores user-defined characters in RAM memory; you must tell the
printer to find characters in RAM memory if you want to print user-defined
characters. If you plan to use many of the standard characters along with
your user-defined characters, use the ESC : command to copy the currently
selected character table to the printer’s RAM memory. This allows you to
print user-defined characters without having to switch from ROM to RAM
characters and back again each time.
4
Define and send the data to the printer’s RAM memory using the ESC &
command.
5
Switch to RAM characters. The printer then uses the user-defined characters
when printing text.
Note:
• On 24/48-pin printers, you can use the ESC t 2 command to copy character
data (including user-defined characters) from codes 0 to 127 to codes 128 to
255. This is desirable if you wish to print codes between 0 and 127 as usual
while having access to user-defined characters.
•
R-18
If you plan to use the ESC t 2 command to access user-defined characters on
an ESC/P 2 printer, make sure you do not assign a registered character table
to active Table 2 with the ESC ( t command. Once you have assigned a
registered table to Table 2, you cannot use it for user-defined characters (until
you reset the printer with the ESC @ command).
Select Characters
Planning user-defined characters
ESC/P 2
ESC/P
9-Pin ESC/P
User-defined characters are defined based on a combination of several traits. This
combination of traits determines the number of dots that can be defined (and the
amount of data that must be sent) for each character.
These traits, and the maximum recommended size for each combination of traits
is shown in the table below. Exceeding the width for the following fixed pitches
may not allow for sufficient spacing between characters.
24/48-pin printers (height × width)
Traits
Draft
fixed-pitch
LQ
fixed-pitch
proportional
super/subscript
super/subscript, proportional
Recommended size
24 × 12 (10 cpi)
24 × 10 (12 cpi)
24 × 8 (15 cpi)
24 × 36 (10 cpi)
24 × 30 (12 cpi)
24 × 24 (15 cpi)
24 × 37
16 × 36 (10 cpi)
16 × 30 (12 cpi)
16 × 24 (15 cpi)
16 × 37
9-pin printers (height × width)
Traits
Recommended size
Draft
8 × 11
NLQ
18 × 12
Note:
For 9-pin printers, NLQ user-defined characters are available only on LX-series
printers.
Select Characters
R-19
The diagrams below show the planning grids for LQ, NLQ, and draft mode
characters.
24/48-pin
15 cpi
12 cpi
10 cpi
Proportional
LQ
15 cpi
15 cpi
12 cpi
10 cpi
Proportional
12 cpi
10 cpi
Super/Subscript
Draft
9-pin
12 cpi
10, 12 cpi
NLQ
R-20
Select Characters
10 cpi
Draft
Follow the steps below to plan a user-defined character.
1.
First determine the type of characters you wish to define (for example, 24pin, LQ-mode, 12-cpi characters).
2.
Consult the chart above for the maximum recommended dot-matrix size for
your selected characters (the maximum for the example in step 1 is 24 dots
high × 30 dots wide).
3.
On the appropriate grid for your chosen character attributes, fill in the dots
you wish to print to form your character. Keep the following restrictions in
mind:
−
You cannot print consecutive horizontal dots on 24-pin printers, or in
draft-mode on 9-pin printers. The printer ignores the second of any
consecutive horizontal dots. For example, the printer ignores the dots
circled below.
−
If you are defining proportional, LQ characters on 24-pin printers, you
need to define the space to the left and the right when you send the
characters to the printer.
−
In the built-in character sets the character baseline is as follows:
24-pin printers
Pin number 20
9-pin printers (draft)
Pin number 7
(NLQ)
Dot number 14 in the 18-dot column
Select Characters
R-21
Setting user-defined character traits
Before you can define and save your user-defined characters, you must change
the printer settings to match your planned characters. The following
combinations of character traits are possible.
24 /48-pin printers
Print quality
Draft
LQ Normal size
Super/Subscript
9-Pin printers
Print quality
Draft
NLQ
Proportional
3
3
Fixed pitch
3
3
3
3
3
Note:
You should not store characters in RAM memory when the printer is set to italic
printing (with the ESC 4 command). Always send the ESC 5 command to cancel
italic printing before you define user-defined characters or copy characters to
RAM memory.
Follow the steps below when setting the traits of your planned user-defined and
other RAM characters. (Only steps 1 and 2 are necessary for 9-pin printers.)
R-22
1.
Select the print quality: LQ, NLQ, or draft.
2.
Cancel italic printing.
3.
Select or cancel proportional spacing.
4.
Select or cancel super/subscript characters.
Select Characters
The following commands are used to select the traits for your planned characters.
ESC x 1
Selects LQ-mode or NLQ-mode
ESC x 0
Selects draft
ESC S 0
Selects superscript
ESC S 1
Selects subscript
ESC T
Cancels super/subscript
ESC 5
Cancels italic printing
ESC p 1
Selects proportional spacing
ESC p 0
Cancels proportional spacing
Note:
• Always set or cancel all attributes; don’t assume what the current settings are.
•
Once you have set the desired attributes, copy the ROM characters to RAM (if
necessary) and define all user-defined characters before changing the
attributes again. If you change the attributes and then define additional userdefined characters, the printer clears all characters previously in RAM
memory.
Select Characters
R-23
Copying ROM characters to RAM memory
ESC/P 2
ESC/P
9-Pin ESC/P
You must tell the printer where to find characters: either in the ROM memory (for
built-in characters) or in the RAM memory (for user-defined characters). Each
time you want to print a user-defined character, you must switch to RAM
memory.
You may plan on using many of the standard characters along with your userdefined characters. If so, you can avoid having to switch between ROM and
RAM memory each time by copying the characters from the printer’s ROM
memory to its RAM memory. The ESC : command performs this function.
When you send the ESC : command, the printer copies all the characters from
locations 0 to 127 in the currently selected typeface to the same locations in RAM
memory. You can then store your user-defined characters and still print all the
other characters (except those you redefine) without having to switch back and
forth between RAM and ROM memory each time.
Keep the following in mind when copying ROM characters to RAM memory.
R-24
•
On some printers, you can specify which typeface to copy to RAM memory;
see ESC : in the Command Summary and Command Table sections.
•
You can only define 10.5-point characters. Even if you select a different point
size with the ESC X command, characters in RAM can only be printed as
10.5-point characters (or as 21-point characters if double-height is selected).
•
Sending the ESC : command erases any characters that are currently stored in
RAM. Always copy ROM characters to RAM before you define user-defined
characters. (You cannot copy ROM characters to RAM during multipoint
mode.)
•
The RAM memory can only store characters of one type at the same time. If
you define subscript user-defined characters when normal height characters
are stored in RAM memory, for example, the printer erases all previously
stored characters. Always set the desired character traits before copying
characters (both ROM and user-defined characters).
•
Characters copied from ROM to RAM with the ESC : command must have
the same traits as the user-defined characters you plan to define. If you define
user-defined characters with different traits, the printer erases all previous
characters in RAM memory.
•
Defining user-defined characters clears any characters previously at that
character code location.
•
To print characters in RAM, you must first copy characters with the ESC :
command or define characters with the ESC & command. The printer ignores
commands that would print characters that have not been defined; nothing
will be printed.
Select Characters
Storing user-defined character data in printer memory
ESC/P 2
ESC/P
9-Pin ESC/P
Once you have set the neccessary traits for your characters (and copied the ROM
characters to RAM memory, if desired), you can define and store your userdefined characters.
The following sections cover 9 and 24/48-pin printers. Since the command
format is different for 9-pin printers, the explanation in “Sending user-defined
characters to the printer” is divided into a 24/48-pin section and a 9-pin section.
Follow the steps below to define user-defined characters.
1.
Prepare the data for each character you wish to define(including space to the
left and right of each character).
2.
Decide where to store your user-defined characters in RAM memory.
3.
Use the ESC & command to define the characters in RAM memory.
Preparing data
1.
First divide the grid of your planned character into columns. The height and
number of columns depend on the traits of the characters you are defining.
24-pin normal height
24-pin super/subscript
Select Characters
R-25
9-pin draft
2.
Divide each column into the following groups, depending on character and
printer traits.
24-pin normal height
3 goups of 8 dots
R-26
9-pin NLQ
Select Characters
24-pin super/subscript
2 groups of 8 dots
9-pin draft
1 goup of 8 dots
3.
9-pin NLQ
2 groups of 8 dots, 1 group of 2 dots
Each group of dots is represented by a byte of data, and each dot within that
group has a value as shown below. Add up the value of each dot in the
group; the result is the value for the byte of data.
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
l
Ù
32
64 l
l
Ù
4
l
Ù
1 Total 37
l
Ù
Ù
64
32
l
Ù 128
l
l
Ù
Ù
l
Ù
16
8
1 Toal 153
16
l
l
16
Ù
1 Total 17
Ù 128
8 l
Ù
8
4 l
Ù
4
128
64 l
32
16
8
4 l
2
1
Ù
64
Ù
4
Total 68
2
l
l
Ù
Ù
8
4
1
Total 140
24-pin normal height
(byte values are the same
for super/subscript)
Total 76
9-pin draft
128
64 l
Ù
64 Total 64
9-pin NLQ
Select Characters
R-27
4.
Determine the value of the data bytes for all the columns in your design. The
printer requires data in the order shown below.
1
2
3
4
5
6
7
2
3
5
2
4
6
8
9
24-pin normal height
1
1
3
9-pin draft
24-pin super/subscript
1
4
7
2
5
8
3
6
9
9-pin NLQ
Note:
The printer must receive complete columns of data. In other words, the number
of bytes received must be a multiple of 3 for normal-height characters (on 24/48pin printers) and 9-pin NLQ characters, or a multiple of 2 for super/subscript
characters. Draft 9-pin character columns are only 1-byte high.
R-28
Select Characters
Deciding where to store data
On 24/48-pin printers, you can copy characters directly into RAM memory in
character locations 0 to 127. You can also use the ESC t 2 command to copy the
characters you have defined to locations 128 to 255; then you can print all
characters, including those at locations normally treated as control codes. See
“Switching to RAM character printing” for details.
Select Characters
R-29
On most 9-pin printers, you can copy directly to 241 of the 256 RAM memory
locations (you can copy only 6 characters on LX printers, from locations 58 to 63).
The following diagram illustrates the memory locations available.
The printer normally treats some of these codes as control codes. To print
characters you store in these locations, see “Switching to RAM character
printing” later in this section.
R-30
Select Characters
Sending user-defined characters to the printer
ESC/P 2
ESC/P
For 24/48-pin printers, use the ESC & command to send user-defined data to the
printer. The format of the command is:
ESC & NUL n m [a0 a1 a2 d0 d1 d2 . . . dk]
The value for n is the location of the first consecutive character you wish to
redefine; m is the last character. See the ASCII character table in the Appendix for
the order of the characters. To define just one character, n is the same as m.
Parameter a0 specifies the number of blank columns to the left of the character
and a2 the blank columns to the right. The value for a1 specifies the width of the
character you are defining in dot columns.
Repeat the data within the brackets for each character you are defining. You must
send a0, a1, and a2 for each character you define. After sending a0, a1, and a2, send
the actual dot data for each character, as described in “Preparing data.”
The following example replaces the + character with the following user-defined
character:
First set the traits. For this character, define a normal height, fixed-pitch, LQmode character. The following commands set the traits (see “Setting user-defined
character traits”):
ESC x 1
Selects LQ mode
ESC p 0
Cancels proportional spacing
ESC T
Cancels super/subscript
ESC 5
Cancels italic printing
Next, send the data for the character.
The character code of the character being replaced (+) is 43. Set n and m to 43.
Select Characters
R-31
Since you will not add any space to the left or right of the character, set the a0 and
a2 parameters to 0. Since the character width is 34 columns, set a1 equal to 34.
Then send the dot data.
The resulting command is as follows:
ESC & 0 43 43 0 34 0
The data (102 bytes) is as follows
0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 31, 255, 224,
32, 0, 16, 31, 255, 244, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16,
0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 31, 255, 224, 32, 0, 16, 31, 255,
224, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16, 0, 0, 0, 32, 0, 16
The character is now stored in location 43, the former + location. You can print
the character by switching to RAM printing (see “Switching to RAM character
printing”) and then sending code 43 (the + character).
9-Pin ESC/P
Use the ESC & command to send user-defined data to the printer. The format of
the command is:
Draft characters:
ESC & NUL n m [a d0 d1 d2 . . . dk]
NLQ-mode characters:ESC & NUL n m [0 a 0 d0 d1 d2 . . . dk]
The value for n is the location of the first consecutive character you wish to
redefine; m is the last character. See the ASCII character table in the Appendix for
the order of the characters. To define just one character, n is the same as m.
Parameter a is called the attribute byte; the purpose of the attribute byteis
different for draft and NLQ characters. Both explanations are included below.
The attribute byte for draft 9-pin characters
With draft 9-pin characters, the attribute byte sets the following parameters of the
character you are defining:
•
•
The pin group (the upper 8 pins or the lower 8 pins
−
Select the upper 8 pins if your character has no descenders.
−
Select the lower 8 pins if your character has descenders.
The beginning column (during proportional spacing)
−
R-32
Select Characters
The ending column (during proportional spacing)
This information is stored within the attribute byte as shown below.
bit value:
vit number:
128 64 32 16
7 6 5 4
8
3
4
2
2
1
1
0
end column number
start column number
pins to use
To determine the value of the attribute byte, add up the numbers for the
parameters you wish to set.
Attribute byte table
Beginning Column
Column
Value
number
0
0
1
16
2
32
3
48
4
64
5
80
6
96
7
112
Ending Column
Column
Value
number
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
Upper/Lower 8 pins
Pin group
Value
Upper 8 pins
Lower 8 pins
128
0
Note:
• The beginning column and ending column settings are only used during
proportional spacing. During proportional spacing, the columns to the left of
the beginning column and to the right of the ending column are cut off.
•
Proportional spacing is not available on LX-series printers.
For example, to define a character that begins in column 2 and ends in 9 (during
proportional spacing) and is printed with the upper 8 pins, determine the
attribute byte as follows:
Beginning column is 2
Ending column is 9
Upper 8 pins
Total attribute byte
Value
32
9
128
= 169
You must send an attribute byte for each character you define.
Select Characters
R-33
The attribute byte for NLQ 9-pin characters
With NLQ characters, the attribute byte determines the width of the character
only.
Determine the width of your pattern data in columns (1 to 12) and set the
attribute byte equal to the number of columns. Repeat the data within the
brackets for each character you are defining. You must send an attribute byte for
each character you define.
Examples
The following example replaces the + character with the following 9-pin, draft,
user-defined character:
Note:
Only the characters with codes between 58 and 63 may be user-defined on an LXseries printer.
First set the attributes. The following commands do this (see “Setting userdefined character traits”):
ESC x 0
Selects draft mode
ESC 5
Cancels italic printing
Next, send the data for the character. You must select the beginning and ending
column if you want to use the character during proportional spacing; also, in this
example you will be using the upper 8 pins.
To determine the value of the attribute byte, look at the chart above; your
character starts in column 0 and ends in column 10.
Value
Beginning column is 0
0
Ending column is 10
10
Upper 8 pins
128
Total attribute byte
= 138
Following the attribute byte is the pattern data.
R-34
Select Characters
The resulting command is as follows:
ESC & 0 43 43 169
The data (11 bytes) is as follows:
130, 0, 130, 124, 130, 0, 130, 124, 130, 0, 130
The command is now stored in location 43, the former + location. You can print
the character by switching to RAM printing (see the following section) and then
sending code 43 (the + character).
The following example replaces the = character with the following 9-pin NLQ
user-defined character:
First set the attributes. The following commands do this (see “Setting userdefined character traits”):
ESC x 1
Selects NLQ mode
ESC 5
Cancels italic printing
Next, send the data for the character. Since this is an NLQ character, you must set
the attribute byte to equal the character width. In this case, the width is 12
columns.
Send the pattern data following the attribute byte. The resulting command is as
follows:
ESC & 0 61 61 0 12 0
The data (36 bytes) is as follows:
128, 8, 0, 128, 8, 0, 128, 8, 0, 255, 248, 0, 128, 8, 0, 128, 8, 0, 128, 8, 0, 128, 8,
0,255, 248, 0, 128, 8, 0, 128, 8, 0, 128, 8, 0
The command is now stored in location 61, the former = location. You can print
the character by switching to RAM printing (see the following section) and then
sending code 61 (the = character).
Select Characters
R-35
Switching to RAM character printing
ESC/P 2
ESC/P
9-Pin ESC/P
Once you store user-defined characters in the printer (using the ESC &
command), use the ESC % command to tell the printer to switch to RAM
character printing. The format of the command is as follows:
ESC % 0
Selects ROM characters
ESC % 1
Selects user-defined characters (RAM memory)
After sending the ESC % 1 command, you can print the characters in the memory
locations outlined below:
24/48-pin printer
R-36
Select Characters
9-pin printer
Select Characters
R-37
The method of accessing characters in other areas varies depending on the type
of printer.
There are two ways to access user-defined characters 0 to 31.
ESC/P 2
The first method is available only on ESC/P 2 printers. After changing to RAM
characters with the ESC % 1 command, use the ESC ( ^ command to send
character data. All data sent with the ESC ( ^ command is treated as character
data. See ESC ( ^ in the Command Summary for details.
The table of accessible characters is as follows:
R-38
Select Characters
ESC/P 2
ESC/P
The second method is to select ESC % 0 (ROM character printing) and then send
the ESC t 2 command. ESC t 2 copies all user-defined characters to the upper half
of the character memory, and leaves the lower half as ROM characters. (In other
words, the ESC t 2 command adds 128 to the user-defined character codes.)
Select Characters
R-39
9-Pin ESC/P
The codes between 128 and 159, as well as between 0 and 31, are usually treated
as control codes. Send the ESC I and ESC 6 commands to access characters 128 to
159 and the 18 non-control codes between 0 and 31.
The table of accessible characters then appears as below:
R-40
Select Characters
Selecting an international character set
ESC/P 2
ESC/P
9-Pin ESC/P
You can change up to 12 of the characters in the current character table with the
ESC R command. These 12 characters are called international character sets
because they correspond to characters commonly used in several foreign
languages.
The format for this command is as follows:
ESC R n
The parameter n determines which character set is selected.
The table below shows these characters and their codes in the Helvetica typeface,
as well as the value of the parameter used in the ESC R command to select each
character set.
n
Set name
Dec
35
36
64
91
92
93
94
96
123 124 125 126
Hex
23
24
40
5B
5C
5D
5E
60
7B
7C
7D
7E
0
USA
#
$
@
[
\
]
^
`
{
|
}
~
1
France
#
$
à
°
ç
§
^
`
é
ù
è
¨
2
Germany
#
$
§
Ä
Ö
Ü
^
`
ä
ö
ü
ß
3
UK
£
$
@
[
\
]
^
`
{
|
}
~
4
Denmark l
#
$
@
Æ
Ø
Å
^
`
æ
ø
å
~
5
Sweden
#
¤
É
Ä
Ö
Å
Ü
é
ä
ö
å
ü
6
Italy
#
$
@
°
\
é
^
ù
à
ò
è
ì
7
Spain l
Pt
$
@
¡
Ñ
¿
^
`
¨
ñ
}
~
8
Japan (Eng)
#
$
@
[
¥
]
^
`
{
|
}
~
9
Norway
#
¤
É
Æ
Ø
Å
Ü
é
æ
ø
å
ü
10
Denmark ll
#
$
É
Æ
Ø
Å
Ü
é
æ
ø
å
ü
11
Spain ll
#
$
á
¡
Ñ
¿
é
`
í
ñ
ó
ú
12
Lat America
#
$
á
¡
Ñ
¿
é
ü
í
ñ
ó
ú
13
Korea
#
$
@
[
W
]
^
`
{
|
}
~
64
Legal
#
$
§
°
’
”
¶
`
©
®
†
™
Select Characters
R-41
Select a Font
ESC/P 2
ESC/P
9-Pin ESC/P
ESC/P 2 includes the ESC X command for selecting scalable fonts; differences in
handling scalable fonts are discussed in each section.
The term font is often confused with typeface. Because the electronic printer field
has evolved from basic beginnings, these two terms have often been used
interchangeably.
However, fonts are defined by six attributes:
Attributes
Character table
Point size (height)
Typeface
Pitch (proportional/fixed spacing)
ESC/P 2
ESC t, ESC ( t
ESC X
ESC k
ESC X, ESC c
Style (italics/normal)
Weight (bold/normal)
ESC 4, ESC 5
ESC E, ESC F
Previous ESC/P levels
ESC t
ESC w
ESC k
ESC P, M, g, p, W,
ESC SP, SO, SI, DC2, DC4
ESC 4, ESC 5
ESC E, ESC F
Each time you change one of the above attributes, the printer selects a new font.
If a font matching the selected attributes is not available in the printer’s ROM
memory, the printer manufactures a temporary font with those attributes.
You can set these attributes in any order; changing one attribute does not affect
any other attribute. However, the printer selects fonts internally in the above
order, so using that order is the most efficient.
You can modify each font with several enhancements, as follows:
R-42
Select a Font
Double-strike
ESC G, ESC H
Score
ESC ( -, ESC -
Shadow/outline
ESC q
Print quality (draft, LQ, or NLQ)
ESC/P 2
ESC/P
9-Pin ESC/P
The following attributes are limited during draft printing:
•
Typeface Draft typeface only
•
Point size 10.5 and 21-point sizes only
Use the ESC x command to select the print quality, according to the following
format:
ESC x 0
Selects draft print quality
ESC x 1
Selects LQ print quality for ESC/P 2 and ESC/P
Selects NLQ print quality for 9-Pin ESC/P
Standard and scalable fonts (multipoint mode)
ESC/P 2
ESC/P
9-Pin ESC/P
Both ESC/P 2 and previous ESC/P level printers can print the standard 10.5point fonts. You can modify the point size (height) and pitch of these characters
with the following commands:
Size
SO, ESC W
ESC w
SI
Double-width printing
Double-height printing
Condensed printing
Spacing
ESC P
ESC M
ESC g
ESC p
ESC SP
Select 10 cpi
Select 12 cpi
Select 15 cpi (24/48-pin printers only)
Select proportional spacing
Add additional space between characters
By using ESC/P 2’s ESC X command to enter multipoint mode, you can select
scalable fonts. Scalable fonts allow you to directly specify the point size and pitch
of your characters.
Not all typefaces are available in multipoint mode; see the Command Table for
the typefaces available in multipoint mode on each printer.
Select a Font
R-43
During multipoint mode, sending the commands below results in the following:
Commands ignored
ESC W
Double-width
ESC w
Double-height
ESC SP Additional space
SI
Condensed printing
SO
Double-width
DC2
Cancel condensed
DC4
Cancel double-width
ESC k
(if typeface is not available
in multipoint mode)
Commands that cancel multipoint mode
ESC P
Select 10 cpi
ESC M
Select 12 cpi
ESC g
Select 15 cpi
ESC p
Select proportional
ESC !
Master select
ESC @
Reset
Selecting the character table
Use the ESC t command to select the character table. The format for this
command is as follows:
ESC t n
The parameter n is the number of the character table.
ESC/P 2
With ESC/P 2, you can select from four active character tables. See “Assign
character tables” for details.
Active Tables
Table 0
Current
Table
ESC t n
Table 1
Table 2
Table 3
ESC/P
9-Pin ESC/P
With previous ESC/P versions, you can select from two character tables: italics
and graphics.
Italics
Current
Table
Graphics
The character table is one attribute of the font. Selecting a different character table
selects a different font.
R-44
Select a Font
Selecting the point size
The height of characters is measured in points. One point is equal to 1/72 inch.
Vertical print position
20/72
inch
10.5/72
inch
20-point character
10.5-point character
ESC/P 2
If you plan to use typefaces available in multipoint mode, you can set the point
size with the ESC X command. This command puts the printer in multipoint
mode and sets the point and pitch of the font.
The format of the ESC X command is as follows:
ESC X m nL nH
The m parameter sets the pitch and the nL and nH parameters set the point size,
according to the following formulas:
Pitch
m=0
1
m≥5
the pitch does not change; use this value if you plan to
change only the point size.
proportional spacing is selected.
360
m cpi character spacing
Point size
(point size) =
(nH × 256) + nL
2
If nH and nL both equal 0, the point size does not change; use
these values if you plan to change only the pitch.
Select a Font
R-45
32 points
26 points
20 points
14 points
8 points
30 points
24 points
18 points
12 points
Note:
• Some commands are ignored during multipoint mode and some commands
cancel multipoint mode. See the list in “Standard and scalable fonts
(multipoint mode).”
R-46
•
You can select characters equivalent to previous ESC/P levels by adjusting
the point and pitch with the ESC X command. See the Appendix for details.
•
The baseline of all characters is 20/180 inch below the current vertical print
position. See “Selecting the print position.”
Select a Font
ESC/P 2
ESC/P
9-Pin ESC/P
Non-ESC/P 2 and typefaces not available in multipoint mode
Characters normally have a size of 10.5 points. You can also print 21-point
characters as shown below.
ESC w 1
Selects double-height (21-point) characters
ESC w 0
Selects normal (10.5-point) characters
Selecting the typeface
ESC/P 2
ESC/P
9-Pin ESC/P
Select the typeface using the ESC k command. The parameters for selecting each
available typeface setting are shown below:
Command
ESC k 0
ESC k 1
*ESC k 2
*ESC k 3
*ESC k 4
*ESC k 5
*ESC k 6
*ESC k 7
*ESC k 8
*ESC k 9
Typeface name
Roman
Sans serif
Courier
Prestige
Script
OCR-B
OCR-A
Orator
Orator-S
Script C
Character samples (24-pin)
*Only available on 24/48-pin printers
Note:
Not all typefaces are available in multipoint mode; see the Feature Summary for
the typefaces available in multipoint mode.
Select a Font
R-47
Selecting the pitch
ESC/P 2
ESC/P 2 provides two ways of setting the pitch: the ESC X command and the
ESC c command.
If you plan to use multipoint mode typefaces, you can set the pitch with the ESC
X command. This command puts the printer in multipoint mode and sets the
pitch and point size of the font.
The format of the ESC X command is as follows:
ESC X m nL nH
The m parameter sets the pitch and the nL and nH parameters set the point size,
according to the following formulas:
Pitch
m=0
1
m≥5
The pitch does not change
Proportional spacing is selected
360
m cpi character spacing
Point size
(point size) =
(nH × 256) + nL
2
If nH and nL both equal 0, the point size does not change; use
this value if you plan to change only the pitch.
See the section on proportional character width during multipoint mode in the
Appendix.
Note:
• Some commands are ignored during multipoint mode and some commands
cancel multipoint mode. See the list in “Standard and scalable fonts
(multipoint mode).”
•
R-48
Select a Font
You can select characters equivalent to previous ESC/P levels by adjusting
the point and pitch with the ESC X command. See the Appendix for details.
You can also set the pitch with the ESC c command. This command sets the
horizontal motion index (HMI) in inches per character rather than in cpi. The
format of this command is as follows:
ESC c nL nH
HMI =
(nH × 256) + nL
inch
360
nH = INT
HMI × 360
256
nL = MOD
HMI × 360
256
The HMI set with the ESC c command cancels the pitch set with the ESC X
command.
The following commands cancel the HMI set with the ESC c command:
ESC W
ESC M
ESC SP
SI
SO
DC2
DC4
ESC/P 2
ESC/P
Double-width
Select 12 cpi
Additional space
Condensed printing
Double-width
Cancel condensed
Cancel double-width
ESC P
ESC w
ESC g
ESC p
ESC !
ESC @
ESC X
Select 10 cpi
Double-height
Select 15 cpi
Select proportional
Master select
Reset
Select pitch and point
9-Pin ESC/P
Non-ESC/P 2 printers and typefaces not available in multipoint mode
For previous ESC/P-level printers, as well as ESC/P 2 printers that are not in
multipoint mode, you can adjust the character pitch by setting the following
features:
Proportional spacing
12-cpi character spacing
Condensed printing
Double-width printing
10-cpi character spacing
15-cpi character spacing
Intercharacter spacing
The following commands produce the fixed pitches indicated:
Pitch
5 cpi
6 cpi
7.5 cpi*
10 cpi
12 cpi
15 cpi*
17 cpi
20 cpi
Individual commands
ESC W 1, ESC P
ESC W 1, ESC M
ESC W 1, ESC g
ESC P
ESC M
ESC g
ESC P, SI
ESC M, SI
Master Select
ESC ! 32
ESC ! 33
ESC ! 32, ESC g
ESC ! 0
ESC ! 1
N/A
ESC ! 4
ESC ! 5
*These pitches are not available on 9-pin printers.
Select a Font
R-49
Note:
• When you select the 7.5-cpi and 15-cpi pitches the character height is reduced
on most printers.
•
See ESC ! (the Master Select command) in the Command Summary.
Use the ESC p command to select proportional spacing. In this type of spacing,
the character width varies by character; thin characters like t receive less space
than wide characters like M. The format for this command is as follows:
Individual command Master select
ESC p 1
ESC ! 2
ESC p 0
N/A
Selects proportional spacing
Cancels proportional spacing
See the proportional width table in the Appendix for the exact width of
proportional width characters.
A final way you can adjust the pitch is with the ESC SP command. Use this
command to add a fixed amount of space to the right of every character. The
format of this command is as follows:
ESC SP n
The additional space is either n/120 inch or n/180 inch, depending on the
current printer settings; see ESC SP in the Command Summary for details. This
additional space is added to both fixed-pitch and proportional characters.
Selecting the style
ESC/P 2
ESC/P
9-Pin ESC/P
The term style refers to whether a character is upright or italic. Select the style
attribute with the ESC 4 or ESC 5 commands.
ESC 4
ESC 5
Select italic printing
Cancel italic printing (Select upright printing)
Upright
Italic
Note:
You cannot italicize graphics characters.
R-50
Select a Font
Selecting the weight
ESC/P 2
ESC/P
9-Pin ESC/P
The term weight refers to the thickness (or boldness) of printed lines in a
character. Set the weight attribute with the ESC E and ESC F commands.
ESC E
ESC F
Sets the weight attribute to bold
Sets the weight attribute to normal (cancels bold)
Normal
Bold
Enhancements
ESC/P 2
ESC/P
9-Pin ESC/P
To modify fonts, several enhancements are available: double-strike, shadow,
outline, and scoring.
On 9-pin printers, the only enhancement available is double-strike (only during
draft printing) and single, continuous, and underline scoring.
These are not attributes of a font and do not affect font definition. These
enhancements can be applied to both multipoint and normal fonts.
Double-strike
ESC/P 2
ESC/P
9-Pin ESC/P
The double-strike feature produces bolder printing by striking each dot twice.
The commands for this feature are as follows:
ESC G
ESC H
Selects double-strike printing
Cancels double-strike printing
Note:
On 9-pin printers, NLQ-mode overrides double-strike; double-strike resumes
when the printer returns to draft printing.
Normal
Double-strike
Select a Font
R-51
Shadow/outline
ESC/P 2
ESC/P
The shadow and outline enhancements are available only on 24/48-pin printers.
Normal
Outline
Shadow
Outline and shadow
The command for shadow/outline printing is ESC q; the format is as follows:
ESC q 0
ESC q 1
ESC q 2
ESC q 3
Turn off outline/shadow printing
Turn on outline printing
Turn on shadow printing
Turn on both outline and shadow printing
Note:
This command does not affect graphics characters.
R-52
Select a Font
Score
ESC/P 2
ESC/P
9-Pin ESC/P
Several types of scoring are available on 24/48-pin printers, as shown below:
Note:
You can use the ESC- command to select single, continuous underlining on 9-pin
printers. This is the only type of scoring available on 9-pin printers.
The command for selecting scoring is ESC ( -, and its format and combinations
are as follows:
ESC ( - 3 0 1 n1 n2
n1 = 1
2
3
Underline
Strikethrough
Overscore
n2 = 0
1
2
5
6
Turn off scoring
Single continuous line
Double continuous line
Single broken line
Double broken line
Note:
• Each type of scoring is independent of other types; any combination of
scoring can be set simultaneously.
•
The score is printed in the currently selected print quality and is affected by
the bold and double-strike commands.
•
You cannot score graphics characters.
Select a Font
R-53
Super/subscript
ESC/P 2
ESC/P
9-Pin ESC/P
The super/subscript command prints characters at approximately two-thirds the
currently selected point size.
Superscript characters are printed in the upper two-thirds of the normal character
space; subscript characters are printed in the lower two-thirds.
Super/subscript is available in both normal and multipoint modes.
Following are examples of super/subscript characters.
The commands for super/subscript printing and their format is as follows:
ESC S 1
ESC S 0
ESC T
Selects subscript printing
Selects superscript printing
Cancels super/subscript printing
Note:
• You cannot print graphics characters as super/subscript characters.
R-54
•
See “Proportional character widths” in the Appendix for information on the
proportional width of super/subscript characters.
•
During underline printing, the underline strikes through the descenders on
subscript characters.
•
During multipoint mode, the available point size nearest to two-thirds the
size of the current font is selected for super/subscript characters.
•
If the current point size is 8 points, super/subscript character size is not
reduced.
Select a Font
Select Supporting Features
Other features that affect the appearance of characters and graphics are
unidirectional and color printing.
Selecting unidirectional print head movement
ESC/P 2
ESC/P
9-Pin ESC/P
Normally, printing is bidirectional. Although the print head positions dots very
accurately, print head movement has a slight effect on dot position. This effect is
sometimes noticeable when printing graphics that include continuous vertical
lines or large point-size characters.
To achieve maximum alignment accuracy, use the unidirectional feature. During
unidirectional printing, the print head prints only from left to right.
Select unidirectional printing as follows:
ESC U 0
ESC U 1
Selects bidirectional printing (cancels unidirectional)
Selects unidirectional printing
Selecting print color
ESC/P 2
ESC/P
9-Pin ESC/P
Use the ESC r command to select the print color on printers capable of color
printing.
The format of the ESC r command is as follows:
ESC r 0
ESC r 1
ESC r 2
ESC r 3
ESC r 4
ESC r 5
ESC r 6
Black
Magenta
Cyan
Violet
Yellow
Red
Green
Select Supporting Features
R-55
Note:
• Printers not capable of color printing ignore this command.
•
Other colors are possible by overprinting the above colors. When combining
yellow with other colors, always print yellow dots first (this prevents soiling
of the print side of the ribbon).
•
ESC/P 2 printers can print only black, magenta, cyan, and yellow during
graphics mode.
•
When printing in extended graphics mode selected with the ESC . 2
command, use the binary mode command <COLR> to select the color.
Extended graphics mode is only available on the Stylus COLOR and later
high-resolution printer models. For more information, see “Extended
ESC/P 2 Programming Guide” later in this section.
Select the Print Position
ESC/P 2
ESC/P
9-Pin ESC/P
The definition of the vertical print position differs for text and graphics printing.
Physically, the print position corresponds to the top pin in the print head when
graphics or 10.5-point characters are printed. However, to assure that the baseline
of all characters is the same, the baseline is defined as 20/180 inch (7/72 inch for
9-pin printers) below the vertical print position no matter what point-size
characters you are printing.
Text printing
The baseline of the character is printed 20/180 inch
(7/72 inch for 9-pin printers) below the vertical print
position; the left-most column of the characters is
printed at the horizontal position.
Graphics printing
The print position is the top printable row of dots.
The following diagram illustrates the relationship between the print head and the
text/graphics print position.
Vertical print
position
AgAg
10.5-point characters
R-56
Select Supporting Features
16-point characters
Baseline
Graphics
ESC/P 2
ESC/P 2 has new commands that allow for easier vertical and horizontal
movement of the print position.
These new commands are:
ESC ( U
ESC ( V
ESC ( v
Sets a unit that is used for moving the print position
and setting the page format
Sets the absolute vertical position on the page
Sets the relative vertical position on the page
Horizontal movement is performed with commands available in previous ESC/P
versions. However, now the increment of movement is the unit set with the ESC (
U command.
ESC $
ESC \
Sets the absolute horizontal position
Sets the relative horizontal position
The following sections describe moving the print position, with explanations for
both ESC/P 2 and previous ESC/P versions.
Moving the horizontal position
ESC/P 2
ESC/P
9-Pin ESC/P
The horizontal print position is defined as the position where the left-most
printable column of dots is printed for the next character or graphics design.
When you print characters or spaces, the printer automatically moves the print
position according to the pitch you select (or the width of each character if you
select proportional spacing).
To move the the horizontal print position independent of character printing, the
recommended commands are as follows:
ESC $
ESC \
HT
Set the absolute horizontal position
Set the relative horizontal position
Horizontal tab
The format of the ESC $ command is as follows:
ESC $ nL nH
The resulting horizontal position is determined by the formula below.
(horizontal position) = ((nH × 256) + nL) × (defined unit) + (left margin)

1

 ((horizontal position) − (left−m arg in position)) ×

(
defined
unit
)

nH = INT 


256




Select the Print Position
R-57
1



 ((horizontal position) − (left−m arg in position)) ×
(
defined
unit
)

nL = MOD 


256




The defined unit varies as follows:
ESC/P 2 printers
The unit defined with the ESC ( U command
Non-ESC/P 2 printers 1/60 inch
The format of the ESC \ command is as follows:
ESC \ nL nH
The horizontal position is determined by the formula below.
(horizontal position) = ((nH × 256) + nL) × (defined unit) + (current position)
To move to the right of the current print position

1

 ((horizontal position) − (current position)) ×

(
defined
unit
)

nH = INT 


256





1

 ((horizontal position) − (current position)) ×

(defined unit) 
nL = MOD 


256




To move to the left of the current print position

1

 ((current position) − (horizontal position)) ×

(defined unit) 
nH = 32768 − INT 


256





1

 ((current position) − (horizontal position)) ×

(
defined
unit
)

nL = 32768 − MOD 


256




The defined unit varies as follows:
ESC/P 2 printers
The unit defined with the ESC ( U command
Non-ESC/P2,
24/48-pin printers
LQ mode
1/180 inch
Draft mode 1/120 inch
9-pin printers
1/120 inch
R-58
Select the Print Position
Note:
• These commands have no effect on the vertical print position.
•
The printer ignores commands that would move the print position outside
the left or right margins.
•
Character scoring (underline, overscore, and strikethrough) is not performed
between the current and final print positions when the ESC $ command is
used. Scoring is also not performed if the ESC \ command moves the print
position in the negative direction.
You can also use the tab command to move the horizontal print position to the
next tab position.
First set the tabs with the ESC D command. The format of the ESC D command is
as follows:
ESC D n1 n2 . . . nk NUL
Sets horizontal tab positions (in the current character pitch) at the columns
specified by n1 to nk, as measured from the left-margin position
Note:
• The values for n must be in ascending order; a value of n less than the
previous n ends tab setting (just like the NUL code).
•
Changing the character pitch does not affect current tab settings.
•
Send an ESC D NUL command to cancel all tab settings.
•
The tab settings move to match any movement in the left margin.
•
A maximum of 32 horizontal tabs can be set.
•
The printer does not move the print position to any tabs beyond the rightmargin position. However, all tab settings are stored in the printer’s memory;
if you move the right margin, you can access previously ignored tabs.
•
The printer calculates tab positions based on 10 cpi if proportional spacing is
selected with the ESC p command.
•
Sending the ESC D command clears any previous tab settings.
Sending the HT command moves the print position to the next tab position to the
right of the current position.
Note:
• The HT command has no effect on the vertical print position.
•
The printer ignores an HT command that would move the print position
outside (to the right of) the right-margin position.
•
Character scoring (underline, overscore, and strikethrough) is not performed
between the current and final print positions when the HT command is sent.
Select the Print Position
R-59
Moving the vertical position
ESC/P 2
For ESC/P 2 printers, the vertical print position is defined as follows:
•
The position 20/180 inch above the baseline during character printing
•
The position of the top printable row of dots during graphics printing
Note:
When setting the vertical print position, you must place enough room at the top
and bottom of a page for a full character to print.
If the point size is larger than 10.5 points, and the print position is near the top or
bottom-margin position, part of the character may print outside the printing area
(above the top-margin or below the bottom-margin position). The printer prints
the full character, even though it falls outside the printing area, with the
following exception:
If part of the character falls outside the printable area on single-sheet paper
(closer than 8.5 mm to the top edge or closer than 13.5 mm to the bottom edge),
that part is not assured.
Characters
Graphics
Nonprintable area
Top-margin position
Baseline
20/180 inch
Bottom-margin position
Baseline
Nonprintable area
19/180 inch
8 mm
(0.33 inch)
13.5 mm
(0.53 inch)
Note:
• Always set the vertical print position so sufficient room is provided for the
full character to print.
•
R-60
Graphics data falling outside the printing area is ignored.
Select the Print Position
New commands are available in ESC/P 2 that simplify setting the vertical print
position. These commands are:
ESC ( V
ESC ( v
Set absolute vertical print position
Set relative vertical print position
The unit of movement for both these commands is the unit set with the ESC ( U
command. See ESC ( U in the Command Summary and “Setting the page length”
for more information.
The format for the ESC ( V command is as follows:
ESC ( V 2 0 mL mH
The resulting vertical position is determined by the following formula:
(vertical position) = ((m H × 256) + m L) × (defined unit) + (top-margin position)

1

 ((vertical position) − (top−m arg in position)) ×

(
defined
unit
)

m H = INT 


256




1



 ((vertical position) − (top−m arg in position)) ×
(
defined
unit
)

m L = MOD 


256




The format for the ESC ( v command is as follows:
ESC ( v 2 0 mL mH
(horizontal position) = ((m H × 256) + m L) × (defined unit) + (current position)
To move in the positive direction (down the page), the formula is as follows:

1

 ((vertical position) − (current position)) ×

(
defined
unit
)

m H = INT 


256




1


 ((vertical position) − (current position)) ×

(
defined
unit
)

m L = MOD 


256




To move in the negative direction (up the page), the formula is as follows:

 (( c u r r e n t p o s i t i o n) − ( v e r t i c a l p o s i t i o n)) ×
mH = 3 2 7 6 8 − I N T 



256
1


(d e f i n e d u n i t ) 




1

 ((current position) − (vertical position)) ×

(
defined
unit
)

m L = 32768 − MOD 


256




Select the Print Position
R-61
Note:
• These commands have no effect on the horizontal print position.
ESC/P 2
•
The printer ignores the ESC ( v command if it would move the print position
above the top margin.
•
If a command would move the print position below the bottom margin
position, the print position moves to the top-margin position on the following
page.
•
You cannot move the print position more than 179/360 inch in the negative
direction from the current print position.
•
The printer ignores this command under the following conditions:
−
The command would move the print position more than 179/360inch in
the negative direction
−
The command would move the print position in the negative direction
after a graphics command is sent on the current line
−
The command would move the print position in the negative direction
beyond the position of any previous graphics printing
9-Pin ESC/P
For Non-ESC/P 2 printers, the vertical position is defined as follows:
•
The position 20/180 inch (7/72 inch for 9-pin printers) above the baseline
during character printing
•
The position of the top printable row of dots during graphics printing
The following commands are recommended for moving the vertical print
position within a page.
ESC J
LF
Advance the print position vertically
Line feed
The format for the ESC J command is as follows:
ESC J n
This command moves the paper forward according to the following formula.
24/48-pin printers
9-pin printers
(distance down) = n/180 inches
(distance down) = n/216 inches
This command has no effect on the horizontal print position.
The LF command affects both the vertical and horizontal positions. Sending the
LF command performs the following functions:
R-62
•
Moves the print position one line forward in the currently selected line
spacing
•
Moves the horizontal print position to the left-margin position
Select the Print Position
Note:
Paper handling at the end of a page differs depending on paper type, loading
method, and ESC/P version.
ESC/P 2
ESC/P
Continuous paper
If an ESC J, LF, ESC ( V, or ESC ( v command would
move the print position below the bottom margin
position, the printer moves the print position to the
top-margin position on the following page.
Single-sheet paper
If an ESC J, LF, ESC ( V, or ESC ( v commandwould
move the print position below the bottom-margin
position, the printer ejects the sheet of paper.
9-Pin ESC/P
Continuous paper
If an ESC J or LF command would move the print
position below the bottom-margin position, the
printer moves the print position to the top-of-form
position on the following page.
Single-sheet paper
Loaded by cut-sheet feeder If an ESC J or LF command would move the print
position below the end of the printable area, the
printer ejects the paper.
Loaded by hand
If an ESC J or LF command would move the print
position below the end of the printable area, the
printer feeds the paper until the end of the page. After
the next sheet is loaded, the printer feeds the paper
the remaining distance specified in the ESC J or LF
command.
Select the Print Position
R-63
Send Print Data
ESC/P 2
ESC/P
9-Pin ESC/P
Once you have set the page format, defined the starting characters, and set the
initial print position, you can begin sending print data.
The following rules allow the printer to process data most efficiently.
•
Send data from left to right on a line.
•
End each line of data with a CR and LF command.
•
Send lines from the top to the bottom of the page.
•
Complete each page with a FF command. Also send a FF command at the end
of each print job.
Note:
The exception to this data order is when you combine bit-image graphics with
text printing. See “Mixing text and bit-image graphics” for details.
To vary printed characters, you can change font attributes and enhancements at
any time. See the following sections for information on preparing and sending
graphics data.
R-64
Send Print Data
Sending Graphics Data
ESC/P 2
ESC/P
9-Pin ESC/P
Two kinds of graphics printing are possible: bit-image and raster graphics.
Although both types of graphics are based on bits in the data bytes, the
relationship between the data order and dot printing differs.
Bit Image
•
Bit-image graphics was developed with the layout of the print head in mind.
Data is organized to correspond to columns of print head output. Printing
takes place after each complete line is sent.
•
Bit-image graphics can be mixed with text printing.
•
Bit-image graphics is available on all printers.
Raster Graphics
•
Raster graphics treats data in essentially the same way as video displays and
laser printers. Data is sent in one-dot high lines. The printer reorganizes the
data internally to correspond to the print head layout. Printing may not take
place at the end of the line.
•
There are two levels of raster graphics: standard and extended. Standard
raster graphics is available only on ESC/P 2 printers. Extended raster
graphics is available only on the Stylus COLOR and later high-resolution
ESC/P 2 printer models.
•
Standard raster graphics has a special data compression feature that allows
you to economize on the data necessary to print graphics. Extended raster
graphics provides two additional data compression schemes.
•
Text and raster graphics printing cannot be combined on the same page.
The illustrations below show the difference between raster and bit-image data
processing.
Raster graphics
Bit-image graphics
Sending Graphics Data
R-65
Note:
For detailed information on programming for EPSON’s Stylus COLOR and other
high-resolution color printers, see “Extended ESC/P 2 Programming Guide” at
the end of this chapter.
To eliminate potential command conflicts during raster graphics printing,
EPSON provides a special graphics mode. In this mode, some commands are not
available. See “Graphics mode” for details.
Bit-image graphics
ESC/P 2
ESC/P
9-Pin ESC/P
Bit-image graphics is available on all printers. Data handling varies, however,
depending on the number of pins in the print head.
The steps for printing bit-image graphics are as follows:
1.
Determine vertical and horizontal dot density.
2.
Prepare and organize bit-image data.
3.
If you plan to send more than one line of graphics, set the line spacing to
match the height of the print head.
4.
Set the vertical and horizontal print position to the top left corner of the
graphics line.
5.
Send one line of bit-image data to the computer.
6.
Complete the line with a CR and LF command.
7.
Repeat steps 5 and 6 until the full graphics design is printed.
Determining vertical and horizontal dot density
ESC/P 2
ESC/P
9-Pin ESC/P
The ESC * command is used to print bit-image graphics.
The format of this command is as follows:
ESC * m nL nH d1 d2 . . . dk
m
Specifies the dot density and printing speed. The dot
density can be specified from 60 × 60 dpi (dots per
inch) to up to 360 × 360 dpi, depending on the
number of pins in the print head. The printing speed
depends on the printing of adjacent horizontal dots;
by not allowing the printing of adjacent dots, you
increase the printing speed.
R-66
Sending Graphics Data
nL, nH
Specifies the number of dot columns to follow,
determined by the following equation:
(number of dot columns) = ((nH × 256) + nL)
nH = INT
(number of dot columns)
256
nL = MOD
(number of dot columns)
256
The number of bytes required for each dot column
shown below.
d1 . . . dk
Data bytes
You must specify the vertical and horizontal dot density of graphics when
sending the ESC * command. The dot densities available are shown in the table
below.
Dot density
Parameter m in Horizontal
ESC *
density
command
0
60
1
120
2
120
3
240
4
80
5
72
6
90
7
144
32
60
33
120
38
90
39
180
40
360
64
60
65
120
70
90
71
180
72
360
73
360
Vertical density
Adjacent
Dots per
Bytes
9 pin 24 pin 48 pin dot printing column per column
72
72
72
72
72
72
72
72
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
N/A
60
60
60
60
60
N/A
60
N/A
180
180
180
180
180
N/A
N/A
N/A
N/A
N/A
N/A
60
60
60
60
60
N/A
60
N/A
180
180
180
180
180
360
360
360
360
360
360
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
8
8
8
8
8
8
8
8
24
24
24
24
24
48
48
48
48
48
48
Sending Graphics Data
1
1
1
1
1
1
1
1
3
3
3
3
3
6
6
6
6
6
6
R-67
Note:
If the mode you select does not allow adjacent dot printing, the printer ignores
the second of two consecutive horizontal dots as shown below:
Preparing bit-image data
Once you have determined the dot density, create a grid for plotting your design.
If the horizontal density is not the same as the vertical density, make a grid that
reflects this.
See the sample grids below.
8-dot columns
24-dot columns
48-dot columns
Divide the grid into columns of 1, 3, or 6 bytes, depending on the m parameter of
the dot density you select. The illustrations in the next two sections depict the
following examples:
m=0
m = 39
m = 72
R-68
Sending Graphics Data
60 × 60 dpi (60 × 72 dpi for 9-pin printers)
180 × 180 dpi
360 × 360 dpi
After plotting the design, divide the grid into groups one dot wide and eight dots
high.
The dots in each group have a value, as shown in the following diagram. The
sum of each group is sent as a byte of data to the printer. Calculate the value for
each byte as shown.
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
128
64
32
16
8
4
2
1
Sending Graphics Data
R-69
Sending bit-image data to the printer
The order for sending data depends on the mode selected with the m parameter.
The table at the beginning of this section lists the number of bytes of data
required for each column.
1
1
2
3
2
4
5
1
7 13
2
8 14
3
9 15
7
8
4 10 16
5 11 17
3
6
9
6 12 18
Count the number of resulting columns in each line. The nL and nH parameters
tell the printer how many columns to expect. Calculate nL and nH as follows:
nH = INT
(number of dot columns)
256
nL = MOD
(number of dot columns)
256
If you are going to send more than one line of graphics, send the following
commands to set the line spacing:
24/48-pin printers
9-pin printers
ESC + 48
ESC 3 24
48/360-inch line spacing
24/216-inch line spacing
This matches the line spacing to the height of the print head. After this, sending
the CR and LF commands moves the vertical print position so the next line of
graphics begins right where the previous line ended, with no space between.
Now send the data for the first line to the printer as follows:
ESC * 0 nL nH d1 d2 . . . dk
ESC * 39 nL nH d1 d2 . . . dk
ESC * 72 nL nH d1 d2 . . . dk
R-70
Sending Graphics Data
At the end of the line, send the CR and LF commands. Move the horizontal print
position as necessary. Then send the ESC * command for the next line of graphics.
Note:
• Since the vertical dot density during 8-dot mode is different for 9 and 24/48pin printers, printed graphics will differ slightly (graphics on 9-pin printers
will appear slightly compressed vertically).
•
You must send the ESC * command for each line of graphics.
Mixing text and bit-image graphics with ESC/P 2 printers
ESC/P 2
ESC/P 2 printers can process more than one line of data at a time; this allows for
advanced features such as scalable fonts and raster graphics.
More memory has been provided for processing data than previous ESC/P
versions. By processing data within this memory before printing, mixing bitimage graphics and text of all point sizes is possible.
To provide the most efficient processing of data in the memory available,
ESC/P 2 has the following rules:
•
You cannot move the vertical print position more than 179/360 inch (one dot
less than 1/2 inch) in the negative direction.
•
You cannot move the vertical print position in the negative direction if you
have just sent graphics data, or if the print position would move above
previously printed graphics data.
Because of these rules, you should process data with text data always leading
graphics data by 1/2 inch.
Follow the steps below for this process.
1.
Use the ESC + 48 command to set the line spacing to match the print head
height.
2.
Send the first 1/2 inch of text data to the printer. You can print any
combination of fonts (large and small point sizes, etc.) on multiple lines;
however, make sure the baseline of all characters is located within this 1/2inch.
3.
Use the ESC ( V or ESC ( v commands to move the print position to the top of
the 1/2-inch zone.
4.
Use the ESC * command to send one line of graphics data (see the previous
section). End the graphics line with the CR and LF commands. Note that the
height of one line of graphics is equal to the height of the print head (48/360inch).
Sending Graphics Data
R-71
5.
Move the vertical print position to the bottom of the 1/2-inch zone.
6.
Send all text data that has its baseline located in the next 48/360-inch band.
7.
Move the vertical print position to 1/360 inch below the bottom of the
previous line of graphics.
8.
Continue sending alternating 48/360-inch bands of text, then data, with the
text leading the graphics by 1/2 inch (as described in steps 4 to 7).
9.
When you reach the end of the text data, or the page’s bottom margin, send
all the remaining lines of graphics data.
This order allows the printer to store text data in its memory first. Then, when
you send the graphics data, the printer prints out the combined data.
Note:
If you don’t follow this order, the tops of some characters may be cut off. This can
occur when part of a character overlaps previously printed graphics.
R-72
Sending Graphics Data
Graphics mode
ESC/P 2
ESC/P 2 printers feature a method of printing graphics, called raster graphics. To
prevent conflicts with existing commands, EPSON uses a special graphics mode.
You can send raster graphics commands only when in this mode.
Raster graphics gives the programmer a simple, consistent method of printing
bit-map images. Raster graphics provides the following advantages:
•
Prints images in a consistent manner, regardless of the print head
configuration (24 or 48 pins)
•
Eliminates necessity for interleaving lines to achieve maximum dot density
•
Eliminates complicated calculations for handling data in specific band
heights
•
Provides for data compression; two bytes of data (a counter byte and a data
byte) can specify up to 1,016 dots. Also, repetitive and nonrepetitive data can
be sent in the same data string.
Standard raster graphics commands are available to all ESC P/2 printers. An
additional set of raster graphics commands, known as extended raster graphics,
was developed for EPSON’s line of high-resolution color ink jet printers. This
new set of commands provides one additional compressed raster graphics mode,
which can be accessed by sending the ESC . 2 command.
Entering and exiting graphics mode
ESC/P 2
Graphics mode is entered by sending the ESC ( G command. The format of the
command is as follows:
ESC ( G 1 0 1
You can only enter graphics mode with this command. Use the ESC @ (initialize
printer) command to exit graphics mode.
Sending Graphics Data
R-73
Commands available in graphics mode
Only the following commands are available in standard raster graphics mode:
LF
CR
ESC .
ESC . 1
ESC . 2
ESC ( c
ESC ( V
ESC $
ESC r
ESC +
FF
ESC EM
ESC @
ESC ( C
ESC ( v
ESC \
ESC U
ESC ( U
ESC ( i
Line feed
Carriage return
Print raster graphics
Enter RLE compressed mode
Enter TIFF compressed mode (Stylus COLOR only)
Set page format
Set absolute vertical position
Set absolute horizontal position
Select printing color
Set n/360-inch line spacing
Form feed
Control paper loading/ejecting
Initialize printer (exit graphics mode)
Set page length in defined unit
Set relative vertical position
Set relative horizontal position
Turn unidirectional on/off
Set unit
MicroWeave (Stylus COLOR only)
The following subset of binary mode commands is available in extended raster
graphics mode, entered by sending the ESC . 2 command. All other commands
are ignored.
<XFER>
<MOVX>
<MOVY>
<COLR>
<CR>
<EXIT>
<MOVXBYTE>
<MOVXDOT>
Transfer raster graphics data
Set relative horizontal position
Set relative vertical position
Select printing color
Carriage return to left-most print position
Exit TIFF compressed mode
Set <MOVX> unit to 8 dots
Set <MOVX> unit to 1 dot
Other commands not listed above are ignored. Also, text cannot be sent during
graphics mode.
Standard raster graphics
ESC/P 2
Raster graphics allows the programmer to send image data in a format similar to
that used by televisions, VDT monitors, and laser printers.
Follow these steps to prepare and send raster graphics:
1.
R-74
Determine the dot density (resolution) of your image.
Sending Graphics Data
2.
Use the ESC ( U command to set the unit to match the vertical dot density
selected.
3.
Divide your image into bands. These bands should be 1, 8, or 24-dots high.
Parameter m in the ESC . command should be set to this value.
4.
Use the ESC + command to set line spacing to match the height of the vertical
band. If you select 360-dpi dot density, the parameter for the ESC + command
is the same as parameter m in the ESC . command. If you select 180, the ESC
+ parameter equals m × 2.
5.
Set the vertical and horizontal positions to begin the first graphics band.
6.
Use the ESC . command to send a graphics band m dots high.
7.
Send the CR and LF commands at the end of each block; then move the
horizontal position to the beginning of the next graphics band.
8.
Repeat steps 6 and 7 until all graphics data is sent for the page.
9.
Send a FF command at the end of the page.
10. Repeat steps 6 to 9 for all pages in the print job.
The format of the ESC . (standard raster graphics) command is as follows:
ESC . c v h m nL nH d1 d2 . . . dk
c= 0
Selects full graphics mode; all data bytes are treated
as print data
1
Selects run length encoded compressed mode; data
treated as follows: counter byte, data, counter byte,
data
v
Specifies vertical dot density (independent of
number of pinsin head)
(vertical dot density) =
h
3600
dpi
v
Specifies horizontal dot density (independent of
number of pins in head)
(horizontal dot density) =
3600
dpi
h
m
Specifies vertical dot count (1, 8, or 24)
nL, nH
Specifies horizontal dot count
d1 . . . dk
Data or counter/data combination
(horizontal dot count) = ((nH × 256) + nL)
Sending Graphics Data
R-75
The vertical and horizontal dot densities that can be selected are as follows:
h
20
10
10
v
20
20
10
horizontal density
180
360
360
vertical density
180
180
360
Once you have decided the dot density, use the ESC ( U to set the unit to match
the vertical dot density.
ESC ( U 1 0 10
ESC ( U 1 0 20
Selects 1/360-inch unit
Selects 1/180-inch unit
Next, create a grid for plotting your design. If the horizontal density is not the
same as the vertical density, make a grid that reflects this.
See the sample grid below.
After plotting the design, divide the grid into groups one dot high and eight dots
wide.
The dots in each group have a value, as shown in the following diagram.
Calculate the value for each group as shown.
R-76
Sending Graphics Data
64 + 16
+
2 = 82
32
+
2
= 34
4+2+1 = 7
Divide your image into bands 1, 8, or 24-dots high. The number of vertical dots is
called the band height. This is the value you should use for parameter m in the
ESC . command.
Sending Graphics Data
R-77
The band height affects the following:
•
The taller the band height, the more memory you must prepare in your
program to accomodate graphics data.
•
The band height determines the number of times you must send the ESC .
command. You must resend the ESC . command for each band of graphics
you print. The taller the band height, the less number of ESC . commands you
need to send.
The following table gives you an idea of how much memory is required for band
heights at certain standard widths.
Band
width
8 inches
11 inches
14 inches
Bytes required for band heights at
180-dpi horizontal dot density
1-dot band 8-dot band 24-dot band
height
height
height
180
1,440
4,320
248
1,984
5,952
315
2,520
7,560
Bytes required for band heights at
360-dpi horizontal dot density
1-dot band 8-dot band 24-dot band
height
height
height
360
2,880
8,640
495
3,960
11,880
630
5,040
15,120
Use the ESC + command to set line spacing to match the band height. The
following table shows the command format for each band height.
ESC + command
setting
ESC + 1
ESC + 2
ESC + 8
ESC + 16
ESC + 24
ESC + 48
R-78
Sending Graphics Data
Vertical dot
density (dpi)
360
180
360
180
360
180
Band height
(dots)
1
1
8
8
24
24
Band height
(inches)
1/360
2/360
8/360
16/360
24/360
48/360
Parameter m in
ESC . command
1
1
8
8
24
24
Before sending data, you must also determine the width of your graphics image.
The width is also specified in number of dots. Of course, data must be sent in
bytes; all data beyond the dot width specified is ignored.
The following illustration shows the dot width and the ignored data.
Ignored data
19-dot width
nH = 0, nL = 19
Determine the dot-width parameters for the ESC . command as follows:
nH = INT
(dot width)
256
nL = MOD
(dot width)
256
Use a combination of the ESC ( V, ESC ( v, ESC $, or ESC \ commands to set the
beginning position of the first graphics band. The print position corresponds to
the position of the first printable dot in your image.
First print position
Final print position
Sending Graphics Data
R-79
You are now ready to send data with the ESC . command.
The method of sending data in standard raster graphics mode depends on
whether you select full graphics (ESC.0) or compressed mode (ESC . 1). For a
discussion of extended raster graphics compressed modes, see “Extended raster
graphics (ESC . 2).”
Full graphics mode (ESC . 0)
ESC/P 2
If you set the ESC . command’s parameter c to 0, you select full graphics mode.
During full graphics mode, all data received is treated as print data.
Note:
Full graphics mode requires more data to be sent. Use compressed raster graphics
mode whenever possible.
During full graphics mode, simply divide the image grid into bytes and send the
bytes one after another, in the following order.
After sending the data for the graphics band, send a CR and LF command.
R-80
Sending Graphics Data
Standard raster graphics compressed mode (ESC . 1)
ESC/P 2
The method of sending data in standard raster graphics compressed mode is
slightly more complicated. However, the amount of data necessary to print
graphics may be greatly reduced. When possible, you should use one of the
available compressed modes. For information on extended raster graphics
compressed modes, see “Extended raster graphics (ESC . 2).”
Data is organized as counter bytes followed by data bytes. Two types of counters
can be used: repeat counters and data-length counters.
Repeat counters specify the number of times (minus 1) to repeat the following
single byte of data.
Data-length counters specify the number of bytes (minus 1) of print data
following the counter. This data is printed only once.
If the counter is positive, it is treated as a data-length counter.
0 ≤ (data-length counter) ≤ 127
The data-length counter is calculated as follows:
(data-length counter) = (number of data bytes to follow) – 1
If the counter is negative (as determined by two’s complement), it is treated as a
repeat counter.
–1 ≤ (repeat counter) ≤ –127
The repeat counter is calculated as follows:
(repeat counter) = 256 – (number of times to repeat data) + 1
During compressed mode, the first byte of data must be a counter. After receiving
a counter, the printer handles data as follows:
If a repeat counter is received, the printer repeats the following byte of data the
specified number of times. The byte following the data byte is treated as a
counter.
ESC .
Repeats this one byte of data 11 times
↓
10 8 48 0 –10 129 15 . . .
↑
↑
First counter byte
Second counter byte
Sending Graphics Data
R-81
If a data-length counter is received, the printer prints the specified number of
bytes. The next byte following the data is treated as a counter.
ESC .
1
10
Prints next 5 bytes as data
↓
↓
↓
↓ ↓
10 8 48 0
4 10 129 100 63 48 –10 . . .
↑
↑
First counter byte
Second counter byte
Since the printer evaluates each counter separately, you can include both kinds of
counters in the same ESC . 1 command sequence. However, the total amount of
print data must match the length and height of the graphics band.
Note:
If your image has consecutive blank spaces, use the repeat counter to send
repetitive bytes of NUL data (bytes with value of 0). This can greatly reduce the
amount of data necessary for printing some images.
During compressed mode, divide the image grid into bytes just as with full
graphics mode. However, you then separate repetitive data bytes from
nonrepetitive bytes. Shaded areas indicate repetitive data bytes.
60
14
0
32
0
0
13
44
90
99
0
9
0
0
25
110
30
155
60
27
0
37
155
109
128
155
15
34
0
14
155
15
37
63
15
173
0
16
63
15
79
97
15
91
0
88
97
15
42
22
15
92
0
103
22
15
15
0
15
8
0
77
31
15
53
0
128
0
0
61
97
0
The ESC . 1 command would be as follows for the example above.
ESC . 1 10 10 8 72 0
After sending the following data (shaded data bytes are counters), send a CR or
LF command.
15
15
22
128
8
103
97
15
R-82
Sending Graphics Data
60
53
–3
32
–11
77
22
0
90
14
0
9
0
61
31
0
30
99
0
27
18
13
97
128
155
60
34
37
25
44
37
155
–4
173
14
155
110
79
63
15
91
16
155
109
42
97
8
92
88
63
–4
Extended raster graphics (ESC . 2)
ESC/P 2
Extended raster graphics provides one data compression mode: TIFF (ESC . 2).
For more information on programming with this command, see “Extended
ESC/P 2 Programming Guide” later in this section.
A brief explanation of each mode is given below.
TIFF compressed mode (ESC . 2)
Uses the TIFF compression format. Image data for each color is written to the
band buffer (of the current line) and has no effect on the next line. Image data
must be sent for each line. The compression method is the same as that used in
the RLE compressed mode (ESC . 1), which means that image data is sent in the
“counter + image data” format. Although both compression methods use the
same amount of image data, the amount of code data required by each method
varies markedly. The TIFF mode uses a subset of binary commands that require
much less data than the corresponding ESC commands used in the RLE mode.
For example, the print position, color selection, and other operation codes can be
specified with only 1 to 3 bytes in the TIFF mode, thereby reducing the overall
amount of data sent to the printer. The TIFF mode provides a good balance
between data handling speed and the amount of data compression, making it
ideal for printing small graphics files.
An example of the data compression methods used in extended raster graphics
mode is shown below. For more information, see the explanation of each
command in Individual Command Descriptions.
Sample graphics image (3 lines, 3 × 24 dots)
1st byte
2nd byte
3rd byte
1st line
2nd line
3rd line
Sample graphics image expressed as byte data
1st line
2nd line
3rd line
1st byte
F0H
F0H
F0H
2nd byte
F0H
F0H
AAH
3rd byte
F0H
F0H
AAH
TIFF compressed mode
After sending ESC . 2 v h 1 0 0 (8 bytes) once to enter TIFF compressed mode,
following data is sent in the “binary code data + image data” format, and can be
used to print several lines. In this mode, all image data must be sent again even if
the following line is identical to the previous one. For example, to print the first
and second lines in the above example, 4 bytes (3 × F0H (twice)) of image data
are needed. The total amount of data used to send the graphics image sample
shown above is as follows:
2 bytes (image data of 1st line) + 9 bytes (code data of 1st line) + 2 bytes
(image data of 2nd line) + 2 bytes (code data of 2nd line) + 4 bytes (image
data of 3rd line) + 2 bytes (code data of 3rd line) = 21 bytes
Sending Graphics Data
R-83
Printing Bar Codes
ESC/P 2
ESC/P
9-Pin ESC/P
Barcode print is available on DLQ-3000(‘96-), LQ-670, LQ-2070, LQ-2170, FX-2170
and later impact dot matrix models.
The ESC ( B command is used to print barcodes. The format of this command is
as follows:
ESC ( B nL nH k m s v1 v2 c BarCodeData
nL nH
Specify the number of data bytes to follow,
determined by the following equation:
(number of data bytes) = 6 bytes + BarCodeData bytes = ((nH × 256) + nL)
(where 6 bytes are k, m, s, v1, v2, and c)
nH = INT
(number of data bytes)
256
nL = MOD
(number of data bytes)
256
The parameter k specifies the barcode type.
k (Hex)
Bar code type
00
EAN-13
01
EAN-8
02
Interleaved 2 of 5
03
UPC-A
04
UPC-E
05
Code 39
06
Code 128
07
POSTNET
The parameter m specifies the module width.
m
24-pin printer
9-pin printer
(unit 1/180 inch) (unit 1/120 inch)
02 (default)
2 dots
2 dots
03
3 dots
3 dots
04
4 dots
4 dots
05
5 dots
5 dots
The parameter s specifies the space adjustment value.
24-pin printer
-3 ≤ s ≤ 3 (unit 1/360 inch)
9-pin printer
-3 ≤ s ≤ 3 (unit 1/240 inch)
The parameter v1 and v2 specifies the bar length.
24-pin printer
bar length = v1 + v2 × 256 (unit 1/180 inch)
9-pin printer
bar length = v1 + v2 × 256 (unit 1/72 inch)
The limitation of bar length:
45/180 inch ≤ bar length ≤ 22 inch
: 24-pin printer
18/72 inch ≤ bar length ≤ 22 inch
: 9-pin printer
The v1 and v2 values are ignored when POSTNET is selected.
Long bar length of POSTNET is always 0.125 inch.
Short bar length of POSTNET is always 0.050 inch.
R-84
Printing Bar Codes
The parameter c specifies the control flag.
c
Control flag
bit 0
Check digit
0: If check digit is to be printed, the host generates it and sends
it to the printer
1: Printer generates and prints the check digit
Bit 1
Human readable character
0: Prints
1: Does not print
Bit 2
Position of flag character (for EAN-13 and UPC-A only)
0: Center
1: Under
bit 3
(reserved)
bit 4
(reserved)
bit 5
(reserved)
bit 6
(reserved)
bit 7
(reserved)
Barcode Data
Bar code type
EAN-13
EAN-8
Interleaved 2 of 5
UPC-A
UPC-E
Code 39
Code 128
POSTNET
Corresponds to the bar code symbology.
The data number of each bar code type is constant.
The bar code is not printed if the number of bar code
characters are incorrect.
Actual number of Barcode Data (HEX)
control flag c bit 0 control flag c bit 0
=0
=1
0D
0C
08
07
02 to FF
02 to FF
0C
0B
0C or 8
0B or 7
01 to FF
01 to FF
02 to FF
02 to FF
06 or 0A or 0C
05 or 09 or 0B
The valid data of each bar code type are as follows.
If invalid data is included in the Barcode Data string,
the bar code is not printed.
Bar code type
EAN-13
EAN-8
Interleaved 2 of 5
UPC-A
UPC-E
Code 39
Code 128
POSTNET
Valid range of BarCodeData
0-9 (30H-39H)
0-9 (30H-39H)
0-9 (30H-39H)
0-9 (30H-39H)
0-9 (30H-39H)
0-9 (30H-39H), (41H-5AH)
(20H, 24H, 25H, 2BH, 2DH, 2EH, 2FH)
See the code sets A, B, and C on the
following pages.
0-9 (30H-39H)
Printing Bar Codes
R-85
Data Character Set A:
Character
NUL
OH
STX
EXT
EOT
ENO
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
R-86
Hex Code
x00
x01
x02
x03
x04
x05
x06
x07
x08
x09
x0A
x0B
x0C
x0D
x0E
x0F
x10
x11
x12
x13
x14
x15
x16
x17
x18
x19
x1A
x1B
x1C
x1D
x1E
x1F
Printing Bar Codes
Character
Space
‘!’
‘"’
‘#’
‘$’
‘%’
‘&’
‘'’
‘(’
‘)’
‘*’
‘+’
‘,’
‘-’
‘.’
‘/’
‘0’
‘1’
‘2’
‘3’
‘4’
‘5’
‘6’
‘7’
‘8’
‘9’
‘:’
‘;’
‘<’
‘=’
‘>’
‘?’
Hex Code
x20
x21
x22
x23
x24
x25
x26
x27
x28
x29
x2A
x2B
x2C
x2D
x2E
x2F
x30
x31
x32
x33
x34
x35
x36
x37
x38
x39
x3A
x3B
x3C
x3D
x3E
x3F
Character
‘@’
‘A’
‘B’
‘C’
‘D’
‘E’
‘F’
‘G’
‘H’
‘I’
‘J’
‘K’
‘L’
‘M’
‘N’
‘O’
‘P’
‘Q’
‘R’
‘S’
‘T’
‘U’
‘V’
‘W’
‘X’
‘Y’
‘Z’
‘[’
‘\’
‘]’
‘^’
‘_’
Hex Code
x40
x41
x42
x43
x44
x45
x46
x47
x48
x49
x4A
x4B
x4C
x4D
x4E
x4F
x50
x51
x52
x53
x54
x55
x56
x57
x58
x59
x5A
x5B
x5C
x5D
x5E
x5F
Character
FNC 3
FNC 2
Shift
Code C
Code B
FNC 4
FNC 1
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
Hex Code
x60
x61
x62
x63
x64
x65
x66
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
Data Character Set B:
Character
FNC 3
FNC 2
Shift
Code C
FNC 4
Code A
FNC 1
Hex Code
x19
x1A
x1B
x1C
x1D
x1E
x1F
Character
Space
‘!’
‘"’
‘#’
‘$’
‘%’
‘&’
‘'’
‘(’
‘)’
‘*’
‘+’
‘,’
‘-’
‘.’
‘/’
‘0’
‘1’
‘2’
‘3’
‘4’
‘5’
‘6’
‘7’
‘8’
‘9’
‘:’
‘;’
‘<’
‘=’
‘>’
‘?’
Hex Code
x20
x21
x22
x23
x24
x25
x26
x27
x28
x29
x2A
x2B
x2C
x2D
x2E
x2F
x30
x31
x32
x33
x34
x35
x36
x37
x38
x39
x3A
x3B
x3C
x3D
x3E
x3F
Character
‘@’
‘A’
‘B’
‘C’
‘D’
‘E’
‘F’
‘G’
‘H’
‘I’
‘J’
‘K’
‘L’
‘M’
‘N’
‘O’
‘P’
‘Q’
‘R’
‘S’
‘T’
‘U’
‘V’
‘W’
‘X’
‘Y’
‘Z’
‘[’
‘\’
‘]’
‘^’
‘_’
Hex Code
x40
x41
x42
x43
x44
x45
x46
x47
x48
x49
x4A
x4B
x4C
x4D
x4E
x4F
x50
x51
x52
x53
x54
x55
x56
x57
x58
x59
x5A
x5B
x5C
x5D
x5E
x5F
Character
‘a’
‘b’
‘c’
‘d’
‘e’
‘f’
‘g’
‘h’
‘i’
‘j’
‘k’
‘l’
‘m’
‘n’
‘o’
‘p’
‘q’
‘r’
‘s’
‘t’
‘u’
‘v’
‘w’
‘x’
‘y’
‘z’
‘{’
‘/’
‘}’
‘¯’
DEL
Hex Code
x60
x61
x62
x63
x64
x65
x66
x67
x68
x69
x6A
x6B
x6C
x6D
x6E
x6F
x70
x71
x72
x73
x74
x75
x76
x77
x78
x79
x7A
x7B
x7C
x7D
x7E
x7F
Printing Bar Codes
R-87
Data Character Set C:
Character
‘00’
‘01’
‘02’
‘03’
‘04’
‘05’
‘06’
‘07’
‘08’
‘09’
‘10’
‘11’
‘12’
‘13’
‘14’
‘15’
‘16’
‘17’
‘18’
‘19’
‘20’
‘21’
‘22’
‘23’
‘24’
‘25’
‘26’
‘27’
‘28’
‘29’
‘30’
‘31’
R-88
Hex Code
x3030
x3031
x3032
x3033
x3034
x3035
x3036
x3037
x3038
x3039
x3130
x3131
x3132
x3133
x3134
x3135
x3136
x3137
x3138
x3139
x3230
x3231
x3232
x3233
x3234
x3235
x3236
x3237
x3238
x3239
x3330
x3331
Printing Bar Codes
Character
‘32’
‘33’
‘34’
‘35’
‘36’
‘37’
‘38’
‘39’
‘40’
‘41’
‘42’
‘43’
‘44’
‘45’
‘46’
‘47’
‘48’
‘49’
‘50’
‘51’
‘52’
‘53’
‘54’
‘55’
‘56’
‘57’
‘58’
‘59’
‘60’
‘61’
‘62’
‘63’
Hex Code
x3332
x3333
x3334
x3335
x3336
x3337
x3338
x3339
x3430
x3431
x3432
x3433
x3434
x3435
x3436
x3437
x3438
x3439
x3530
x3531
x3532
x3533
x3534
x3535
x3536
x3537
x3538
x3539
x3630
x3631
x3632
x3633
Character
‘64’
‘65’
‘66’
‘67’
‘68’
‘69’
‘70’
‘71’
‘72’
‘73’
‘74’
‘75’
‘76’
‘77’
‘78’
‘79’
‘80’
‘81’
‘82’
‘83’
‘84’
‘85’
‘86’
‘87’
‘88’
‘89’
‘90’
‘91’
‘92’
‘93’
‘94’
‘95’
Hex Code
x3634
x3635
x3636
x3637
x3638
x3639
x3730
x3731
x3732
x3733
x3734
x3735
x3736
x3737
x3738
x3739
x3830
x3831
x3832
x3833
x3834
x3835
x3836
x3837
x3838
x3839
x3930
x3931
x3932
x3933
x3934
x3935
Character
‘96’
‘97’
‘98’
‘99’
Code B
Code A
FNC 1
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
Hex Code
x3936
x3937
x3938
x3939
x3A
x3B
x3C
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
Print position:
A bar code is placed the left upper end of a bar code to the current vertical and
horizontal print position. Also printing position after the printing of a bar code
returns to the print position before bar code printing.
Hor
i
z
o
nt
a
l
pr
i
ntposit
i
o
n
Pr
i
ntposit
i
o
nandnextpr
i
ntposit
i
o
n
Ver
t
i
calpr
i
nt
posit
i
o
n
Ba
rl
e
ngt
h
Notes:
(1) Bar code printing is always performed uni-directionally.
(2) The bar code is not printed when part of the bar code is past the right margin.
(3) Start/stop characters(*) of Code39 are generated automatically by the printer,
and added to human readable characters.
(4) A kind of Code 128 character sets (A, B or C) is identified by the first data of
Code 128. The first data must be a hexadecimal 41 (A), 42 (B) and 43 (C).
(5) When Code 128 Character Set C and Interleaved 2 of 5 is selected and the
number of Barcode data are ODD, “0” is added to the data string.
Printing Bar Codes
R-89
Examples:
example 1: EAN-13, CD: Host, HRI: print, Flag Char.: center
(CD: Check digit, HRI: Human Readable character)
1B 28 42 13 00
; Barcode command and data length
00
; Barcode type k = EAN-13
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
30 31 32 33 34 35 36
; Barcode Data
37 38 39 30 31 32 ;
example 2: EAN-13, CD: Printer, HRI: print, Flag Char.: under
1B 28 42 12 00
; Barcode command and data length
00
; Barcode type k = EAN-13
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
05
; Control flags c
31 32 33 34 35 36
; Barcode Data
37 38 39 30 31 32
example 3: EAN-13, CD: Printer, HRI: none, Flag Char.: under
1B 28 42 12 00
; Barcode command and data length
00
; Barcode type k = EAN-13
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
31 32 33 34 35 36
; Barcode Data
37 38 39 30 31 32
R-90
Printing Bar Codes
example 4: EAN-8, CD: Host, HRI: print
1B 28 42 0E 00
; Barcode command and data length
01
; Barcode type k = EAN-8
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
30 31 32 33 34 35 36 35 ; Barcode Data
example 5: EAN-8, CD: Printer, HRI: none
1B 28 42 0D 00
; Barcode command and data length
01
; Barcode type k = EAN-8
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
30 31 32 33 34 35 36
; Barcode Data
example 6: Interleaved 2 of 5, CD: Host, HRI: print
1B 28 42 1A 00
; Barcode command and data length
02
; Barcode type k = Interleaved 2 of 5
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
31 32 33 34 35 36 37
; Barcode Data
38 39 30 31 32 33 34
;
35 36 37 38 39 30 ;
Printing Bar Codes
R-91
example 7: Interleaved 2 of 5, CD: Printer, HRI: none
1B 28 42 19 00
; Barcode command and data length
02
; Barcode type k = Interleaved 2 of 5
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
31 32 33 34 35 36 37
; Barcode Data
38 39 30 31 32 33 34
;
35 36 37 38 39
;
example 8: Interleaved 2 of 5, CD: Host, HRI: print
Next example is that ‘0’ is added automatically, in the case that the
data number is odd.
1B 28 42 19 00
; Barcode command and data length
02
; Barcode type k = Interleaved 2 of 5
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
31 32 33 34 35 36 37
; Barcode Data
38 39 30 31 32 33 34
;
35 36 37 38 39
;
example 9: UPC-A, CD: Host, HRI: Print, Flag Char.: center
1B 28 42 12 00
; Barcode command and data length
03
; Barcode type k = UPC-A
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
30 31 32 33 34 35 36
; Barcode Data
37 38 39 30 35
;
R-92
Printing Bar Codes
example 10: UPC-A, CD: Printer, HRI: print, Flag Char.: under
1B 28 42 11 00
; Barcode command and data length
03
; Barcode type k = UPC-A
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
05
; Control flags c
31 32 33 34 35 36
; Barcode Data
37 38 39 30 31
;
example 11: UPC-A, CD: Printer, HRI: none, Flag Char.: center
1B 28 42 11 00
; Barcode command and data length
03
; Barcode type k = UPC-A
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
31 32 33 34 35 36
; Barcode Data
37 38 39 30 31
;
example 12: UPC-E, CD: Host, HRI: print
Next example is that of barcode data compacted in accordance with
specifications by the printer.
1B 28 42 12 00
; Barcode command and data length
04
; Barcode type k = UPC-E
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
30 31 32 33 34 35 36
; Barcode Data
37 38 39 30 35
;
Printing Bar Codes
R-93
example 13: UPC-E, CD: Printer, HRI: none
Next example is that of the barcode data compacted in accordance
with specifications by the printer.
1B 28 42 11 00
; Barcode command and data length
04
; Barcode type k = UPC-E
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
31 32 33 34 35 36
; Barcode Data
37 38 39 30 31
;
example 14: UPC-E, CD: Host, HRI: print
1B 28 42 0E 00
; Barcode command and data length
04
; Barcode type k = UPC-E
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
30 31 32 33 34 35
; Barcode Data
30 33
;
example 15: UPC-E, CD: Printer, HRI: print
1B 28 42 0D 00
; Barcode command and data length
04
; Barcode type k = UPC-E
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
01
; Control flags c
30 31 32 33 34 35 30
; Barcode Data
R-94
Printing Bar Codes
example 16: UPC-E, CD: printer, HRI: none
1B 28 42 0D 00
; Barcode command and data length
04
; Barcode type k = UPC-E
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
30 31 32 33 34 35 30
; Barcode Data
example 17: Code 39, CD: host, HRI: print
1B 28 42 0D 00
; Barcode command and data length
05
; Barcode type k = Code 39
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
31 32 41 42 24 25 2E
; Barcode Data
example 18: Code 39, CD: Printer, HRI: print
1B 28 42 0D 00
; Barcode command and data length
05
; Barcode type k = Code 39
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
01
; Control flags c
31 32 41 42 24 25 2E
; Barcode Data
Printing Bar Codes
R-95
example 19: Code 39, CD: Printer, HRI: none
1B 28 42 0D 00
; Barcode command and data length
05
; Barcode type k = Code 39
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
03
; Control flags c
31 32 41 42 24 25 2E
; Barcode Data
example 20: Code 128, CD: Printer, HRI: print, using Data Character Set A
1B 28 42 10 00
; Barcode command and data length
06
; Barcode type k = Code 128
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
01
; Control flags c
41 32 33 40 41 21 43
; Barcode Data
44 5B 5D
;
example 21: Code 128, CD: Printer, HRI: print, using Data Character Set B
1B 28 42 10 00
; Barcode command and data length
06
; Barcode type k = Code 128
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
01
; Control flags c
42 32 33 40 61 42 63
; Barcode Data
44 5B 5D
;
R-96
Printing Bar Codes
example 22: Code 128, CD: Host, HRI: none, using Data Character Set B
1B 28 42 10 00
; Barcode command and data length
06
; Barcode type k = Code 128
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
02
; Control flags c
42 32 33 40 61 42 63
; Barcode Data
44 5B 5D
;
example 23: Code 128, CD: Host, HRI: print, using Data Character Set C
1B 28 42 11 00
; Barcode command and data length
06
; Barcode type k = Code 128
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
43 30 31 32 33 34 35
; Barcode Data
36 37 38 39
;
example 24: Code 128, CD: Host, HRI: print, using Data Character Set C
Next example is of ‘0’ added automatically, in the case of oddnumbered data.
1B 28 42 10 00
; Barcode command and data length
06
; Barcode type k = Code 128
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
43 31 32 33 34 35
; Barcode Data
36 37 38 39
;
Printing Bar Codes
R-97
example 25: Code 128, CD: Host, HRI: print, mixed Data Character Set A, B and C
1B 28 42 14 00
; Barcode command and data length
06
; Barcode type k = Code 128
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
7D 00
; Bar length v1, v2 = 125 / 180 inch
00
; Control flags c
41 30 62 61 64 70 1C
; Barcode Data
37 39 3A 62 1B 3D 61
;
example 26: POSTNET, CD: Host
1B 28 42 10 00
; Barcode command and data length
07
; Barcode type k = POSTNET
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
00 00
; Bar length value v1 and v2 are ignored. POSTNET
uses the fixed bar length.
00
; Control flags c
31 32 33 34 35 36 37
; Barcode Data
38 39 30
example 27: POSTNET, CD: Printer
1B 28 42 0F 00
; Barcode command and data length
07
; Barcode type k = POSTNET
02
; Module width m = 2 dots / 180 inch
00
; Space adjustment value s = +0 dots / 360 inch
00 00
; Bar length value v1 and v2 are ignored. POSTNET
uses the fixed bar length.
01
; Control flags c
31 32 33 34 35 36 37
; Barcode Data
38 39
R-98
Printing Bar Codes
Extended ESC/P 2 Programming Guide
To accommodate the high-resolution color graphics available to the Stylus
COLOR and later inkjet printer models, EPSON has expanded the ESC/P 2
command set. The Stylus COLOR and later high-resolution ink jet printers are
fully EPSON ESC/P 2 compliant. They support four multipoint fonts, the new
MicroWeave command, and four raster graphics modes:
Standard raster graphics
Uncompressed raster graphics printing (ESC . 0)
Compressed raster graphics—Run Length Encoding (RLE) (ESC . 1)
Extended raster graphics (Stylus COLOR and later inkjet models only)
Compressed raster graphics—TIFF (ESC . 2)
To select one of these four raster graphics modes, set the c parameter in the print
raster graphics command ESC . c v h m nL nH d1 . . . dk as follows:
c
0
1
2
mode
Uncompressed raster graphics
RLE compression
TIFF compression
The TIFF mode command is only implemented in the Stylus COLOR and later
inkjet model printers. These commands also make use of a subset of binary mode
commands new to the ESC/P 2 command language. The Stylus COLOR is, of
course, backward compatible with the ESC/P command language. To make full
use of the new commands and features supported by the Stylus COLOR, we
suggest writing an ESC/P 2 color printer driver specifically for this model. In
addition, all future color printers, both ink jets and SIDMs, will include the
expanded ESC/P 2 commands. By incorporating a new color printer driver in
your application, you will be able to take full advantage of the program’s
powerful color features when printing with EPSON’s high-resolution printers.
MicroWeave technology
The MicroWeave feature added to the ESC/P 2 command set reduces the
banding—uniform horizontal lines in graphics—usually associated with serial
printers. The command syntax is ESC ( i 01 00 n, where n = 0 MicroWeave off
(default), and n = 1 MicroWeave on. Banding is caused by the misalignment of
printed dots at the boundary of two adjacent raster bands owing to mechanical
limitations of the printer. MicroWeave technology compensates for these
limitations by moving the print head in smaller vertical increments than the
height of a non-MicroWeave raster band and firing the nozzles in a staggered
sequence. This process shortens the band heights, making them less distinct.
To use MicroWeave, the band height (m) in the ESC . command must be set to 1.
This feature also increases printing time, but it completely eliminates banding
and yields sharp, near photographic-quality color images. For more information
about this command, see its description in Individual Command Explanations.
Extended ESC/P 2 Programming Guide
R-99
Monochrome printing support
Black and white printing support for the Stylus COLOR can be achieved most
easily by renaming an existing ESC/P 2 monochrome driver. The ESC/P 2
command language implements four scalable multipoint fonts: Roman, Sans
Serif, Roman T, and Sans Serif H not available to ESC/P printers. In addition,
ESC/P 2 printers support compressed graphics printing. In the monochrome
multipoint mode, the Stylus COLOR printer supports the same four multipoint
fonts available to current EPSON ESC/P 2 printers, including the LQ-150
(ActionPrinter 3260), LQ-570+ (ActionPrinter 5000+), LQ-1070+, Stylus 400,
Stylus 800+, Stylus 1000, Stylus 800, and Stylus 300. However, in order to access
the new extended raster graphics compressed modes, the driver should
incorporate the latest ESC/P 2 commands, including ESC . 2.
Color bit-image graphics support
The best way to support color printing on the Stylus COLOR is to write a new
driver that includes all of the expanded ESC/P 2 commands available to the
Stylus COLOR and other high-resolution EPSON printers. A simpler although
less desirable method of supporting color printing would be to rename an
existing ESC/P color driver. Driver examples include the LQ-860 or LQ-2550.
This method would support the Stylus COLOR as an older ESC/P bit-image
printer but would seriously limit its high-resolution printing capabilities and
deny access to other advanced features such as multipoint fonts, raster graphics
data compression (RLE or TIFF), and MicroWeave.
ESC/P 2 color multipoint font support
Color multipoint font ESC/P 2 drivers can be developed by adding the select
print color command (ESC r n) to existing black and white ESC/P 2 drivers. In
multipoint mode, insert the select print color command using the values below.
n
0
1
2
3
4
5
6
color
Black (default)
Magenta
Cyan
Violet
Yellow
Red
Green
The Stylus COLOR uses process color inks—Cyan, Magenta, Yellow, and Black
(CMYK)—to produce other colors, including Violet, Red, and Green. Existing
printer drivers that can be modified to support color multipoint fonts are the LQ150 (ActionPrinter 3260), LQ-570+ (ActionPrinter 5000+), LQ-1070+, Stylus 400,
Stylus 800+, Stylus 1000, Stylus 800, and Stylus 300. For more information, see
programming Example 1: ESC/P 2 color multipoint font driver. Also see the ESC
r command description in Individual Command Explanations.
R-100
Extended ESC/P 2 Programming Guide
ESC/P 2 MicroWeave color raster graphics and RLE compressed raster graphics
Color raster graphics printing with MicroWeave requires the addition of the
MicroWeave command “ESC ( i 01 00 n” and the select color command “ESC r n”
to an existing monochrome raster graphics driver. Only four colors are available
when printing raster graphics.
n
0
1
2
4
color
Black (default)
Magenta
Cyan
Yellow
Note:
If you change the selected colors after entering raster graphics mode, the data
buffer will be flushed.
Any of the following printer drivers can be modified to support MicroWeave
color raster graphics printing: Stylus 400, Stylus 800+, Stylus 1000, Stylus 800,
Stylus 300, LQ-570+ (ActionPrinter 5000+), LQ-1070+, LQ-150 (ActionPrinter
3260), and LQ-100 (ActionPrinter 3250). This mode can access the highest
printing resolution (720 by 720 dpi) featured on EPSON’s latest color ink jet
printers, such as the Stylus COLOR. See Example 2: MicroWeave ESC/P 2 color
raster graphics and RLE compressed raster graphics driver for more information.
ESC/P 2 MicroWeave color extended raster graphics—TIFF
With the introduction of the Stylus COLOR, new compression method—TIFF—
has been added to the existing ESC/P 2 graphics command set. To enter TIFF
compressed mode, select the ESC . 2 extended raster graphics command. This
compression architecture saves up to five bytes of overhead per raster line.
Note:
In TIFF compressed mode, the band height (m) must always be set to 1. In this
setting, one raster line prints at a time.
The new compression mode supports the Stylus COLOR’s and later inkjet
printers’ maximum resolution of 720 by 720 dpi and MicroWeave. The ESC . 2
extended raster graphics compression commands make use of a subset of binary
mode commands new to ESC/P 2. These commands, which reduce the amount
of code data that must be sent to the printer, are explained below.
Extended ESC/P 2 Programming Guide
R-101
Binary mode commands
The following binary commands are applicable to the TIFF compressed mode. All
other commands are ignored after entering extended raster graphics.
<XFER>
<MOVX>
<MOVY>
<COLR>
<CR>
<EXIT>
<MOVXBYTE>
<MOVXDOT>
Transfer raster graphics data
Set relative horizontal position
Set relative vertical position
Select printing color
Carriage return to left-most print position
Exit TIFF compressed mode
Set <MOVX> unit to 8 dots
Set <MOVX> unit to 1 dot
The binary mode commands are divided into three classes:
Class
1
2
3
Description
command without parameter
command with parameter
command with parameter and data
Bit assignments
Bit assignments for the binary mode commands are as follows:
Class 1 commands (without parameter)
Bits 0–3
Command ID
Bit 4
Flag bit
Bits 5–7
Opcode
Class 2 commands (with parameter)
Bits 0–3
Parameter or counter
Bit 4
Flag bit
Bits 5–7
Opcode
Class 3 commands (with parameter and data)
Bits 0–3
Definition changes based on bit 4
Bit 4 = 0
Bits 0–3 are twos complement parameter
Bit 4 = 1
Bits 0–3 are parameter byte count
Bits 5–7
Opcode
R-102
Extended ESC/P 2 Programming Guide
System level commands
Class
Command
High
Low
Description
nibble nibble
1
<CR>
1110 0010 Move to left most position (x = 0)
1
<EXIT>
1110
0011 Exit TIFF binary mode
1
<MOVXBYTE> 1110 0100 Horizontal (x) moves are in bytes
1
<MOVDOT>
1110 0101 Horizontal (x) moves are in dots
Movement commands
Class
Command
High
Low
Description
nibble nibble
2
<MOVX>
0100 Count Move –8 to +7 units (dots/bytes), default is
dots
2
<MOVX>
0101
#BC Move ±# units (dots/bytes), default is dots
2
<MOVY>
0110 Count Move 0 to 15 units
2
<MOVY>
0111
#BC Move # units
Graphics commands
Class
Command
High
Low
Description
nibble nibble
3
<XFER>
0010 Count Transfer 1–15 bytes of graphics data
3
<XFER>
0011
#BC Transfer # bytes of graphics data
3
<COLR>
1000 Color C,M,Y,K = 2, 1, 4, 0
Note:
When the color setting is changed with the <COLR> command, the print head
moves to the left-most position (x = 0).
See Example 3 and the following feature comparison table for further
information.
EPSON ESC/P Printer Feature Comparison Table
Stylus
LQ-150
LQ-570+
COLOR
(AP-3260)
(AP-5000+)
Serial Printer
112 nozzle
24-pin
24-pin
Technology
ink jet
impact
impact
Multipoint Fonts
4
4
4
Compressed Raster
TIFF, RLE
RLE
RLE
Graphics
Color
Yes
Yes
No
MicroWeave
Yes
No
No
Max. Resolution (dpi) 720 × 720/
360 × 180/
N/A/360 ×
Color/Mono
360
720 × 720
360 × 360
Top/Bottom Margins
3/13 mm
5.3/9 mm
5.3/9 mm
LQ-860/
LQ-2550
24-pin
impact
0
None
Stylus 300/
800/1000
24-nozzle
ink jet
4
RLE
Yes
No
360 × 180/
360 × 360
8.5/13.5 mm
No
No
N/A/
360 × 360
3/13 mm
Note:
Color printing is not available with the LQ-570+ (AP-5000+), Stylus 300, Stylus
400, Stylus 800, Stylus 800+, and Stylus 1000.
Extended ESC/P 2 Programming Guide
R-103
Programming examples
This section provides several programming examples that take advantage of the
new features of the Stylus COLOR and later printer models. The following
examples are not inclusive. Therefore, the specific driver commands you use will
depend on the application.
Example 1:
Step 1
ESC/P 2 color multipoint font driver
Start Job
ESC @
Step 2
Set Specific Configuration
ESC ( U
ESC ( t
ESC ( C
ESC ( c
ESC X
ESC l & ESC Q
ESC =
Step 3
absolute position in units
relative position in units
carriage return
Output Text
ESC r n
R-104
absolute position in units
relative position in units
line feed
form feed
Adjust Horizontal Print Position (if necessary)
ESC $
ESC \
CR
Step 5
set units
assign character table
set page length in defined unit—continuous paper only
set page format—top and bottom margins
set pitch before setting left and right margins (ESC P, ESC M,
ESC g)
set left and right margins
set line spacing n/360”
Adjust Vertical Print Position (if necessary)
ESC ( V
ESC ( v
LF
FF
Step 4
initialize the printer, reset printer to defaults
select printing color
where
n = 0 Black
1 Magenta
2 Cyan
3 Violet
4 Yellow
5 Red
6 Green
Extended ESC/P 2 Programming Guide
ESC t
ESC X
ESC k
ESC 4 & ESC 5
ESC E & ESC F
ESC ( ESC q
select character table
select font by pitch and point—multipoint mode
select typeface (see ESC k command description for latest font
parameters)
italic on/off
bold on/off
select line/score
character style—outline/shadow
Send data to be printed
Repeat as necessary within line
Signal end of line—use CR, LF, or vertical positioning
Step 6
Repeat Above as Necessary within Page
Step 7
End Page
Send FF command
Prompt user for paper if in single-sheet mode
Step 8
End Job
ESC @
Example 2:
Step 1
MicroWeave ESC/P 2 standard color raster graphics and RLE
compressed raster graphics driver
Start Job
ESC @
Step 2
reset printer to defaults
initialize the printer, reset printer to defaults
Enter Raster Graphics Mode
ESC ( G
select graphics mode
Note:
• The appropriate driver commands depend on the application.
•
Step 3
New or expanded ESC/P 2 commands are shown in bold.
Set Specific Configuration
ESC ( i 01 00 n
turn MicroWeave on/off
where
n = 0 MicroWeave off
1 MicroWeave on
Note:
• If the EPSON ESC/P 2 printer does not support MicroWeave, it will ignore
the ESC ( i command. High-resolution color printers, including the Stylus
COLOR, support MicroWeave.
•
Execute the ESC ( i command prior to paper feed.
Extended ESC/P 2 Programming Guide
R-105
ESC ( U
ESC ( C
ESC ( c
ESC U
set units
set page length in defined unit—continuous paper only
set page format—top and bottom margins
turn unidirectional mode on/off
Adjust Vertical Print Position (if necessary)
ESC ( V
ESC ( v
LF
FF
Step 4
Adjust Horizontal Print Position (if necessary)
ESC $
ESC \
CR
Step 5
absolute position in units
relative position in units
line feed
form feed
absolute position in units
relative position in units
carriage return
Output Raster Graphics
ESC \
ESC r n
ESC .c
relative horizontal position in units
select printing color
where
n = 0 Black
1 Magenta
2 Cyan
4 Yellow
print raster graphics data
where
c = 0 uncompressed raster graphics
1 compressed raster graphics (RLE)
Note:
Use data compression whenever possible to reduce file size and printing time.
CR
carriage return
Repeat steps as necessary within a graphics block—start with yellow and then
follow command sequence with magenta, cyan, and black. If necessary, signal the
end of the graphics band with a CR, LF, or vertical positioning command.
Step 6
Repeat Above as Necessary within Page
Send FF command
Prompt user for paper if in single-sheet mode
Step 7
End Job
ESC @
R-106
reset printer to defaults (exit raster graphics mode)
Extended ESC/P 2 Programming Guide
Example 3:
Step 1
MicroWeave ESC/P 2 extended color raster graphics and TIFF
compressed raster graphics driver
Start Job
Send ESC @ to initialize the printer, reset printer to defaults
Step 2
Enter Raster Graphics Mode
Send ESC ( G to select graphics mode
Note:
• The appropriate driver commands depend on the application.
•
Step 3
New or expanded ESC/P 2 commands are shown in bold.
Set Specific Configuration
Send ESC ( i 01 00 n to turn MicroWeave on/off
where n = 0 MicroWeave off
1 MicroWeave on
Note:
• If the EPSON ESC/P 2 printer does not support MicroWeave, it will ignore
the command. The Stylus COLOR supports MicroWeave.
•
Execute the ESC ( i command prior to paper feed.
Send:
ESC ( U
ESC ( C
ESC ( c
ESC U
Step 4
to set units
to set page length in defined unit—continuous paper only
to set page format—top and bottom margins
to turn unidirectional mode on/off
Enter TIFF Raster Graphics Mode
Send ESC . 2 to enter TIFF compressed raster graphics mode
Note:
Only binary commands can be used after entering TIFF compressed mode.
Send <MOVXDOT> or <MOVXBYTE> to set horizontal move units to one dot
or eight dots (1 byte)
Send <MOVY> to move vertically to first line of the image block
Send <COLR> to select color (Black, Magenta, Cyan, or Yellow)
Send <MOVX> or <CR> to move horizontally to first part of image
block
Send <XFER> to send TIFF raster graphics data
Repeat as necessary for the existing line of the image block.
Repeat as necessary for the existing image block
Extended ESC/P 2 Programming Guide
R-107
Step 5
Repeat Above as Necessary within Page
Step 6
End Page
Send <EXIT> to exit TIFF compressed raster graphics mode
Send FF command—eject paper
Prompt user for paper if in single-sheet mode
Step 7
Repeat Above as Necessary for the Job
Step 8
End Job
Send ESC @ to reset printer to defaults (exit raster graphics mode)
TIFF mode programming sequence
R-108
Extended ESC/P 2 Programming Guide