Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
3URJUDPPLQJ
*XLGH
Volume Two
2004 ZIH Corp.
ZebraLink, ZTools, and all product names and numbers are Zebra trademarks,
and Zebra, the Zebra logo, ZebraNet, ZPL, and ZPL II are registered
trademarks of ZIH Corp. All rights reserved.
All other trademarks are the property of their respective owners.
Document Name: 45542L-002.pdf
Proprietary Statement
This manual contains proprietary information of Zebra Technologies Corporation and its subsidiaries
(Zebra Technologies). It is intended solely for the information and use of parties operating and maintain-
ing the equipment described herein. Such proprietary information may not be used, reproduced, or dis-
closed to any other parties for any other purpose without the expressed written permission of Zebra
Technologies.
Product Improvements
Continuous improvement of products is a policy of Zebra Technologies. All specifications and designs are
subject to change without notice.
Liability Disclaimer
Zebra Technologies takes steps to assure that its published Engineering specifications and manuals are
correct; however, errors do occur. Zebra Technologies reserves the right to correct any such errors and
disclaims liability resulting therefrom.
Limitation of Liability
In no event shall Zebra Technologies or anyone else involved in the creation, production or delivery of the
accompanying product (including hardware and software) be liable for any damages whatsoever (includ-
ing, without limitation, consequential damages including loss of business profits, business interruption or
loss of business information) arising out of the use of or the results of use of or inability to use such prod-
uct, even if Zebra Technologies has been advised of the possibility of such damages. Some jurisdictions
do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or
exclusion may not apply to you.
Copyrights
The copyrights in this manual and the label printer described therein are owned by Zebra Technologies.
Unauthorized reproduction of this manual or the software in the label printer 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 liabil-
ity.
2004 ZIH Corp. All trademarks and registered trademarks are property of their respective owners. All
rights reserved.
Proprietary Statement
ZPL II Programming Guide Volume Two iii
TABLE OF CONTENTS
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
About this Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Document Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Related Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Zebra Programming Language II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
How ZPL II Differs from ZPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
ZPL II Basics and Printer Configuration . . . . . . . . . . . . . . . . . . . . . . 5
More Information on ZPL II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Format Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Prefix Rules and Syntax for ZPL II Commands . . . . . . . . . . . . . . . . . . . . . . . . 9
An Example of a Basic Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Zebra Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Understanding Bitmapped Font Magnification Factors . . . . . . . . . . . . . . . 13
Font Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Proportional Spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Bitmap Font Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Bar Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Basic Format for Bar Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Bar Code Field Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Further ZPL II Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
iv ZPL II Programming Guide Volume Two
Table of Contents
Introduction to Device Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Introduction to ZPL II Object Names and Extensions . . . . . . . . . . . . . . . . 24
Printer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Label Top Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Set Media Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Mode Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Configuration Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Set ZPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Setting Up Customized Configuration Formats . . . . . . . . . . . . . . . . . . . . . 31
ZPL II Programming Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Advanced Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Special Effects for Print Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Serialized Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Variable Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Stored Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Changing Delimiters and Command Prefixes . . . . . . . . . . . . . . . . . . . . . . 67
Communication Diagnostics Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Host Status Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Graphic Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Shortcuts and Alternate Schemes for Writing ZPL II Scripts . . . . . . . . . . . . . . 78
ZBI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Overview of ZBI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Starting the Zebra BASIC Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Ending a ZBI Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
ZBI Interpreter Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
ZBI Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
XML Super Host Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Introduction to XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Real Time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Table of Contents
ZPL II Programming Guide Volume Two v
ASCII Code Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
ASCII Code Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Mod 10 Check Digit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Mod 43 Check Digit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Fonts and Font Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Code Page 850 Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Error Detection Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
What is a Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Response From the Zebra Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Zebra Packet Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Disguising Control Code Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Error Detection Protocol Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Error Conditions and System Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
How the Zebra Printer Processes a Request Packet . . . . . . . . . . . . . . . 139
How the Zebra Printer Responds to Host Status . . . . . . . . . . . . . . . . . . . 140
AIM Contact Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Who is AIM Inc.? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Bar Code Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
ZB64 Encoding and Compression . . . . . . . . . . . . . . . . . . . . . . . . . 143
Encoding and Compression with ZB64 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
vi ZPL II Programming Guide Volume Two
Table of Contents
ZPL II Programming Guide Volume Two vii
Preface
The Preface discusses the topics and illustrates standards that are used throughout this
guide.
Contents
Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
About this Document . . . . . . . . . . . . . . . . . . . xix
Document Conventions. . . . . . . . . . . . . . . . . . xx
Related Documents. . . . . . . . . . . . . . . . . . . . xxi
viii ZPL II Programming Guide Volume Two
Preface
Contacts
Contacts
You can contact Zebra at:
Visit us at: http://www.zebra.com
Our Mailing Addresses:
=HEUD 7HFKQRORJLHV &RUSRUDWLRQ
333 Corporate Woods Parkway
Vernon Hills, Illinois 60061.3109 U.S.A
Telephone +1 847.634.6700
Facsimile +1 847.913.8766
=HEUD 7HFKQRORJLHV (XURSH /LPLWHG
Zebra House
The Valley Centre, Gordon Road
High Wycombe
Buckinghamshire HP13 6EQ, UK
Telephone +44 (0)1494 472872
Facsimile +44 (0) 1494 450103
$VLD 3DFLILF //&
1 Sims Lane, #06-11
Singapore 387355
Telephone +65 6858 0722
Facsimile +65 6885 0838
Support
You can contact Zebra support with any questions or problems with Zebra
Programming Language II (ZPL II):
Support URL: http://www.zebra.com/SS/service_support.htm
Telephone: +1.847.913.2259
Preface
About this Document
ZPL II Programming Guide Volume Two ix
About this Document
The ZPL II Programming Guide Volume Two consists of these sections:
Title Content Description
Introduction Provides a high-level overview about this guide
and Zebra Programming Language (ZPL).
ZPL II Basics and Printer
Configuration
This section provides you with important
information about ZPL II.
ZPL II Programming Exercises This section provides you with exercises to
properly use ZPL II.
Advanced Techniques This section presents information and commands
for using more advanced techniques such as
special effects, serialized data fields, control
commands, program delimiters, communications,
and memory cards.
ZBI This section provides you with several examples of
how ZBI and ZPL II interact in bar code printing.
XML Super Host Status This section provides you with details on the XML
Super Host Status.
Real Time Clock This section provides you with a details on the
Real Time Clock.
ASCII Code Chart This section contains a chart of the American
Standard Code for Information Exchange (ASCII)
code used by Zebra printers.
Mod 10 Check Digit This section provides you with the necessary
information about Mod 10 Check Digit.
Mod 43 Check Digit This section provides you with the necessary
information about the Mod 43 Check Digit.
Fonts and Font Matrices This section provides you with font matrices for
the dot/mm of the various printheads.
Code Page 850 Chart The Code Page 850 character set used by Zebra
printers is located on the following pages.
Error Detection Protocol This section describes Zebras Error Detection
Protocol.
x ZPL II Programming Guide Volume Two
Preface
About this Document
AIM Contact Information This section provides you with the contact
information to AIM.
ZB64 Encoding and
Compression
This section describes the Base 64 MIME (ZB64)
encoding compression.
Preface
Document Conventions
ZPL II Programming Guide Volume Two xi
Document Conventions
These conventions are used throughout this document to convey certain information:
About this Chapter Sections These sections list and describe each main section
of the chapter, including the initial page numbers of those sections. These sections
primarily serve as hyperlink components for the Adobe Acrobat .pdf version of this
guide.
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.
Commands All commands appear in Courier New font. For example, all ZPL
commands are displayed in Courier New.
Files and Directories All file names and directories appear in Courier New
font. For example, the Zebra<version number>.tar file and the /root
directory.
These are the conventions and their meanings that you will see throughout this
document.
Important, Note, and Example These topics are defined in this example
!
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.
xii ZPL II Programming Guide Volume Two
Preface
Related Documents
Related Documents
In addition to the ZPL II Programming Guide Volume Two, these documents might be
helpful references:
The ZebraLink Solution Application white-paper
ZBI Guide
ZPL II