The copyrights in this manual and the label print engine described therein are
owned by Zebra Technologies Corporation. Unauthorized reproduction of this
manual or the software in the label print engine may result in imprisonment of up
to one year and fines of up to $10,000 (17 U.S.C.506). Copyright violators may be
subject to civil liability.
ZebraLink and all product names and numbers are trademarks, and Zebra, the
Zebra logo, ZPL, ZPL II, Element Energy Equalizer Circuit, and E3 Circuit are
registered trademarks of ZIH Corp. All rights reserved worldwide.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
About This Document
2
Who Should Use This Document
Who Should Use This Document
This Programming Guide is intended for use by any person who needs to perform routine
maintenance, upgrade, or troubleshoot problems with the printer.
How This Document Is Organized
The Programming Guide is set up as follows:
SectionDescription
About This Document on page 1This section provides you with contact information, document
structure and organization, and typographical conventions used
in this document.
ZPL II Basics on page 5This section provides basic information about Zebra
Programming Language II (ZPL II).
Programming Exercises on page 19This section provides exercises that show you how to use
ZPL II.
Advanced Techniques on page 39This section presents information and commands for using
advanced techniques, such as special effects, serialized data
fields, control commands, program delimiters, communications,
and memory cards.
Fonts and Bar Codes on page 59This section provides information about different fonts (type
faces) and bar codes that can be used with the printer.
Printer Configuration Using ZPL II
on page 71
XML—Super Host Status on page 77This section provides information about XML—Super Host
Real Time Clock on page 93This section discusses the ZPL II commands related to the Real-
Mod 10 and Mod 43 Check Digits
on page 95
Error Detection Protocol on page 99This section explains the Zebra protocol that has been
ZB64 Encoding and Compression
on page 109
Code Page 850 Chart on page 115This section shows the Code Page 850 character set used by
This section discusses how to use the ZPL II printer
configuration commands.
Status.
Time Clock (RTC).
This section provides information about Mod 10 and Mod 43
check digits.
supplanted in TCP/IP based applications because of the error
detection compatibility inherent in the TCP/IP protocol.
This section describes the Base 64 MIME (ZB64) encoding and
compression. This is the same type of MIME encoding that is
used in e-mail.
Zebra printers.
ASCII Code Chart on page 119This section shows the American Standard Code for Information
Interchange (ASCII) code used by Zebra printers.
AIM Contact Information on page 121This section provides contact information for AIM (Association
for Automatic Identification and Mobility).
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Contacts
You can contact Zebra Technologies Corporation at the following:
Visit us at: www.zebra.com
Our Mailing Addresses:
Zebra Technologies Corporation
333 Corporate Woods Parkway
Vernon Hills, Illinois 60061.3109 U.S.A
Telephone: +1 847.634.6700
Fax: +1 847.913.8766
Zebra Technologies Europe Limited
Zebra House
The Valley Centre, Gordon Road
High Wycombe
Buckinghamshire HP13 6EQ, UK
Telephone: +44 (0)1494 472872
Fax: +44 (0)1494 450103
About This Document
Contacts
3
Support
You can contact Zebra support at:
Web Address: www.zebra.com/SS/service_support.htm
Note • The web address is case-sensitive.
US Phone Number +1 847.913.2259
UK/International Phone Number +44 (0) 1494 768289
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
About This Document
4
Document Conventions
Document Conventions
The following conventions are used throughout this document to convey certain information.
Alternate Color (online only) Cross-references contain hot links to other sections in this
guide. If you are viewing this guide online in .pdf format, you can click the cross-reference
(blue text) to jump directly to its location.
LCD Display Examples Text from a printer’s Liquid Crystal Display (LCD) appears in
Bubbledot ICG font.
Command Line Examples Command line examples appear in Courier New font. For
example, type
Files and Directories File names and directories appear in Courier New font. For
example, the
Icons Used
Caution • Warns you of the potential for electrostatic discharge.
ZTools to get to the Post-Install scripts in the bin directory.
Zebra<version number>.tar file and the /root directory.
Caution • Warns you of a potential electric shock situation.
Caution • Warns you of a situation where excessive heat could cause a burn.
Caution • Advises you that failure to take or avoid a specific action could result in physical
harm to you.
Caution • (No icon) Advises you that failure to take or avoid a specific action could result in
physical harm to the hardware.
Important • Advises you of information that is essential to complete a task.
Note • Indicates neutral or positive information that emphasizes or supplements important
points of the main text.
Example • Provides an example, often a scenario, to better clarify a section of text.
Tools • Tells you what tools you need to complete a given task.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
1
ZPL II Basics
This section provides basic information about Zebra Programming Language II (ZPL II).
ZPL II is a powerful label-definition and printer-control language. Labels may be defined in
ZPL II and generated by a host computer system. A commercial label preparation system or a
software package that automatically generates ZPL II code also may be used. For information
about label preparation systems, consult your distributor, systems integrator, or computer
software vendor.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
ZPL II Basics
6
How ZPL II Differs from ZPL
How ZPL II Differs from ZPL
ZPL II substantially reduces the time between when a printer begins receiving label format
data and when the first label begins to print. This was accomplished primarily by changing the
way ZPL scripts are written.
ZPL II scripts are not 100 percent compatible with standard ZPL scripts. However, the
differences between ZPL II and standard ZPL scripts are minor. Most existing standard ZPL
scripts can be modified easily to take advantage of ZPL II. You can also write ZPL II scripts
that are compatible with standard ZPL printers.
These are the major differences between ZPL and ZPL II:
• With ZPL II, all data fields are formatted as they are received. In standard ZPL, the data
fields are not processed until after the ^XZ (End Format) command is received.
• Many new commands and significant enhancements to existing commands were added
into the ZPL II language.
To take advantage of ZPL II, the following ZPL II commands, if used, must come before the
first ^FD (Field Data) command in a label format. If these commands are not placed before the
first ^FD command, the label may not print correctly.
^JM ^LH ^LL ^LR ^LS ^PM ^PR ^PF
ZPL II commands can be entered in either uppercase characters, lowercase characters, or a
combination of both.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
ZPL II Overview
ZPL II is Zebra Technologies Corporation’s registered trademark for its Zebra Programming
Language II. ZPL II commands sent to a Zebra printer give you the ability to create a wide
variety of labels from the simple to the very complex. The labels can include any combination
of text, bar codes, and graphics.
ZPL II contains a variety of printable character font styles and bar codes. Various ZPL II
commands let you position print fields anywhere on a label horizontally or rotated 90, 180, or
270 degrees clockwise. Graphic images can be read and interpreted, provided that they are in a
binary or hexadecimal format. Therefore, if you can convert a scanned or computer-generated
image (an image created using a draw or paint software program) into hexadecimal format,
you can print it on a label. You can use the ZTools™ for Windows program (available from
Zebra) to convert the bitmap graphic into the pure hexadecimal graphic format.
ZPL II commands consist of a prefix character, a two-character mnemonic code, and where
applicable, a parameter string. The entire language is programmable in printable ASCII
characters, which allows easy passage of formats and data through computer networks and
protocol converters. ZPL II commands do not use escape sequences or control codes. A few
commands do have ASCII control code equivalents, which are noted as they apply.
ZPL II Basics
ZPL II Overview
7
ZPL II is both powerful and flexible, providing all of the following features:
• compatibility with PCs, minicomputers, mainframe computers and networks
• serialized label fields, with user-selected starting value and increment/decrement value
• programmable label replicate count, batch quantity control, and printer pauses that enable
batching of labels into usable groups
• simple line graphics to eliminate label preprinting
• scalable fonts
• bitmap image graphics, with library function capability (to store more than one graphic
and recall as needed), for freeform graphic designs
You can create and use ZPL II scripts (label formats) one at a time from any word processor
capable of generating an ASCII text file. You can integrate your Zebra printer into your
operations by using database programs and other languages to generate ZPL II programs. The
ZPL II program is then sent to the Zebra printer through an appropriate interface (combination
of proper cabling, printer configuration, and software settings). The examples in this guide use
printable ASCII characters in all commands, unless otherwise noted.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
ZPL II Basics
8
Format and Control Commands
Format and Control Commands
There are two different types of ZPL II commands:
• Format commands use the caret (^) prefix. The caret (^) is a single printable ASCII
character having the code 5E HEX or 94 decimal. An “RS” (HEX 1E) can be substituted
for the caret (^).
In ZPL II commands, the caret (^) is treated as an ordinary ASCII character. In this
manual, when you see the caret (^), it indicates that you are to type the caret (^) character.
The caret (^) character is not to be confused with pressing the Control (Ctrl) key on the
keyboard.
• Control commands use the tilde (~) prefix. The tilde (~) is a single printable ASCII
character having the code 7E HEX or 126 decimal. A “DLE” (HEX 10) can be substituted
for the tilde (~).
A few ZPL II commands can be sent to the printer as either a format command or a control command. The action performed by the printer will be the same in either case. These
commands must be preceded by the appropriate prefix (^ or ~) for the context in which they
are used. For example, the prefix characters for format (~) and control (^) commands can be
changed using ZPL II the following commands:
• ^CT or ~CT (change tilde)
• ^CC or ~CC (change caret)
Format Commands
Format commands are the blueprint of a label. These commands define label length, field
origin, type of field, field data, and other information. Format commands are always preceded
by the caret (^) character.
All format commands are processed in the order received, and most format commands are
“order-independent.” For example, commands to print text at the bottom of a label can come
before the command to print a bar code at the top of the same label. However, some format
commands must be placed before others within the label format. These are:
• ^LH (label home)
• ^LL (label length)
• ^LR (label reverse)
• ^LS (label shift)
• ^JM (set dots/millimeter)
• ^PM (mirror image)
• ^PO (print orientation)
• ^PF (slew dot rows)
Proper usage of these commands is explained in ZPL II Programming Guide Volume One.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Multiple label formats are processed in the order the printer receives them. Format commands
fall into several categories:
• format bracket commands
• label definition commands
• field definition commands
• field default commands
• format default commands
• format rotation commands
• printer control commands
• alphanumeric field commands
• bar code field commands
• graphic image commands
Control Commands
ZPL II Basics
Format and Control Commands
9
Control commands are usually preceded by a tilde (~) character. In most cases, these
commands cause the printer to take a specific action immediately, such as clearing the memory
or feeding a blank label. Control commands may interrupt and preempt any format commands
waiting in the printer’s received data buffer.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
ZPL II Basics
10
Command Parameters and Default Values
Command Parameters and Default Values
Many ZPL II commands have parameter strings associated with them. Changing the value of
one or more of these parameters affects the outcome of the printed label.
If the default value for a command parameter works well for the code you are writing, you do
not need to specify that parameter. However, parameters are “position-specific.” For example,
if you want to change only the third parameter, you must indicate which parameter to change.
To do so, use a comma (the ZPL II delimiter character) to mark each parameter’s place. The
code below sets the third parameter:
^AA,,60
If you enter a parameter, all further parameters to the right are defaulted; no further commas
are required.
Some commands include the following abbreviation: {I.V.P. =} This signifies the Initial Value
at Power-up, regardless of the value when the printer was turned off.
To permanently save configuration settings in the printer’s configuration memory; send a
^JUS command at the end of the ZPL II script. For more information on using the ^JU
command, refer to ZPL II Programming Guide Volume One.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Example of a Basic Label
This example shows the basic steps to create a common label that contains text and a bar code.
Type the programming commands (shown in bold) in the order given. An explanation of what
each command does is in brackets [ ]. Figure 1 shows a printed example of the label and shows
the ZPL II commands that generated each feature.
^XA
[^XA indicates start of label format.]
^LH30,30
[^LH sets label home position 30 dots to the right and 30 dots down from the top edge of
the label.]
^FO20,10^AD^FDZEBRA^FS
[^FO20,10 sets the field origin 20 dots to the right and 10 dots down from the home
position defined by the ^LH command.]
[^AD – Select font “D.”]
[^FD – Start of field data.]
[ZEBRA – Actual field data.]
[^FS – End of field data.]
ZPL II Basics
Example of a Basic Label
11
^FO20,60^B3^FDAAA001^FS
[^FO20,60 – Set field origin 20 dots to the right and 60 dots down from the home
position defined by the ^LH command.]
[^B3 – Select Code 39 bar code.]
[^FD – Start of field data for the bar code.]
[AAA001 – Actual field data.]
[^FS – End of field data.]
^XZ
[^XZ – Indicates end of label format.]
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
ZPL II Basics
12
Example of a Basic Label
Figure 1 • Basic Label
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Shortcuts for Writing ZPL II Scripts
Shortcuts for Writing ZPL II Scripts
ZPL II programming scripts can be written in a variety of ways. There are, however, more
efficient ways to write a ZPL II script depending on the application and the commands used.
The following are different ways to write the same ZPL II scripts, each yielding the same
results.
Writing Code on One Line and Using Parameter Defaults
A Code 39 bar code (^B3) example can have the ZPL II script written as:
^XA^FO100,75^BY3
^B3N,N,100,Y,N
^FD123ABC^XZ
However, because it contains only one field, the entire command can be written as a one-line
entry:
^XA^FO100,75^BY3^B3N,N,100,Y,N^FD123ABC^XZ
This script can be further simplified by using just the comma (,) delimiter to indicate default
parameters in the ^B3 command. Leaving off the last two values indicates that default
parameters are to be used at the end of the ^B3 command:
ZPL II Basics
13
^XA^FO100,75^BY3^B3,,100^FD123ABC^XZ
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
ZPL II Basics
14
Shortcuts for Writing ZPL II Scripts
Eliminating Unnecessary Field Separators
You can write your ZPL II scripts in any way that makes sense to you. Some programmers
prefer to write out each format command and field on a separate line like this:
Although this script will print with no problems, it contains unnecessary ^FS (Field Separator)
commands after the format commands. Some programmers feel that it is required to place a
^FS command at the end of each line, but the ^FS command is only needed to separate
specific fields. Therefore, the script would transmit more quickly written this way:
Other programmers prefer to keep the format commands on one line as an organizational
preference, like this:
^XA^PR2^LL935^LH30,30
^FO20,10^AF^FDZEBRA^FS
^FO20,60^B3,,40^FDAA001^FS
^FO20,180^AF^SNSERIAL NUMBER 00000000111,1,Y^FS
^PQ10^XZ
The label will print out the same, so you should develop a scripting pattern that suits your own
organizational style but one that is efficient and keeps transmission times to a minimum.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Font Shortcuts
There are times when you might include a specific font into your script and use it repeatedly
within different fields. The following is an example of one way to write this script:
Notice that the ^FS command is used on the second to last line to close the field. Actually, it is
unnecessary because the ^XZ will accomplish the same thing, so we can remove it from our
script. Also, because the font and font size are not changing within the fields, this script can be
simplified for quicker transmission by removing the unnecessary font entries and listing the
font information once using the ^CF command:
This script can be made even more efficient by including the ^FB command to identify the left
origin of the text, which occurs at the same place each time:
Note • The entries “\&” within the text indicate a carriage return/line feed as allowed by the
^FB command.
If you wanted to change the font type or size within the script, however, you would need to
include the specific font parameters within the field where the change occurs. In this case, you
would not want to use the ^FB command because the change in font size (in our example
below) will affect the y-axis (up and down) position of the text. You can still use the ^CF
command, but you will need to include the specific font information on the line where the
change in the field occurs:
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
ZPL II Basics
16
Using Device and Object Names
Using Device and Object Names
This section describes how device and object names can be used with commands that have a
name parameter.
Device Names
Device names have been assigned to the various printer memory devices (such as the DRAM,
RAM, EPROM) to allow for easy identification of the devices. Using device names allows for
storage, recall, copy, and deletion of ZPL II objects (for example, graphic images, label
formats, and downloaded fonts) to and from specific areas.
A device name is a single letter followed by a colon. The printer devices are:
R: Printer DRAM library (read/write)
B: Optional memory (a card or factory installed)
E: Flash memory (read/write)
Z: Internal ZPL II stored object library (read only)
When recalling objects, the following search priority is used: DRAM, RAM, extra EPROM,
internal ZPL II (R:, B:, E:, Z:, * or ? (All)).
Several ZPL II commands use device names as an optional parameter. The default value may
vary with the individual ZPL II commands. The default for the creation and deletion of objects
is printer DRAM.
For more information about memory devices, see Memory, Flash Cards, and Font Cards
on page 56.
Object Names and Extensions
Each ZPL II object (graphic image, label format, downloaded font) must have a name. This
name consists of two parts: an Object Name and an Extension. Object names can be 1 to 8
alphanumeric characters in length. Extensions consist of a period followed by 3 predefined
characters. Object name conventions and extensions are similar to MS-DOS file name
conventions and extensions.
Several ZPL II commands use these object names. Object names have no default and must be
supplied. Extensions have the defaults defined below. Depending on the ZPL II command, if
an extension is missing, incomplete, or incorrect, a default will be used. Defined extensions for
ZPL II Object names, along with their related ZPL II commands are:
.ZPL ZPL II label format (^DF or ^XF)
.FNT fonts in Zebra format (~DB or ~DS)
.GRF Zebra bitmap format (~DG, ^IS, ^IL, ^XG or ^IM)
Depending on the ZPL II command, the Object name and Extension may support the use of the
asterisk (*) and question mark (?) as wild cards.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Name Parameter
The device names and object names just described can be used with ZPL II commands that
support a name parameter. The commands are:
~DG Download Graphic Image
^XG Recall Graphic Image
^IS Store format as a graphic image
^IL Load Image
^IM Move Image
^DF Store ZPL II format as text
^XF Recall ZPL II format
^ID Image Delete
^HW Host Directory List
^WD Print Directory
~DB Download Bitmap
~DS Download Scalable Font
ZPL II Basics
Using Device and Object Names
17
The name parameter can consist of an alphanumeric string of from 1 to 8 characters or of a
string containing a Device Name followed by an Object Name with an Extension. Defaults
and/or use of the asterisk (*) and question mark (?) as wild cards will be defined with the
individual command.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
20
Introduction to Exercises
Introduction to Exercises
These programming exercises are included to assist and instruct both the new and more
experienced user in the proper use of ZPL II commands. The exercises are simple by design,
so they can be completed quickly. New users may find it helpful to complete all of the
exercises. More experienced users may want to refer only to exercises detailing the use of
specific commands or features. Most exercises are “stand-alone” and can be completed
individually. However, some exercises assume that you have completed a previous exercise
(such as exercises that erase a previously saved graphic image).
Note • Note the following as you do the exercises
• Factory default printer settings were used for the examples in this guide, and the printer is
set up for tear-off operation.
• The actual size of your printed examples may be different than those shown in this guide.
The important thing is that the information displayed is the same.
Computer and Software Requirements
The exercises are designed for a Zebra printer controlled by a “stand-alone” (not part of a
network) IBM
However, a Zebra printer also may be controlled by mainframes or minicomputers.
The ZPL II language uses only printable ASCII characters. Any word processor or text editor
capable of creating ASCII-only files (files without formatting codes and other extraneous
information) can be used to create the scripts in these examples. For instance, if you are using
Microsoft Word
®
-compatible personal computer because of its relative familiarity among users.
®
, save your scripts as text files (.txt).
Performing the Exercises
Before beginning the exercises, load the printer with media and ribbon (if used) and make sure
that the printer is properly adjusted for the media. If you are unfamiliar with these procedures,
refer to the printer’s User Guide for assistance.
The examples shown in this guide assume a media size of at least 80 mm wide and 60 mm
long. Media of different sizes can be used; however, parameters affecting size or location of
printed data may need to be modified. If you use continuous media for the examples, set the
label length by adding the command sequence ^LL480^FS after the ^XA command line.
Both of these commands are covered in detail in ZPL II Programming Guide Volume One.
Each exercise has two parts: the actual commands sent to the printer and the results (usually in
the form of a printed label) of those commands. Type the commands exactly as you see them.
When you finish typing a line, press the
Continue this process for all of the lines in the example.
RETURN or ENTER key, and then type the next line.
If a script is in two or more portions, save the two parts as separate .txt files. Send the first
portion to the printer, and wait to see the results. Then send the next potion, and wait again to
see the results. Depending on the exercise, a result may be data uploading to the printer
indicated by a flashing LED (if available on your printer) or a sample label printing.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Exercise 1 • Saving Label Formats as Graphic Images
This exercise illustrates how to save a label format as a graphic image in printer RAM and then
recall (load) for printing a label format that has been previously saved. The exercise consists of
two scripts. The first contains a label format and the commands necessary to save the format as
a graphic image. The second recalls and prints the label format that was saved as the graphic
image.
While this exercise utilizes the ^IL command to load a graphic image, the ^IM command may
also be used. These two commands differ in that images loaded using the ^IL command are
always positioned relative to the ^FO0,0 (Field Origin) command. The ^IM command places
the image anywhere on the label as specified by an ^FO command preceding it.
The ZPL II commands sent to the printer are:
^XA
^LH30,30
^FO20,10^AFN,56,30^FDZEBRA^FS
^FO20,80^B3N,Y,20,N,N^FDAAA001^FS
^FO10,160^GB150,100,4^FS
Programming Exercises
Introduction to Exercises
21
^ISR:EXERPROG.GRF,N
^XZ
^XA^ILR:EXERPROG.GRF^XZ
Programming Commands
Type the commands (shown in bold) in the order given. An explanation of what each
command does is in brackets ( [ ] ).
^XA
[^XA - Indicates start of label format.]
^LH30,30
[^LH - Sets label home position 30 dots to right and 30 dots down from top edge of label.]
^FO20,10^AFN,56,30^FDZEBRA^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F” and sets character size to 56 dots high and 30 dots wide.]
[^FD - Start of field data.]
[ZEBRA- Actual field data.]
[^FS - End of field data.]
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
22
Introduction to Exercises
^FO20,80,^B3N,Y,20,N,N^FDAAA001^FS
[^FO - Set field origin relative to label home.]
[^B3N,Y,20,N,N - Select Code 39 bar code. Calculate check digit, do not print
interpretation line.]
[^FD - Start of field data for bar code.]
[AAA001 - Actual field data.]
[^FS - End of field data.]
^ISR:EXERPROG.GRF,N
[^IS - Save format as a graphic image named “EXERPROG.GRF,” do not print after
saving.]
^XZ
[^XZ - Indicates end of label format.]
(Data is uploaded to printer RAM.)
^XA^ILR:EXERPROG.GRF,N^XZ
[^XA - Start of label format.]
[^ILR:EXERPROG.GRF - Load and print the graphic image saved as EXERPROG.GRF]
[^XZ - End of label format.]
Review
Save the file on your computer’s hard drive, and name it EXER1.ZPL. Copy the file to the
printer. Compare your results with those shown below. If your label does not look like the one
shown, confirm that the file you created is identical to the listing at the beginning of this
exercise and repeat the printing procedure.
Figure 2 • Exercise 1 Results
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Exercise 2 • Downloading and Printing Graphic Images
This exercise illustrates how to create a hexadecimal graphic image and print it as part of your
label.
To store graphic images, sufficient memory must be allocated (reserved) for them. Memory for
storing graphic images is allocated as needed. The graphic images can then be recalled and
integrated with additional label data without downloading the entire image each time a label is
printed. Graphic images are downloaded using the ~DG (Download Graphic) command along
with appropriate parameters to indicate the size of the graphic being downloaded.
Graphic images may be created using a drawing or painting program that creates files in the
.PCX format, such as PC Paintbrush. These files must then be converted to ZPL II graphic
format .GRF (pure hexadecimal data without headers or other extraneous information) for use
as part of a label format. You can use the ZTools™ for Windows program (available from
Zebra) to convert the .PCX graphic format into the pure hexadecimal .GRF graphic format.
Hexadecimal data may also be directly input as part of a ZPL II program.
The ~DG command requires parameters indicating the size of the graphic image.
Format dds~DGd,o,x,t,w,data
Programming Exercises
Introduction to Exercises
23
This table identifies the parameters for this format:
Table 1 • ~DG Format Parameters
ParametersDetails
d = destination device to
store image
o = name of image
Accepted Values: a non-volatile RAM device
Default Value: R:(DRAM)
Accepted Value: 1 to 8 alphanumeric characters
Default Value: UNKNOWN.GRF
x = filename extension
t = total number of bytes
in graphic
w = number of bytes per
row
data = ASCII
hexadecimal sting
Fixed: .GRF
Accepted Values: a non-volatile RAM device
Default Value: R:(DRAM)
Accepted Values: any integer
Default Value: None
The data string defines the image and is an ASCII hexadecimal representation
of the image. Each character represents a horizontal nibble of four dots.
defining image
Refer to the ~DG command in ZPL II Programming Guide Volume One for complete
information on calculating the total number of bytes and the number of bytes per row.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
24
Introduction to Exercises
For this exercise, create a “smile” graphic (such as the one shown below) in a drawing or paint
program so that the graphic is 1.5 inches by 1.5 inches at 200 dpi.
Save the graphic in .PCX format and name it: SMILE.PCX. Convert this file to the .GRF
format using ZTools™ for Windows.
The ZPL II commands you will use in this exercise are:
^XA and ^XZ: label format start/stop commands
^FO and ^FS: label field definition commands
^XG: recall graphic command
The ZPL II commands sent to the printer are:
~DGR:SMILE.GRF,12012,39
Depending on the image size and how the graphic was created, there will be many lines of
ASCII hexadecimal data describing your image following the ~DG command line.
^XA
^FO50,50^XGR:SMILE.GRF,1,1^FS
^XZ
Programming Commands
Type the commands shown in bold in the order they are presented. Command explanations are
provided in brackets ([explanation]).
^XA
[^XA - Indicates start of label format.]
^FO50,50^XGR:SMILE.GRF,1,1^FS
[^FO - Set field origin relative to label home.]
[^XG - Recall graphic named “SMILE” from memory with a magnification of 1:1 along X
and Y axis.]
[^FS - End of field data.]
^XZ
[^XZ - Indicates end of label format.]
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Programming Exercises
Introduction to Exercises
Review
Save this file on your computer’s hard drive, name it EXER2.ZPL. Copy the file to the printer.
Compare your results with those shown below. If your label does not look like the one shown,
confirm that the file you created is identical to the listing at the beginning of this exercise and
repeat the printing procedure.
Figure 3 • Exercise 2 Results
25
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
26
Introduction to Exercises
Exercise 3 • Setting Print Rate, Printing Quantities of Labels in an Inverted Orientation,
and Suppressing Backfeed
This exercise illustrates how to set the print speed, print a predetermined quantity of labels,
suppress backfeed for tear-off, and print entire labels in an inverted orientation.
The ZPL II commands sent to the printer are:
^XA^PR3^XZ
^XA
^LH360,30
^FO20,10^AF^FDZEBRA^FS
^FO20,60^B3^FDAAA001^FS
^POI
^PQ2
^XB
^XZ
Programming Commands
Type the commands (shown in bold) in the order given. An explanation of what each
command does is in brackets.
^XA^PR3^XZ
[^XA - Indicates start of label format.]
[^PR3 - Set print rate to 3 inches/second]
[^XZ - End of ZPL program.]
^XA
[^XA - Indicates start of label format.]
^LH360,30
[^LH - Set label home position 360 dots to right and 30 dots down from top edge of
label.]
^FO20,10^AF^FDZEBRA^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F”]
[^FD - Start of field data.]
[ZEBRA- Actual field data.]
[^FS - End of field data.]
45542L-002 Rev. AZPL II Programming Guide07/27/2005
^FO20,20,^B3^FDAAA001^FS
[^FO - Set field origin relative to label home.]
[^B3 - Select Code 39 bar code.]
[^FD - Start of field data for bar code.]
[AAA001 - Actual field data.]
[^FS - End of field data.]
^POI
[^POI - Set print orientation to invert the entire label.]
^PQ2
[^PQ2 - Set print quantity to 2 labels.]
^XB
[^XB - Suppress Backfeed for tear-off modes.]
^XZ
[^XZ - Indicates end of label format.]
Programming Exercises
Introduction to Exercises
27
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
28
Introduction to Exercises
Review
Save the file on your hard drive, and name it EXER3.ZPL. Copy the file to the printer.
Compare your results with those shown below. If your labels are not similar, confirm that your
file matches the code at the beginning of this exercise.
Figure 4 • Exercise 3 Results
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Programming Exercises
Introduction to Exercises
Exercise 4 • Slew Command, Form Feed, and Printing Entire Formats in Reverse
This exercise illustrates the slew and form feed (slew to home) commands and the commands
required for printing the entire label in reverse.
The ZPL II commands that are sent to the printer are:
^XA
^PR2
^LRY
^LH30,30
^FO0,0^GB400,300,300^FS
^FO20,10^AF^FDZEBRA^FS
^FO20,60^B3,,40^FDAAA001^FS
^PF50
^FO20,160^AF^FDSLEW EXAMPLE^FS
^XZ
29
^XA^PH^XZ
^XA
^PR2,6
^FO20,10^AF^FDZEBRA^FS
^FO20,60^B3,,40^FDAAA001^FS
^PF250
^FO20,160^AF^FDSLEW EXAMPLE^FS
^XZ
Programming Commands
Type the commands (shown in bold) in the order given. An explanation of what each
command does is in brackets.
^XA
[^XA - Indicates start of label format.]
^PR2
[^PR2 - Set print rate to speed of 2 inches/second]
^LRY
[^LRY - Reverse print entire label.]
^LH30,30
[^LH - Set label home position 30 dots to right and 30 dots down from top edge of label.]
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
30
Introduction to Exercises
^FO0,0^GB400,300,300^FS
[^FO - Set field origin relative to label home.]
[^GB - Create a filled graphic box to be used as background for reverse printed label.
(May need to adjust parameters for different media size.]
^FO20,10^AF^FDZEBRA^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F.”]
[^FD - Start of field data.]
[ZEBRA- Actual field data.]
[^FS - End of field data.]
^FO20,60^B3,,40^FDAAA001^FS
[^FO - Set field origin relative to label home.]
[^B3 - Select Code 39 bar code.]
[^FD - Start of field data for bar code.]
[AAA001 - Actual field data.]
[^FS - End of field data.]
^PF50
[Slew 50 dot rows at bottom of label.]
^FO20,160^AF^FDSLEW EXAMPLE^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F.”]
[^FD - Start of field data.]
[SLEW EXAMPLE - Actual field data.]
[^FS - End of field data.]
^XZ
[^XZ - Indicates end of format.]
^XA^PH^XZ
[Commands to feed to next home position.]
^XA
[^XA - Indicates start of format.]
^PR2,6
[^PR2 - Set print rate to speed of 2 inches/second, set slew rate to speed of 6
inches/second]
^FO20,10^AF^FDZEBRA^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F.”]
[^FD - Start of field data.][ZEBRA- Actual field data.][^FS - End of field data.]
45542L-002 Rev. AZPL II Programming Guide07/27/2005
^FO20,60^B3,,40^FDAAA001^FS
[^FO - Set field origin relative to label home.]
[^B3 - Select Code 39 bar code.]
[^FD - Start of field data for bar code.]
[AAA001 - Actual field data.]
[^FS - End of field data.]
^PF250
[^PF250 - Slew 250 dot rows.]
^FO20,160^AF^FDSLEW EXAMPLE^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F.”]
[^FD - Start of field data.]
[SLEW EXAMPLE - Actual field data.]
[^FS - End of field data.]
Programming Exercises
Introduction to Exercises
31
^XZ
[^XZ - Indicates end of format.]
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
32
Introduction to Exercises
Review
Save the file on your hard drive, and name it EXER4.ZPL. Copy the file to the printer.
Compare your results with those below. If your labels are not similar, confirm that your file
matches the code at the beginning of this exercise.
Figure 5 • Exercise 4 Results
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Exercise 5 • Using Serialized Fields
This exercise discusses the commands and parameters required to produce serialized fields as
part of a label format. The ZPL II commands sent to the printer are:
^XA
^LH30,30
^FO20,10^AF^FDZEBRA^FS
^FO20,60^B3,,40,,^FDAA001^FS
^FO20,180^AF^SNSERIAL NUMBER 00000000111,1,Y^FS
^PQ10
^XZ
Programming Commands
Type the commands (shown in bold) in the order given. An explanation of what each
command does is in brackets.
^XA
[^XA - Indicates start of label format.]
Programming Exercises
Introduction to Exercises
33
^LH30,30
[^LH - Sets label home position 30 dots to right and 30 dots down from top edge of label.]
^FO20,10^AF^FDZEBRA^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F.”]
[^FD - Start of field data.]
[ZEBRA- Actual field data.]
[^FS - End of field data.]
^FO20,60^B3,,40,,^FDAA001^FS
[^FO - Set field origin relative to label home.]
[^B3 - Select Code 39 bar code.]
[^FD - Start of field data for bar code.]
[AA001 - Actual field data.]
[^FS - End of field data.]
^FO20,180^AF^SNSERIAL NUMBER 00000000111,1,Y^FS
[^FO - Set field origin relative to label home.]
[^AF^SNSERIAL NUMBER 00000000111,1,Y- Define serialized field, starting
value of 111, increment by 1, insert leading zeros.]
[^FS - End of field data.]
^PQ10
[^PQ10 - Set print quantity to 10.]
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
34
Introduction to Exercises
^XZ
[^XZ- Indicates end of format.]
Review
Save the file to your computer’s hard drive, and name it EXER5.ZPL. Copy the file to the
printer. Compare your results with those shown below.
Figure 6 • Exercise 5 Results
A total of 10 labels should be printed. The first and last labels are shown here. If your labels do
not look like the ones shown, confirm that the file you created is identical to the listing at the
beginning of this exercise and repeat the printing procedure.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Exercise 6 • Stored Formats
This exercise illustrates the commands and parameters required to use stored formats. The
ZPL II commands sent to the printer are:
^XA
^DFFORMAT^FS
^LH30,30
^FO20,10^AF^FN1^FS
^FO20,60^B3,,40,,^FN2^FS
^XZ
^XA
^XFFORMAT^FS
^FN1^FDZEBRA^FS
^FN2^FDAAA001^FS
^XZ
Programming Exercises
Introduction to Exercises
35
^XA
^XFFORMAT^FS
^FN1^FDBEARS^FS
^FN2^FDZZZ999^FS
^XZ
Programming Commands
Type the commands (shown in bold) in the order given. An explanation of what each
command does is in brackets.
^XA
[^XA - Indicates start of label format.]
^DFFORMAT^FS
[^DF - Download and store format.]
[FORMAT - Name of format.]
[^FS - End of field data.]
^LH30,30
[^LH - Sets label home position 30 dots to right and 30 dots down from top edge of label.]
^FO20,10^AF^FN1^FS
[^FO - Set field origin relative to label home.]
[^AF - Select font “F.”]
[^FN1 - Assign field number 1.]
[^FS - End of field data.]
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Programming Exercises
36
Introduction to Exercises
^FO20,60^B3,,40,,^FN2^FS
[^FO - Set field origin relative to label home.]
[^B3 - Select Code 39 bar code.]
[^FN2 - Assign field number 2.]
[^FS - End of field data.]
^XZ
[^XZ- Indicates end of format.]
^XA
[^XA - Indicates start of label format.]
^XFFORMAT^FS
[^XF - Recall stored format.]
[FORMAT - Name of format to be recalled.]
[^FS - End of field data.]
^FN1^FDZEBRA^FS
[^FN1 - Indicate following data should be inserted in area for field number 1.]
[^FD - Indicate start of field data.]
[ZEBRA - Field data.]
[^FS - End of field data.]
^FN2^FDAAA001^FS
[^FN2 - Indicate following data should be inserted in area allocated for field number 2.]
[^FD - Indicates start of field data.]
[AAA001 - Field data.]
[^FS - End of field data.]
^XZ
[^XZ- Indicates end of format.]
^XA
[^XA - Indicates start of label format.]
^XFFORMAT^FS
[^XF - Recall stored format.]
[FORMAT - Name of format to be recalled.]
[^FS - End of field data.]
^FN1^FDBEARS^FS
[^FN1 - Indicates following data should be inserted in area allocated for field number 1.]
[^FD - Indicates start of field data.]
[BEARS - Field data.]
[^FS - End of field data.]
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Programming Exercises
Introduction to Exercises
^FN2^FDZZZ999^FS
[^FN2 - Indicates following data should be inserted in area allocated for field number 2.]
[^FD - Indicates start of field data.]
[ZZZ999 - Field data.]
[^FS - End of field data.]
^XZ
[^XZ- Indicates end of format.]
Review
Save this file to your computer’s hard drive, and name it EXER6.ZPL. Copy the file to the
printer. Compare your results with those shown below. If your labels do not look like the ones
shown, confirm that the file you created is identical to the listing at the beginning of this
exercise and repeat the printing procedure.
Figure 7 • Exercise 6 Results
37
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
45542L-002 Rev. AZPL II Programming Guide07/27/2005
3
Advanced Techniques
This section presents information and commands for using advanced techniques, such as
special effects, serialized data fields, control commands, program delimiters, communications,
and memory cards.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Special Effects for Print Fields
ZPL II includes a few “Special Effects” commands, which are outlined below. For more
information on each one of the commands listed, refer to ZPL II Programming Guide Volume One.
Reverse Printing a Field The ^FR (Field Reverse Print) command allows a field to appear
as white over black or black over white. When printing a field, the ^FR command indicates
that it will print the field the opposite of its background color.
Reverse Printing a Label The ^LR (Label Reverse Print) command reverses the printing
of all fields in the label format. It allows a field to appear as white over black or black over
white. ^LR functions like ^FR, but it applies to all fields in a label. The ^LR command
remains active until turned off.
Printing a Mirror Image The ^PM (Print Mirror Image of Label) command prints the entire
printable area of the label as a mirror image. This command flips the image from left to right.
Printing a Label Inverted 180 Degrees The ^PO (Print Orientation) command inverts
the label format 180 degrees. In essence, the label is printed upside down.
Advanced Techniques
Special Effects for Print Fields
41
Serialized Data
The ^SN (Serialization Data) command allows the printer to index data fields by a selected
increment or decrement value (that is, make the data fields increase or decrease by a specified
value) each time a label is printed. This can be performed on up to 100 to 150 fields in a given
format and can be performed on both alphanumeric and bar code fields. A maximum of 12 of
the right-most integers are subject to indexing. The first integer found when scanning from
right to left starts the indexing portion of the data field.
If the alphanumeric field to be indexed ends with an alpha character, the data will be scanned,
character-by-character, from right to left until a numeric character is encountered. Serialization
will take place using the value of the first number found.
Variable Data
To increase throughput, you can set up a program that uses variable data fields. Then, instead
of formatting the whole label each time a label is printed, the printer will have to format only
the changed data field. To use this capability, you must use the ^MC and ^FV commands.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
42
Stored Formats
Stored Formats
To create a format, complete these steps:
You can create formats and save them in volatile memory. A stored format can then be recalled
and merged with downloaded data to form a complete label. This process saves transmission
time but not formatting time. It is particularly useful if you are not working with an intelligent
input device.
1. Design the label.
2. Replace variable data fields with field numbers.
3. Allocate space for the size of the field.
4. Give the format a name.
5. Save the format to the printer.
You can store multiple formats, limited by available DRAM. If you try to save a format that
would overload memory, that format is not stored. You DO NOT receive an error message that
the format is not stored. You will learn that the format was not stored only when you try to
recall it (and are unable to do so) or if you print the List of Formats.
If the power is turned off, all stored formats in DRAM will be lost.
Initialize/Erase Stored Formats
Stored formats can be selectively erased using the ^ID command.
Download Format Command
The ^DF (Download Format) command saves the ZPL II format commands as text strings to
be later merged using ^XF with variable data. The format to be stored may contain Field
Number (^FN) commands to be referenced when recalled.
While use of stored formats will reduce transmission time, no formatting time is saved since
this command saves the ZPL II as text strings which need to be formatted at print time.
Field Number Command
The ^FN (Field Number) command is used to number the data fields. This command is used in
both Store Format and Recall Format operations.
When storing a format, the ^FN command is used where you would normally use the
^FD (Field Data) command. When recalling the stored format, use ^FN in conjunction with
the ^FD (Field Data) command.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Field Allocate
Use the ^FA (Field Allocate) command to allocate space for the field to be saved.
Recall Stored Format Command
The ^XF (Recall Format) command recalls a stored format to be merged with variable data.
There can be multiple ^XF commands and they can be located anywhere in the label format.
When recalling a stored format and merging data utilizing the ^FN (Field Number) function,
the calling format must contain the ^FN command to properly merge the data.
While use of stored formats will reduce transmission time, no formatting time is saved because
the format being recalled was saved as text strings that need to be formatted at print time.
Example • These are examples of using stored format:
Working with Stored Format commands involves designing and saving a stored format, then
recalling and merging the format with some variable data.
Advanced Techniques
Stored Formats
43
The following is an example of how to use the various Stored Format commands. First, enter
the following format and send it to the printer. Notice that no label is printed. (DATA
Indicator went On and Off.)
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
44
Control Commands
Control Commands
Control commands may be sent from the host at any time to elicit an immediate response from
the printer. Control commands may be sent in a group or singly.
A control command causes the printer to take direct software action (such as clearing the
memory), physical action (such as moving to next home position), or a combination (such as
feeding a label and calculating and storing its length).
The basic format for using all of the control commands is:
~(2-letter command) – For example, ~DG
Test and Setup Commands
The following commands, presented in alphabetical order, are used to test various elements of
the printer and its status.
Table 2 • Test and Setup Commands
CommandFunction
~HM (Memory Status)Sending this command to the printer immediately returns a memory status
message to host. Use this command whenever you need to know the status
of the memory.
~HS (Host Status)Sending this command to the printer immediately returns a three-line
printer status message to the host. Use this command whenever you need
to know the status of the printer.
~JR (Power On Reset)This command resets all of the printer’s internal software, performs a
power-on self-test, clears the buffer and DRAM, and resets communication
parameters and default values. ~JR performs the same function as a
manual power-on reset.
~JN (Head Test Fatal)This command resets the printhead element error override, acting as a
toggle for ~JO. The printer then goes into fault status (turns head indicator
on steadily) if any subsequent execution of the printing element test detects
bad printing elements. This command is only functional on certain printer
platforms.
~JO (Head Test Non-Fatal)This command overrides a failure of head element status check and allows
printing to continue. The override is canceled when the printer is turned off
or receives a ~JR or ~JN command. The printhead test will not produce an
error if the ~JO override is active. This command is only functional on
certain printer platforms.
^JT (Head Test Interval)This command lets you change the printhead test interval from 100 to any
desired interval. The printer automatically performs an internal printhead
element test, which occurs every 100 labels. This takes place during
formatting which minimizes a delay in printing. Therefore, the test may be
performed while the printer is in PAUSE. This command is only functional
on certain printer platforms.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Calibration and Media Feed Commands
The following commands, presented in alphabetical order, are used to perform various media
and ribbon calibrations and also set the media feed mode for the printer.
Table 3 • Calibration and Media Feed Commands
CommandFunction
Advanced Techniques
Control Commands
45
~JC (Set Media Sensor
Calibration)
~JG (Graphing Sensor
Calibration)
~JL (Set Label Length)Sets the label length. Depending on the size of the label, the printer will
^MF (Media Feed)Dictates what happens to the media at power up and after an error is
Forces a label length measurement and recalibrates the media and ribbon
sensors.
Note • In continuous mode, only the media and ribbon sensors are
recalibrated.
Forces a label length measurement, recalibrates the media and ribbon
sensors, and prints a graph (media sensor profile) of the sensor values.
feed one or more blank labels.
cleared.
Cancel/Clear Commands
The following command controls the contents of the Zebra input buffer.
Table 4 • Cancel/Clear Commands
CommandFunction
~JA (Cancel All)Cancels all format commands in the buffer. It also cancels any batches that
may be printing. The printer stops printing after the current label (if one is
printing) is finished printing. All internal buffers are cleared of data. The
DATA LED turns off.
Printer Control Commands
The following commands control various printer operations:
Table 5 • Printer Control Commands
CommandFunction
^PF (Slew Given Number of
Dot Rows)
~PH or ^PH (Slew to Home
Position)
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Causes the printer to slew labels (move labels at a high speed without
printing) a specified number of dot rows, at the bottom of the label. This
allows faster printing when the bottom portion of a label is blank.
Causes the printer to feed one blank label.
•The ~PH command feeds one label after the format currently being
printing is done or when the printer is placed in pause.
•The ^PH command feeds one blank label after the format it is in prints.
Advanced Techniques
46
Control Commands
Table 5 • Printer Control Commands (Continued)
CommandFunction
~PP (Programmable Pause)Stops printing after the current label is printed (if one is printing) and
places the printer in the Pause mode.
The operation is identical to pressing the PAUSE button on the front panel
of the printer. The printer will remain paused until the PAUSE button is
pressed or a ~PS command is sent to the printer.
^PP (Programmable Pause)This command pauses the printer after the format it is in prints. Because
this command is not executed immediately, several labels may be printed
before the printer is paused.
The operation is identical to pressing the PAUSE button on the front panel
of the printer. The printer will remain paused until the PAUSE button is
pressed or a ~PS command is sent to the printer.
^PQ (Print Quantity)This command gives control over several printing operations. It controls
the number of labels to print, the number of labels printed before the
printer pauses, and the number of replications of each serial number.
^PR (Print Rate)Determines the media speed during printing and the slew speed (feeding a
blank label). The printer will operate with the selected speeds until the
setting is resent in a subsequent format or the printer is turned off.
Limitations of Higher Print Speeds
Print speed is application specific. Because print quality is affected by
media and ribbon, printing speeds, and printer operating modes, it is very
important to run tests for your applications.
• With high print speeds, use thermal transfer mode only.
• Horizontal bar codes with a minimum x dimension of 5 mil may be
printed at print speeds of 2 in. (51mm) per second.
• Rotated bar codes are limited to a minimum x dimension of 10 mil
(modulus 2) at higher print speeds. At x dimension of 5 mil (modulus 1),
they may be printed at 2 in. per second.
• At high print speeds, Font A at a magnification of 1 is not
recommended; all other fonts are acceptable.
~PS (Print Start)Causes a printer in the Pause mode to resume printing. The operation is
identical to pressing the PAUSE button on the front panel of the printer
when the printer is already in the Pause mode.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Advanced Techniques
Control Commands
Set Dots/Millimeter
CommandFunction
^JM (Set Dots/Millimeter)Changes the number of dots printed per millimeter. Depending on the
printhead, normal dots per millimeter on a Zebra printer are the following:
• 24 dots/mm (609.6 dots/inch)
• 12 dots/mm (304.8 dots/inch)
• 8 dots/mm (203.2 dots/inch)
• 6 dots/mm (152.4 dots/inch)
In some applications, these high densities are not required. For these
applications, a lower density of 4 dots/mm (102 dots/inch) or 3 dots/mm
(77 dots/inch) can be selected.
If used, this command must be entered before the first ^FS command.
Host Status Commands
47
Table 6 • Host Status Commands
CommandFunction
~HI (Host Identification)This command is designed to be sent from the Host to the Zebra printer to
find out the type of Zebra printer. Upon receipt, the Zebra printer will
respond to the Host with a character string that gives information about the
printer such as the version of firmware, dots per inch, memory, and printer
options.
^SP (Start Print)This command allows a label to start printing at a specified point before the
entire label has been completely formatted. On extremely complex labels,
this command can increase the overall throughput of the printer.
The command works as follows: you specify the dot row at which the ^SP
command is to take affect. This then creates a label ‘segment.’ Once the
^SP command is processed, all information in that segment will be
printed. During the printing process, all of the commands after the ^SP
will continue to be received and processed by the printer.
If the segment after the ^SP command (or the remainder of the label) is
ready for printing, media motion does not stop. If the next segment is not
ready, the printer will stop “mid-label” and wait for the next segment to be
completed. Precise positioning of the ^SP command is somewhat of a
trial-and-error process as it depends primarily on print speed and label
complexity.
The ^SP command can be effectively used to determine the worst-case
print quality. You can determine if using the ^SP command is appropriate
for the particular application by using the following procedure. If you send
the label format up to the first ^SP command and then wait for printing to
stop before sending the next segment, the printed label will be a sample of
the worst case print quality. It will also drop any field that is out of order.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
48
Control Commands
Table 6 • Host Status Commands (Continued)
CommandFunction
~WC (Print Configuration
Label)
This command is used to generate a printer configuration label. This
command only works when the printer is idle.
Figure 8 • Sample Printer Configuration Label
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Changing Delimiters and Command Prefixes
Changing Delimiters and Command Prefixes
For some applications, you may need to change the ZPL II delimiter (default: ,) the format
command prefix (default: ^), and/or the control command prefix (default: ~). You may change
these characters to any ASCII characters that you wish, using the appropriate commands.
You might change these characters if you are using a hand-held terminal that does not have a
comma to enter the ZPL II commands, if you are working with a mainframe that has trouble
processing the caret, or if you find some other character(s) easier to use.
Communication Diagnostics Commands
Zebra printers support communication diagnostics through both hardware and software
control. You can use these diagnostics to troubleshoot programs.
Table 7 • Communication Diagnostics Commands
CommandFunction
Advanced Techniques
49
~JD (Enable Communications
Diagnostics)
~JE (Disable Diagnostics)Cancels the diagnostic mode and returns the printer to normal label
Initiates a diagnostic mode that produces an ASCII printout (using current
label length and full width of printer) of all characters received by the
printer. This printout includes the ASCII Characters, the HEX value and
any communication errors.
printing.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
50
Networking
Networking
Assigning Network IDs/Chaining Multiple Printers
You may choose to include your printer in a local area network (LAN).
LCD Control Panel If your printer is equipped with an LCD control panel, you may set the
network ID through the control panel.
Note • The default network ID for all printers is 0000.
RS-485 Use this option if your printer does not have a front panel. To set up an RS-485
network, you need to initialize with a one-printer network configuration for each printer.
To do this, complete these steps:
1. Send a ^NIXXX command where XXX is the new ID for the printer.
2. Issue a ^JUS command to save current settings.
Connecting Printers into the Network
If the printer already has a network ID, use the ~NC (Network Connect) command to connect a
particular printer into the network by calling up the printer’s Network ID Number. You can
then send data to the printer. You can then use the ~NT command to disconnect (set
transparent) the printer, if desired, when data transmission has finished.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Graphic Commands
In addition to text and bar codes, three types of graphics can be printed on a Zebra printer:
• boxes and lines
• ZPL II label formats saved as graphics images
• graphic images in Hexadecimal format
ZPL II has a format command that will create boxes and lines as part of any label format.
These label formats can also be stored as graphic images and data can be merged with them at
print time. Additionally, ZPL II will permit the printing of graphic images from other sources
that have been created in (or converted to) hexadecimal (HEX) format. Such graphic images
can come from a variety of sources, including CAD programs, draw and paint programs, and
scanned images.
Boxes and Lines
The ^GB (Graphic Box) command is used to draw boxes and/or lines as part of a label format.
Boxes and lines can be use to highlight important information, divide labels into distinct areas,
or just dress up the way the label looks.
Advanced Techniques
Graphic Commands
51
Working with Hex Graphic Images
ZPL II can be used to save graphic images in HEX format in DRAM, FLASH, or PCMCIA,
depending on the type of memory installed in your printer. The image might be created using a
CAD program, a draw or paint program, or a scanner. These images can then be printed on the
label. Graphic images may be created using a program that creates files in the .PCX format.
These files must then be converted to ZPL II graphic format .GRF (pure hexadecimal data
without headers or other extraneous information) for use as part of a label format. You can use
the ZTools™ for Windows program (available from Zebra) to convert the .PCX graphic format
into the pure hexadecimal .GRF graphic format. Hexadecimal data may also be directly input
as part of a ZPL II program. Manually preparing a string of HEX code is possible but usually
impractical.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
52
Graphic Commands
Alternative Data Compression Scheme for ~DG and ~DB
Commands
There is an alternative data compression scheme recognized by the Zebra printer. This scheme
further reduces the actual number of data bytes and the amount of time required to download
graphic images and bitmapped fonts with the ~DG and ~DB commands.
The following represent the repeat counts 1, 2, 3, 4, 5, ...., 19 on a subsequent Hexadecimal
value. Values start with G because 0 through 9 and A through F are already used for HEX
values.
GHIJKLMNOPQRSTUVWXY
234567 8 91011 12
1
These numbers represent the repeat counts 20, 40, 60, 80,....400 on a subsequent hexadecimal
value.
ghIjklmnopq
13
14
15
16 17
18
19
2040
60
80
100120140160180200220
rstuvwxyz
240260280 300320340
Example 1 • Sending M6 to the printer is identical to sending the following hexadecimal
data:
6666666
The M has the value of 7. Therefore M6 sends seven (7) hexadecimal 6’s.
Example 2 • Sending hB to the printer is identical to sending the following hexadecimal
data:
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
The h has a value of 40. Therefore, hB sends 40 Hexadecimal B’s.
Example 3 • Sending MvB or vMB sends 327 hexadecimal B’s to the printer. The M has a
value of 7, and the v has a value of 320. Together, they specify 327 Hexadecimal B’s.
Repeat Values Several repeat values can be used together to achieve any desired value.
360380
400
• a comma (,) fills the line, to the right, with zeros (0) until the specified line byte is filled.
• an exclamation mark (!) fills the line, to the right, with ones (1) until the specified line
byte is filled.
• a colon (:) denotes repetition of the previous line.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Recalling a Hexadecimal Graphic Image
The ^XG (Recall Graphic) command is used to recall one or more graphic images for printing.
This command is used in a label format to merge pictures such as company logos and piece
parts, with text data to form a complete label.
An image may be recalled and resized as many times per format as needed. Other images and
data may be added to the format.
Image Move
The ^IM (Image Move) command performs a direct move of an image from a storage area into
the bitmap. The command is identical to the Recall Graphic command except that there are no
sizing parameters.
Working with Label Formats as Graphics
The ^IS (Image Save) and ^IL (Image Load) commands are used to save a ZPL label format
(including text and/or bar codes) in the printer’s DRAM, FLASH, or PCMCIA as a special
graphic image. This increases the throughput of a series of similar but not identical labels.
Advanced Techniques
Graphic Commands
53
Instead of formatting each individual label completely, store the constant fields as an image
(known as creating a template). Then, in subsequent label formats, commands are issued to
recall that graphic image format and merge it with variable data.
Reducing Download Time of Graphic Images
There is a method of reducing the actual number of data bytes sent to the printer when using
the ~DG command.
If the HEX string ends in an even number of zeros (0’s), a single comma (,) can be substituted
for ALL of the zeros. If the HEX string ends in an odd number of zeros, one zero and a single
comma is required. The exclamation mark (!) and the colon (:) described under Repeat Values
on page 52 can also be used.
Note • The text rows in your editor may not be the same as the dot rows used by ZPL II. The
editor may word wrap or truncate the dot rows. ZPL II ignores the end of a text line (carriage
returns and line feed characters).
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
54
Graphic Commands
Transferring Object Between Storage Devices
The ^TO (Transfer Object) command is used to copy an object or group of objects from one
storage device to another. It is quite similar to the copy function used in personal computers.
Source and destination devices must be supplied and must be different and valid for the action
specified. Invalid parameters will cause the command to be ignored.
There are no defaults associated with this command. However, the asterisk (*) may be used as
a wild card for Object names and extensions. For instance, ZEBRA.* or *.GRF would be
acceptable forms for use with ^TO command.
The Asterisk (*) can be used to transfer multiple object files (except *.FNT) from the DRAM
to the Memory Card. For example, you have several object files that contain logos. These files
are named LOGO1.GRF, LOGO2.GRF, and LOGO3.GRF.
Example • You want to transfer all of these files to the Memory Card using the name NEW
instead of LOGO. By placing an Asterisk (*) after both LOGO and NEW in the transfer
command, you can copy all of these files with one command. The format for this would be as
follows:
^XA
^TOR:LOGO*.GRF,B:NEW*.GRF
^XZ
Note • If, during a multiple transfer, a file is too big to be stored on the Memory Card, it will
be skipped. All remaining files will be checked to see if they can be stored. Those that can be
stored, will be stored.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Deleting Graphics from Memory
The ^ID (Item Delete) command deletes objects, images, fonts, and formats from storage
areas selectively or in groups. This command can be used within a printing format to delete
objects just prior to saving new ones or can be in a stand-alone type format simply to delete
objects.
The object name and extension support the use of the asterisk (*) as a wildcard. This allows for
easy deletion of selected groups of objects.
The following are various examples of using the ^ID command.
To delete just stored formats from DRAM:
^XA^IDR:*.ZPL^XZ
To delete formats and images named SAMPLE from DRAM regardless of the
extension:
^XA^IDR:SAMPLE.*^XZ
Advanced Techniques
Graphic Commands
55
To delete the image SAMPLE1.GRF prior to storing SAMPLE2.GRF:
^XA
^FO25,25^AD,18,10^FDDelete^FS
^FO25,45^AD,18,10^FDthen Save^FS
^IDR:SAMPLE1.GRF^FS
^ISR:SAMPLE2.GRF^FS
^XZ
To delete everything from DRAM:
^XA^IDR:*.*^XZ
Defining and Using the AUTOEXEC.ZPL Function
An AUTOEXEC.ZPL file function is supported by the printer. It functions in much the same
way as the AUTOEXEC.BAT file in MS-DOS. The AUTOEXEC.ZPL file function can be used
for setting up various parameters at the time the printer is powered up (such as ^COY, ^LL, ^CWf). The function can also be recalled at any time after power up.
This file must initially be in the extra EPROM, FLASH, or PCMCIA memory. When the
printer is powered on, it looks to the extra memory site for the stored format called
AUTOEXEC.ZPL. If found, the contents of the file are automatically executed as a stored
format.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Advanced Techniques
56
Memory, Flash Cards, and Font Cards
Memory, Flash Cards, and Font Cards
Zebra printers come with a variety of memory device, including DRAM, EPROM, PCMCIA,
Flash, socket Flash, and battery backed-up RAM.
Note • Not all memory options are available on all printers.
Most Zebra printers allow you to print a printer configuration label, which will show the letter
designation assigned to your printer memory options. For printer models that do not support
this feature, use Table 8 to see how the memory IDs are assigned. Memory IDs default to these
values when the printer is reset to factory defaults.
Table 8 • Letter Designations for Different Memory Options
Memory Option
Default Letter Designation
EPROM E:
PCMCIA B:
FlashE:
DRAM R:
Battery backed-up RAM B:
Socket Flash B:
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Advanced Techniques
Memory, Flash Cards, and Font Cards
A few ZPL II commands directly affect the types of memory available to Zebra printers. These
commands are ~JB, ^JB and ~HM.
Table 9 • Commands that Affect Available Memory Types
CommandFunction
~JB (Reset Battery Dead)This command is sent to the printer if either of these conditions exist:
• If the B: memory card is intentionally cleared (reinitialized).
• If the battery supplying power to the Battery Powered Font Card fails
and is replaced. (A bad battery would show a “battery dead” condition
on the printer configuration label.)
Note • If you replace the battery but do not send this command
to the printer, the Battery Powered Font Card will not function.
^JB (Initialize Flash Memory)This command is used to initialize the two types of Flash Memory
available in the Zebra printers.
~HM (Host Memory Status)Sending this command to the printer immediately returns a memory status
message to the host. Use this command whenever you need to know the
status of the memory.
When the Host Memory Status Command, ~HM, is sent to the Zebra
printer, a line of data containing three numbers is sent back to the Host.
The following is an example:
1024,0780,0780
• The first value is the total amount of RAM (Random Access Memory)
installed in the printer. This number is in Kilobytes.
• The second value is the maximum amount of RAM available to the user.
This number is in Kilobytes.
• The third value is the amount of RAM currently available to the user.
This number is in Kilobytes.
57
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Fonts and Bar Codes
60
Standard Printer Fonts
Standard Printer Fonts
Most Zebra printers come standard with 15 bitmapped fonts and one scalable font (Figure 9).
Additional downloadable bitmapped and scalable fonts are also available. Character size and
density (how dark it appears) depend on the density of the printhead and the media used.
Figure 9 • Examples of the Standard Printer Fonts
FONT
A --
ABCD
12345
wxyz
FONT
B --
ABCD
WXYZ
12345
FONT
D --
ABCD
wxyz
12345
FONT E -- (OCR-B) ABCDwxyz 12345
FONT
FONT
FONT H -- (OCR-A) UPPER CASE ONLY
FONT 0
FONT GS
FONT P--
FONT Q--
FONT R--
FONT S--
FONT T--
FONT U--
FONT V--
To use one of these fonts, you must either use the change alphanumeric default font command
(^CF) or specify an alphanumeric field command (^A). Refer to ZPL II Programming Guide Volume One for complete information on both commands.
F --
--
ABCD
(Scalable)
--
ABCD
wxyz
12345
ABCD
wxyz
ABCD
wxyz
ABCD
ABCD
wxyz
wxyz
ABCD
ABCD
ABCD
wxyz
12345
G
12345
wxyz
CR
12345
12345
12345
12345
wxyz
wxyz
12345
--
Az 4
12345
The standard Zebra character set is Code 850 for character values greater than 20 HEX. There
are six HEX character values below 20 HEX that are also recognized. Figure 10 shows how
these character values are printed.
Note • Unidentified characters should default to a space.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Figure 10 • Recognized HEX Values below 20 HEX
Proportional and Fixed Spacing
Proportional spacing is different than fixed spacing. In Tab le 10, the intercharacter gap (space
between characters) is constant for fonts A through H, which means that the spacing between
all characters is the same. For example, the spacing between the letters MW is the same as
between the letters IE.
Fonts and Bar Codes
Proportional and Fixed Spacing
61
The baseline is the imaginary line on which the bottom (base) of all characters (except any
descenders) rest. The area between the baseline and the bottom of the matrix is used for any
character “descenders.” Baseline numbers define where the baseline is located in relationship
to the top of the matrix. For example, the baseline for font “E” is 23 dots down from the top of
the matrix.
Table 10 • Intercharacter Gap and Baseline Parameters
FontH x W (in dots)Type
Intercharacter Gap
(in dots)
Baseline
(in dots)
A9 x 5 U-L-D17
B11 x 7U211
C,D18 x 10U-L-D214
E28 x 15OCR-B523
F26 x 13U-L-D321
G60 x 40U-L-D848
H21 x 13OCR-A621
GS24 x 24SYMBOLPROPORTIONAL3 x HEIGHT/4
0DEFAULT: 15 x 12PROPORTIONAL3 x HEIGHT/4
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Fonts and Bar Codes
62
Scalable Versus Bitmapped Fonts
Scalable Versus Bitmapped Fonts
For scalable fonts, setting the height and width equally produces characters that appear the
most balanced. Balanced characters are pleasing to the eye because actual height and width are
approximately equal to each other. This is achieved through the use of a smooth-scaling
algorithm in the printer.
For bitmapped fonts, this balancing is built into the font. In actuality, the height of a bitmap
font is slightly larger than the width. Bitmap fonts are always at the maximum size of the
character’s cell.
Scalable Fonts
All dot parameters used in the commands to create scalable fonts are translated into a point
size because scalable fonts are measured in point sizes, not dots. To determine how many dots
to enter to obtain a particular point size, use the following formula. The actual point size will
be an approximate value.
• For printers using a 6 dot/mm printhead the “dots per inch of printer” value is 152.4
• For printers using a 8 dot/mm printhead the “dots per inch of printer” value is 203.2
• For printers using a 12 dot/mm printhead the “dots per inch of printer” value is 304.8
• For printers using a 24 dot/mm printhead the “dots per inch of printer” value is 609.6
The actual height and width of the character in dots will vary, depending on the font style and
the particular character. Therefore, some characters will be smaller and some will be larger
than the actual dot size requested. The baselines for all scalable fonts are calculated against the
dot size of the cell. The baseline is 3/4 down from the top of the cell. For example, if the size
of the cell is 80 dots, the baseline will be 60 dots (3/4) down from the top of the cell.
For more information concerning fonts and related commands, refer to the ~DB (Download
Bitmap Font) and ~DS (Download Scalable Font) commands in ZPL II Programming Guide Volume One.
Bitmapped Fonts
Internal bitmapped fonts can be magnified from 2 to 10 times their normal (default) size. The
magnification factor is in whole numbers. Therefore, if the normal size of a bitmapped font is
9 dots high and 5 dots wide, a magnification factor of 3 would produce a character of 27 dots
high and 15 dots wide. Height and width can be magnified independently.
Dots =
(Point size) x (Dots per inch of Printer)
72
Magnification Factor
The font commands contain parameters for entering the height and width of printed characters.
The values are always entered in dots. When entering these values for bitmapped fonts, use the
following formula:
Base Height x Magnification Factor = Height Parameter Value
45542L-002 Rev. AZPL II Programming Guide07/27/2005
The same principle applies when calculating width.
Example:
Base height = 9 dots
Base width = 5 dots
To magnify a bitmapped character with the above specifics 3 times its size:
Height parameter = 27 [9 x 3]
Width parameter = 15 [5 x 3]
Changing Bitmapped Font Size
Alphanumeric field command (^A) parameters h and w control the magnification and,
therefore, the ultimate size of the font. The parameter is specified in dots, but ZPL II actually
uses an integer multiplier times the original height/width of the font. For example, if you
specify
^AD,54
you get characters three times their normal size (54 dots high), but if you specify
Fonts and Bar Codes
Scalable Versus Bitmapped Fonts
63
^AD,52
you receive the same result, not characters 52 dots high.
Defining only the height or width of a bitmapped font forces the magnification to be
proportional to the parameter defined. If neither is defined, the ^CF height and width are used.
For example, if the height is twice the standard height, the width will be twice the standard
width.
If a ^CF command, with height and width parameters defined, is used to set the first font, any
^A commands (to select a different font) that follow must have the height and width parameter
filled in.
If this is not done, the newly selected font will be magnified using values for the ^CF height
and width parameters. The following is an example of what happens.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Fonts and Bar Codes
64
Font Matrices
Font Matrices
6 dot/mm printhead
Type Key U = Uppercase, L = Lowercase, D = Descenders
Font
A9 x 5U-L-D0.059 x 0.03925.41.50 x 0.991.01
B11 x 17U0.072 x 0.05916.91.82 x 1.500.066
C, D18 x 10U-L-D0.118 x 0.07912.72.99 x 2.000.05
E21 x 10OCR-B0.138 x 0.08511.73.50 x 2.160.46
F26 x 13U-L-D0.170 x 0.1059.534.32 x 2.670.37
G60 x 40U-L-D0.394 x 0.3153.1810.0 x 8.000.125
H17 x 11OCR-A0.111 x 0.09810.22.81 x 2.480.40
GS24 x 24SYMBOL0.157 x 0.1576.353.98 x 3.980.251
0Default: 15 x 12
Matrix
Typ e
HxW (in dots)HxW (in in.)Char./in.HxW (in mm)Char. /mm
Character Size
8 dot/mm (203 dpi) printhead
Font
A9 X 5U-L-D0.044 x 0.03033.31.12 x 0.761.31
B11 X 17U0.054 x 0.04422.71.37 x 1.120.89
C, D18 X 10U-L-D0.089 x 0.05916.92.26 x 1.120.66
E28 x 15OCR-B0.138 x 0.09810.23.50 x 2.490.40
F26 x 13U-L-D0.128 x 0.07912.73.25 x 2.000.50
G60 x 40U-L-D0.295 x 0.1974.27.49 x 5.000.167
H21 x 13OCR-A0.103 x 0.09310.82.61 x 2.360.423
GS24 x 24SYMBOL0.118 x 0.1188.52.99 x 2.990.334
P20 x 18U-L-D0.098 x 0.089N/A2.50 x 2.25N/A
Q28 x 24U-L-D0.138 x 0.118N/A3.50 x 3.00N/A
R35 x 31U-L-D0.172 x 0.153N/A4.38 x 3.88N/A
S40 x 35U-L-D0.197 x 0.172N/A5.00 x 4.38N/A
T48 x 42U-L-D0.236 x 0.207N/A6.00 x 5.25N/A
U59 x 53U-L-D0.290 x 0.261N/A7.38 x 6.63N/A
V80 x 71U-L-D0.394 x 0.349N/A10.00 x 8.88N/A
0Default: 15 x 12U-L-DScalableScalable
Matrix
Typ e
HxW (in dots)HxW (in in.)Char./in.HxW (in mm)Char. /mm
Character Size
45542L-002 Rev. AZPL II Programming Guide07/27/2005
12 dot/mm (300 dpi) printhead
Fonts and Bar Codes
Font Matrices
65
Font
Matrix
Typ e
HxW (in dots)HxW (in in.)Char./in.HxW (in mm)Char. /mm
Character Size
A9 X 5U-L-D0.030 x 0.02050.80.75 x 0.502.02
B11 X 17U0.036 x 0.03033.80.91 x 0.751.32
C, D18 X 10U-L-D0.059 x 0.04025.41.50 x 1.001.00
E42 x 20OCR-B0.138 x 0.08523.41.75 x 1.080.92
F26 x 13U-L-D0.085 x 0.05319.062.16 x 1.340.74
G60 x 40U-L-D0.197 x 0.1586.365.00 x 4.000.25
H34 x 22OCR-A0.111 x 0.09810.202.81 x 2.480.40
GS24 x 24SYMBOL0.079 x 0.07912.701.99 x 1.990.52
P20 x 18U-L-D0.067 x 0.060N/A1.69 x 1.52N/A
Q28 x 24U-L-D0.093 x 0.080N/A2.37 x 2.03N/A
R35 x 31U-L-D0.117 x 0.103N/A2.96 x 2.62N/A
S40 x 35U-L-D0.133 x 0.177N/A3.39 x 2.96N/A
T48 x 42U-L-D0.160 x 0.140N/A4.06 x 3.56N/A
U59 x 53U-L-D0.197 x 0.177N/A5.00 x 4.49N/A
V80 x 71U-L-D0.267 x 0.237N/A6.77 x 6.01N/A
0Default: 15 x 12U-L-DScalableScalable
24 dot/mm (600 dpi) printhead
Font
Matrix
Typ e
HxW (in dots)HxW (in in.)Char./in.HxW (in mm)Char. /mm
A9 X 5U-L-D0.015 x 0.010100.000.38 x 0.254.00
B11 X 17U0.018 x 0.01566.660.46 x 0.382.60
C, D18 X 10U-L-D0.030 x 0.02050.000.77 x 0.512.0
E42 x 20OCR-B0.137 x 0.08711.543.47 x 2.200.45
F26 x 13U-L-D0.043 x 0.02737.51.10 x 0.681.50
G60 x 40U-L-D0.100 x 0.08012.502.54 x 2.040.50
H34 x 22OCR-A0.100 x 0.09310.712.54 x 2.370.42
GS24 x 24SYMBOL0.040 x 0.04025.001.02 x 1.021.00
P20 x 18U-L-D0.067 x 0.060N/A1.69 x 1.52N/A
Q28 x 24U-L-D0.093 x 0.080N/A2.37 x 2.03N/A
R35 x 31U-L-D0.117 x 0.103N/A2.96 x 2.62N/A
S40 x 35U-L-D0.133 x 0.117N/A3.39 x 2.96N/A
T48 x 42U-L-D0.160 x 0.140N/A4.06 x 3.56N/A
U59 x 53U-L-D0.197 x 0.177N/A5.00 x 4.49N/A
V80 x 71U-L-D0.267 x 0.237N/A6.77 x 6.01N/A
0Default: 15 x 12U-L-DScalableScalable
Character Size
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Fonts and Bar Codes
66
Bar Codes
Bar Codes
Every bar code contains data made up of a sequence of light spaces and dark bars that
represent letters, numbers, or other graphic characters. The usable characters differ among the
various kinds of bar codes. Each bar code section in the Command Reference provides a table
of applicable characters. Start and stop characters and check digits are used by many, but not
all, bar codes. These will be indicated in the specific bar code explanations found in ZPL II Programming Guide Volume One.
Zebra printers can print the following kinds of bar codes:
Bar code modulus “X” dimensions
• Picket fence (non-rotated) orientation:
• 203 dpi = 0.0049 in. mil to 0.049 in.
• 300 dpi = 0.0033 in. mil to 0.033 in.
• Ladder (rotated) orientation:
• 203 dpi = 0.0049 in. mil to 0.049 in.
• 300 dpi = 0.0039 in. mil to 0.039 in.
Two-dimensional bar codes
•Code 49
•Maxi Code
•PDF-417
• QR Code
•Codablock
• DataMatrix
•Micro-PDF417
Bar code ratios
•2:1
•7:3
•5:2
•3:1
Linear bar codes
•Code 11
•Code 39
•Code 93
• Code 128 with subsets A/B C and
UCC Case Codes
•ISBT-128
•UPC-A
•UPC-E
• EAN-8
• EAN-13
• UPC and EAN 2 or 5 digit extensions
• Plessey
•Postnet
• Standard 2 of 5
• Industrial 2 of 5
• Interleaved 2 of 5
• LOGMARS
•MSI
•Codabar
•RSS-14
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Basic Format for Bar Codes
The basic format for bar codes is quiet zone, start character, data, check digit, stop character,
and quiet zone. Not all bar codes require each of these elements.
Every bar code requires a quiet zone. A quiet zone (sometimes called a “clear area”) is an area
adjacent to the machine-readable symbols that ensure proper reading (decoding) of the
symbols. No printing is permissible within this area. Preprinted characters, borders, and
background color are acceptable if they are invisible to the reading device; these are used in
some applications but restrict the type of reading device that can be used. The size of the quiet
zone depends on the size of bar widths (usually 10 times the width of the narrow bar).
Figure 11 • Quiet Zone in a Bar Code
Quiet ZoneQuiet Zone
Fonts and Bar Codes
Bar Codes
67
Bar Code Field Instructions
To create a bar code, a bar code field command must be contained in the label format. Table 11
shows the bar code field commands. The number in brackets denotes the print ratio. Each
command produces a unique bar code.
Important •
the code is a fixed standard and cannot be changed.
^B1Code 11 (USD-8)[2.0 - 3.0]
^B2Interleaved 2 of 5[2.0 - 3.0]
^B3Code 39 (USD-3 & 3 of 9)[2.0 - 3.0]
^B4Code 49 (*)[Fixed]
^B7PDF417 (*)[Fixed]
^B8EAN-8 (*)[Fixed]
^B9UPC-E[Fixed]
^BACode 93 (USS-93)(*)[Fixed]
(*) for Fixed Printing Ratio means that the ratio between the width of the bars in
Table 11 • Bar Code Field Commands
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Fonts and Bar Codes
68
Bar Codes
Table 11 • Bar Code Field Commands (Continued)
^BBCODABLOCK A, E, F (*)[Fixed]
^BCCode 128 (USD-6) (*)[Fixed]
^BDUPS MaxiCode (*)[Fixed]
^BEEAN-13[Fixed]
^BFMicro-PDF417[Fixed]
^BIIndustrial 2 of 5[2.0 - 3.0]
^BJStandard 2 of 5[2.0 - 3.0]
^BKANSI Codabar (USD-4 & 2 of 7)[2.0 - 3.0]
^BLLOGMARS[2.0 - 3.0]
^BMMSI[2.0 - 3.0]
^BPPlessey[2.0 - 3.0]
^BQQR Code (*)[Fixed]
^BSUPC/EAN Extensions (*)[Fixed]
^BUUPC-A (*)[Fixed]
^BXData Matrix (*)[Fixed]
^BZPostNet (*)[Fixed]
Additionally, each bar code field command can be issued with a definition parameter string.
The parameter string defines field rotation, height, and interpretation line status for all bar
codes. For some bar codes, the parameter string also sets a check digit, start character, and/or
stop character. Use the definition parameter string to command the printer to print bar codes of
appropriate heights and densities that conform to the specifications of the application.
The use of the parameter string is optional because all parameters have default values. If the
default values for all of the bar code parameters suit the application, then only the bar code
command needs to be entered.
Parameters in bar code field commands are “position specific.” If a value (other than the
default value) is manually entered for one parameter, a comma “ , ” the ZPL II delimiter
character, must be used to mark the position of the preceding parameters in the string.
To change just the third parameter, enter two commas and then the value for the third
parameter. The default values will be automatically used for the first and second parameters.
In the sample label from Saving Label Formats as Graphic Images on page 21, the ^B3 bar
code field command has five parameters. The third parameter defines the height of the bar in
dots. The bar code is to be printed using default values for the first two parameters EXCEPT
the height of the bar. This is to be 20 dots. Finally, the “N” indicates that a print interpretation
line will not print with the bar code. The command would be entered as follows:
^B3,,20,N
Delimiters (commas) are not required for parameters between a manually entered value and
the end of the parameter string.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Bar Code Command Groups
Bar code commands are organized into four groups. Each group represents a particular type of
bar code. These groups and the bar codes that they contain are shown in the following tables.
Table 12 • Numeric Only Bar Codes
^B1Code 11
^B2Interleaved 2 of 5
^BIIndustrial 2 of 5
^BJStandard 2 of 5
^BKANSI Codabar (or NW-7)
^BMMSI
^BPPlessey
^BZPOSTNET
Fonts and Bar Codes
Bar Codes
69
Table 13 • Retail Labeling Bar Codes
^B8EAN-8
^B9UPC-E
^BEEAM-13
^BSUPC/EAN extensions
^BUUPC-A
Table 14 • Alphanumeric Bar Code
^B3Code 39
^BACode 93
^BCCode 128
^BLLOGMARS
Table 15 • Two-Dimensional Bar Codes
^B4Code 49
^B7PDF417
^BBCODABLOCK
^BDUPS MaxiCode
^BFMicroPDF417
^BQQR Code
^BXData Matrix
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Printer Configuration Using ZPL II
72
Printer Configuration Commands
Printer Configuration Commands
In most cases, the printer can be configured either from the front panel or through various
ZPL II commands (Table 16). When the printer receives a configuration command, the change
usually affects the current label format and any future label formats until the configuration
command is reissued with a different set of parameters, the printer is reset, or the printer power
is turned off. The next label printed will reflect the new command. To save changes made
using the ZPL II commands, use the ^JU command (see Configuration Update on page 75).
Printer configuration commands must specify a parameter to be valid. Commands with
missing or invalid parameters are ignored. For more information regarding these commands
and their particular parameters, see ZPL II Programming Guide Volume One.
Table 16 • Printer Configuration Commands
CommandFunction
^MM (Print Mode) Sets the printer to one of its four basic printing modes; Tear-Off, Rewind,
Peel-Off, and Cutter.
^MN (Media Tracking) Sets the printer for either Non-Continuous or Continuous media.
^MT (Media Type) Sets the printer for either Direct Thermal media or Thermal Transfer
media.
^MD (Media Darkness) Adjusts the print darkness by increasing or decreasing the burn
temperature of the printhead.
^LT (Label Top) Shifts printing up to 64 dot rows (or ±120 dot rows based on printer
platform) up or down from the current Label Home position.
^SS (Set Media Sensors) Allows the user to override all of the internal values established after
running a media profile.
^MP (Disable Mode Protection) Disables the front panel Darkness, Position, and Calibrate modes.
^JZ (Reprint After Error) Reprints a label if it was partially or incorrectly printed due to an error
condition.
^JU (Configuration Update) Allows the user to save the current settings.
^SZ (Set ZPL) Allows the user to select either the ZPL or ZPL II Programming
Language.
To determine how your printer is currently configured, print a printer configuration label (see
Figure 8 on page 48 for a sample). Consult your printer’s User Guide for instructions. The
label provides valuable information about your printer’s configuration, memory, and options.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Print Mode
The ^MM (Print Mode) command determines the action the printer takes after a label or group
of labels has been printed. These are the different modes of operation.
Tear Off – After printing, the label is advanced so that the web is over the tear bar. Label,
with backing attached, can then be torn off manually.
Rewind – Label and backing are rewound on an (optional) internal rewind device. The
next label is positioned under the printhead (no backfeed motion).
Peel Off – After printing, the label is partially separated from the backing. Printing stops
until the label is completely removed. Backing is rewound using an internal backing only
rewind spindle. (NOTE: Select only if printer is equipped with internal rewind spindle.)
Cutter – The web separating the printed label and the next blank label to be printed is
extended into the cutter mechanism. The label is cut. The blank label is then pulled back
into the printer so it can be printed.
Media Tracking
The ^MN (Media Tracking) command tells the printer what type of media is being used
(continuous or non-continuous) for purposes of tracking. These are the choices for this
command:
Continuous Media — This media has no physical characteristic (web, notch,
perforation, etc.) to separate labels. Label Length is determined by the ^LL command.
Non-Continuous Media — This media has some type of physical characteristic (web,
notch, perforation, etc.) that can be detected by the printer to separate the labels.
Printer Configuration Using ZPL II
Printer Configuration Commands
73
Media Type
The ^MT (Media Type) command selects the type of media being used in the printer. There are
the choices for this command:
Thermal Transfer Media — This media uses a high-carbon black or colored ribbon.
The ink on the ribbon is bonded to the media.
Direct Thermal Media — The media is heat sensitive and requires no ribbon.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Printer Configuration Using ZPL II
74
Printer Configuration Commands
Media Darkness
The ^MD (Media Darkness) command adjusts the darkness relative to the current darkness
setting. The minimum value is -30 and the maximum value is 30.
Example • These are some example for using the ^MD Instruction:
• If the current value (value on configuration label) is 16, entering the command ^MD-9
• If the current value (value on configuration label) is 1, entering the command ^MD15
• If the current value (value on configuration label) is 25, entering the command ^MD10
Note • Each ^MD command is treated separately with respect to the current value (value on
configuration label).
Example • This is an example of what would happen if two ^MD commands were received:
• Assume the current value is 15. An ^MD-6 command is received that changes the
•The ~SD command is the ZPL equivalent of the darkness setting parameter on the front
would decrease the value to 7.
would increase the value to 16.
would only increase the value to 30 since that is the maximum value allowed.
current value to 9. Another command, ^MD2, is received. The current value is changed
17. The two ^MD commands were treated individually with respect to the current value
of 15.
panel and can also be used to adjust the print darkness.
Note • The ^MD command value, if used, is added to the ~SD command.
Label Top Position
The ^LT (Label Top) command moves the entire label format a maximum of 64 dot rows (or
120 dot rows on certain printer platforms) up or down from its current position with respect to
the top edge of the label. A negative value moves the format towards the top of the label; a
positive number moves the format away from the top of the label.
This command can be used to fine-tune the position of the finished label without having to
change any of the existing parameters.
Note • This command does not change the Media Rest position.
Set Media Sensors
The ^SS (Set Media Sensors) command is used to change the sensor values for media, web,
ribbon and label length that were set during the “media calibration” process (consult the
“Media Calibration” process as described in your printer’s User Guide).
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Mode Protection
The ^MP (Mode Protection) command is used to disable the various Mode functions on the
front panel. Once disabled, the settings for the particular mode function can no longer be
changed and the LED associated with the function will not light up.
Since this command has only one parameter, each mode will have to be disabled with an
individual ^MP command.
Reprint After Error
The ^JZ (Reprint After Error) command is used to reprint a partially printed label caused by a
Ribbon Out, Media Out, or Head Open error condition. The label will be reprinted as soon
as the error condition is corrected.
This command will remain active until another ^JZ command is sent to the printer or the
printer is turned off.
The ^JZ command sets the error mode for the printer. If ^JZ is changed, only labels after the
change will be affected.
Printer Configuration Using ZPL II
Printer Configuration Commands
75
Configuration Update
The ^JU (Configuration Update) command sets the active configuration for the printer. There
are three choices for this command (Tab le 17).
Table 17 • ^JU Command Parameters
ParameterFunction
S = save current settings
F = reload factory values
(default)
R = recall last saved values
The current configuration is saved. This is the configuration that will be
used at Power-On.
The factory values (default values) are loaded. These values will be lost at
Power Off if they are not saved with the ^JUS command.
The last values saved using this (^JU) command or the Mode Sequencing
from the front panel are loaded.
Set ZPL
The ^SZ (Set ZPL) command is used to select the programming language used by the printer.
This command gives you the ability to print labels formatted in both ZPL or ZPL II.
This command remains active until another ^SZ command is sent to the printer or the printer
is turned off.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Printer Configuration Using ZPL II
76
Setting Up Customized Label Formats
Setting Up Customized Label Formats
You can save a great deal of time by setting up your own configuration formats. If most of
your printing is done on one or two types of media, you can easily create label formats
specifically for those media.
If you need to print a special label, you change the various commands and then you only need
to change the media and load the new, specific configuration format.
Depending on your needs and specific application, the following is a list of the commands you
might want to put into a configuration format.
^XB Suppress Backfeed
^PR Print Rate
^LL Label Length
^LT Label Top
^MM Print Mode
^MT Media Type
^JZ Reprint After Error
^SS Set Media Sensors
^MD Media Darkness
^MN Media Tracking
^JU Configuration Update
^SZ Set ZPL
Note • You can have as many of these format configurations as needed. Supply them with
different names and send them to the printer as they are called for.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
6
XML—Super Host Status
This section provides information about XML—Super Host Status.
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
XML—Super Host Status
78
Introduction to XML
Introduction to XML
XML (Extensible Markup Language), a scaled-down version of SGML (Standard Generalized
Markup Language) geared toward processing and Web applications, is used to return Zebra
printer information to the ZTools™ 4.0 program for Windows. You also may choose to use
XML data for your own custom software applications.
Using ZPL II commands, an administrator or user can change the specific setting and format
variables of the printer, such as ribbon tension, print mode, label length, or font. To see a full
listing of all current setting and format information, enter the following ZPL II command:
Any information that does not apply to the printer’s platform will not be returned.
Transmission of XML data from the printer to your host application may be slow due to the
amount of information being returned. Using the ZPL II commands
faster alternative. XML data should only be used to gather data that is not available under the
~HI and ~HS commands.
^HZS
~HI and ~HS will be a
XML Attributes
The tables in this section contain a description of each attribute, an example of the XMLgenerated information sent back from the printer with example information, and the ZPL II
command used to change or set the attribute (if applicable).
The following main categories of attributes are covered in this section:
• Printer Definitions on page 79
• Saved Settings on page 80
• Format Settings on page 88
• Status Information on page 90
Two additional categories of attributes exist for use with Zebra printers:
• object list
• Zebra object
45542L-002 Rev. AZPL II Programming Guide07/27/2005
45542L-002 Rev. AZPL II Programming Guide07/27/2005
7
Real Time Clock
This section discusses the ZPL II commands related to the Real-Time Clock (RTC).
The RTC hardware option is currently available for several Zebra printers. The ZPL II
commands for the RTC are only applicable if the option is installed in the printer. For those
printers with an LCD front panel display, additional front panel configuration parameters are
also included.
The Field Clock (
primary, secondary, and tertiary clocks. This command must be included within each label
field command string whenever the date or time clock values are required within the field. No
date or time clock information can be printed in a label field unless this command is included.
A clock-indicator can be any printable character except the ZPL II Format Prefix, Control
Prefix, or Delimiter characters. The default value for the primary clock- indicator is the
percent sign (%). The secondary and tertiary clock-indicators have no defaults and must be
specified in order for that clock to be used.
The ZPL II Field Data (
and associated command characters, and to replace them during the printing process with the
corresponding time or date parameter. For example, if the primary clock-indicator is the
percent sign (%), then during printing, the character sequence %H in the
be replaced by the 2-digit current hour.
Note • If the Real Time Clock hardware is not installed, or the ^FC command has not
preceded the
would print as text on the label.
The name of the day of the week, the name of the month, and the AM or PM designation can
also be inserted in place of a specific clock-indicator/command character sequence.
Table 22 shows the data and time command characters.
^FC) command is used to specify the clock-indicator character for the
^FD) command has been expanded to recognize the clock-indicators
^FD statement would
^FD statement, no replacement would occur. In this case, the characters “%H”
07/27/2005ZPL II Programming Guide45542L-002 Rev. A
Real Time Clock
94
Table 22 • Data and Time Command Characters
Command
Character
Replaced with
%aabbreviated weekday name
%Aweekday name
%b abbreviated month name
%Bmonth name
%dday of the month: 01 to 31
%Hhour of the day (military time): 00 to 23
%Ihour of the day (civilian time): 01 to 12
%jday number: 001 to 366
%mmonth number: 01 to 12
%Mminute number: 00 to 59
%pAM or PM designation
%Ssecond number: 00 to 59
%Uweek number: 00 to 53, with Sunday as the first day
%Wweek number: 00 to 53, with Monday as the first day
%wday number: 00 (Sunday) to 06 (Saturday)
%yabbreviated 2-digit year number: 00 to 99
%Yfull 4-digit year number
The Set Offset (^SO) command permits the printing of specific times and dates relative to the
primary clock. The secondary (or tertiary) clock is enabled when secondary (or tertiary) offsets
are entered using this command. The secondary (or tertiary) clock time and date are
determined by adding the offsets to the current clock reading.
One ^SO command is required to set the secondary offset and an additional
^SO command is
required for a tertiary offset. The offsets remain until changed or until the printer is either
powered down or reset.
Note • Only dates from January 1, 1998 to December 31, 2097 are supported. Setting the
offsets to values that result in dates outside this range is not encouraged or guaranteed.
The Set Mode/Language (
^SL) command is used to select the language in which to print the
names of the days of the week, the names of the months. This command also sets the printing
mode, which can be ‘S’ for START TIME or ‘T’ for TIME NOW. In START TIME mode, the
time printed on the label is the time that is read from the Real Time Clock when the label
formatting begins (when the
^XA command is received by the printer). In TIME NOW mode,
the time printed on the label is the time that is read from the Real Time Clock when the label is
placed in the queue to be printed.
45542L-002 Rev. AZPL II Programming Guide07/27/2005
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.