
Learning ZPL
Basic ZPL Exercises and Examples
96
P1026208-001 Rev. B Software Integrator Guide 10/29/2010
Exercise 31 • This exercise shows how the use Text Data Variables in a format.
Using text variables requires that you create two files. One, a format (form) with blank
variable field data fields. The second format recalls the first format and supplies the blank
text data fields with variable referenced data for each variable field in the recalled form.
Text data can be linked to bar codes and text (single line and paragraphs fields) with
^FN (Field Number) command. They can link a variable to one or many variable fields for
text or bar codes.
1. Send this format to the printer:
The example above shows how a variables can work with other features outlined in
previous exercises. The format converted to a graphic of the image map is used as a
template. The variable field are placed as text or bar code object on top of the image. Note
that the text data that follows the
^FS (Field Separator) command does not print or
interfere with the printing of the receipt.
The stored format (form) with the variable fields is recalled in the second format (form) and
inserts the two variables into the three (3) referenced locations (
^FN). The last format is
recalled to use a predefined (and stored) receipt handling (in this case
^CN1 and
^PN0).Notice how this makes it hard to determine what action the recalled format will take
when trying to follow the code. This is the problem with nesting ZPL formats within formats
presents.
ZPL II CODE
GENERATED LABEL
^XA
^DFE:PaperBadge2.ZPL
^MNN
^KV0,2
^LL560
^CF055,55
^ILE:PaperBadge1.PNG^FS
^FO370,100^FN1^FS (Name)
^FO370,300^FN2^FS (Title)
^FO375,385^B3N,N,100,Y^FN1^FS (Name)
^XZ
^XA
^XFE:PaperBadge2.ZPL
^FN1^FDRalph^FS
^FN2^FDBoss^FS
^XFE:ENDIT-01.ZPL
^XZ
Comentarios a estos manuales