Page description language – ZPL
ZPL - Zebra Programming Language - the language of description of printed pages, also known as PDL (Page Description Language). There are many PDLs. Almost every printer manufacturer has its own page description language. This language allows you to describe the page by high-level commands, which will be interpreted by the printer in low-level ones. The most famous PDL is PostScript from Adobe. The PDL allows to describe page objects. There is something, that makes the program be independent from a particular hardware platform of a printer. The printer receives commands for printing a square, a symbol or a line and we do not care how it will be realized. The printer itself knows how to do this. This is the main advantage of the PDL.
American company "Zebra Technologies" has developed the ZPL mainly for creating and printing of labels. Labels can contain a text, barcodes and simple graphics. Such labels are printed with special Zebra printers, which are used in the trade for printing receipts and checks.
There are two standards: ZPL and ZPL ll.
The main reason for development of ZPL II was a significant reduction of the time when a printer starts to receive data and when the first character goes to be printed. This was made primarily by changing the way of how ZPL programs are written.
The ZPL II standard is not 100% compatible with the ZPL standard. But the differences between are minimal. All programs on the ZPL can easily be modified to the level of ZPL ll. There is a backward compatibility. That is, you can write programs on the ZPL ll for ZPL printers, of course, taking into account the old syntax.
So, here are two main differences between ZPL ll and ZPL:
1. In ZPL II the data is formatted immediately as received. And in the ZPL standart, the formatting does not start until you get the command to complete the process formatting ^ XZ.
2. ZPL ll has a lot of new commands.
Considering a programming language without examples makes no sense. Therefore, the program code for printing a simple label is given to allow to look at the syntax.
Now, we get the ticket for the shipping control:
As you can see, the code begins with the tag (command) ^ XA and ends with the tag ^ XZ. The code is divided by the comments into four sections for convenience of consideration.
1) The first section displays the company logo and its legal data:
It is clear that tag ^ FX means a comment.
^CF x, y, z – Default font settings: font, height and width.
^FO x,y - left and top indentation.
^FS – end of line.
Next, draw a logo from four circles:
^GC x,y – draw a circle. Diameter – x, line thickness – y.
^FD – data field.
2) In the second section we will not see new tags.
3) In the third section we add a barcode:
^BY x,y,z – width, width of bar, height.
4) In the fourth section another tag appeares:
^GB x,y,z – rectangle (box). Width, height, thickness of the frame.
By using a small set of tags, we described the entire printed page. The process is rather simple. You only need to set the distance in points. All the measurements are in points.
Summing up, in this article we have considered a part of the ZPL commands to meet a user with the main point of the language.
As on the Internet there are many online interpreters of the ZPL code, you can always test it visually.