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
Loading...
+ 102 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.