The format is relatively simple. Each field is prefixed by a decimal number called the Application Identifier (AI for short). The length of the number depends on the first two digits (e.g. 250 begins with '25', so the length must be 3 digits). After the label, comes the data. Depending on the field number, the field can be either fixed-length or variable-length. The variable fields also have a maximum length, but must be suffixed by a special character: ASCII 29 (Group Separator, GS for short).
Some barcode formats only allow fixed-length fields, because they cannot encode the GS character. I will only talk about DataMatrix codes, which can support any 8-bit code. A GS1 DataMatrix code starts off with the meta-character FNC1. More on this later.
DataMatrix comes in a few different quality levels: 0, 50, 80, 100, 140 and 200. These numbers stand for the amount of data that is added to the symbol for error correction. 0 use no error correction. 50 to 140 use convolution encoding. 200 use Reed-Solomon encoding. These quality levels are also referred to with a ECC prefix: ECC 50 to ECC 200. The GS1 standard recommends using only ECC 200, and it is the one I will be talking about here.
ZPL is one of the languages that can be used to talk to your Zebra label printer. It is mainly text-based, and consists of a large number of cryptic commands. Each command begins with ^ or ~ (These characters can also be customized). Then comes one or two uppercase letters specifying the name of the command. Last comes zero or more comma-separated arguments.
Each document begins with ^XA (Start Format) and ends with ^XZ (End Format). In between you can change almost any setting, issue print commands, and even flash a new ROM. I will mostly discuss the ^BX command, which print DataMatrix barcodes.
^BX can take up to 7 arguments:
^BXo,h,s,c,r,f,gorientation, height, quality, columns, rows, format, escape character. Quality should be 200 for ECC 200, and you want to set some escape character. Here is the command I used:
^BXN,7,200,,,,@To specify the data, you should follow the ^BX command with a ^FD...^FS region. Inside this region, you can enter almost any data, but you might want to stay with simple ASCII characters. You can use the following escape sequences to encode other characters:
- @1 to @3 - FNC1 to FNC3. These are meta characters that lies outside the normal data-range.
- @5NNN - codepage. Changes to codepage NNN (three digit decimal number).
- @dNNN - character. Inserts data character NNN (three digit decimal number).
- @@ - escaped. Inserts the escape character itself.
^XA^BXN,7,,,,@^FD@190SE000@d0292501234567890^FS^XZOf course, you would need to specify a few settings before hand. You could get a template to work with by using the program Zebra Designer that comes with the printer. You just design your label, and print it to a file. (File → Print → Print to file)
For more information: