Zebra Programming Language
Zebra Programming Language (ZPL) is a page description language from Zebra Technologies, used primarily for labeling applications. The original language was superseded by ZPL II, but it is not fully compatible with the older version. Meanwhile, ZPL II is emulated by many label printers of various producers.
Later, the Zebra BASIC Interpreter (ZBI) was integrated into printer software, which is seen as an advancement to ZPL II by the producer and is ANSI BASIC oriented. Primarily, it is intended to avoid a refactoring of code when changing the printer, if the old printer software was written by a label printer of a competitor. A possible use of ZBI could be for when the Zebra printer receives a foreign label format, which it would then convert to ZPL II on the fly so it can be printed.
The language commands always start with a caret ('
^') or tilde sign ('
~'). Currently, more than 170 commands exist in ZPL II. Each format has to start with the command
^XA and end with
^XZ. For instance, the font size is sent to the printer with the
^ADN,n,m command, where
m are integers denoting the font size and spacing characteristics;
^ADN,18,10 is the smallest size and
^ADN,180,100 the largest.
A simple output displaying the text "Wikipedia" can be made using code like that below.
1 ^XA 2 ^LH30,60 3 ^FO20,10 4 ^ADN,90,50 5 ^FDWikipedia^FS 6 ^XZ
1. Starts the label format.
2. Sets the Label Home to 30,60. ^LH command sets the label home position.
3. Sets the field origin at 20, 10. ^FO sets the upper-left corner of the field area by defining points along the x-axis and y-axis independent of the rotation.
4. Sets font size and spacing
5. Sets the text to be displayed. The ^FD command defines the data string for a field. The field data can be any printable character except those used as command prefixes (^ and ~).
6. Ends the label format.
This will output the following design: