Using ZPL Stored Formats

Using ZPL Stored Formats

Article ID: 13969797

Issue / Question

Using ZPL Stored Formats

Applicable To

ZPL Compatible printers

Resolution / Answer

The Zebra printers are capable to store on their memory a template and recall it to print variable data on the same layout.
It is recommended to use ZebraDesigner 3 to design the label and the “Print to file” option to get the ZPL code to modify.

This procedure is possible using the following ZPL commands:

^DF

To store the template on the printer memory

^XF

To recall the template

^FNx

To fill the variable fields. This command must be followed by a number that identifies the variable field itself.
Both ^DF and ^XF commands must be followed by the memory letter and the filename, extension included.

The memory you can use are the following

  • R for the printer RAM.
  • E for the flash memory.

If you use the R memory, you will lose the stored template once the printer will be rebooted.
Remember that the filename should not exceed 8 characters (the additional characters will be cut) and cannot include spaces.

Example 1
This example shows how to store and recall a template, without variable fields.

Storing the template

^XA ^DFE:TEMPLATE.ZPL^FS ^FO50,50^A0,60,60^FDTest^FS ^XZ

^XA is the open command
^DFE:TEMPLATE.ZPL this command instructs the printer to store the file, instead of print it
^FO is field origin, A is the font, FD is the data field
^XZ is the closure command

Recalling the template

^XA
^XFE:TEMPLATE.ZPL^FS
^PQ1
^XZ

^XF recalls the TEMPLATE.ZPL file stored on memory E
^PQ1 is the print quantity

Example 2
This example shows how to store and recall a template with a variable field using the ^FN command.

Storing the template

^XA
^DFE:TEMPLATE.ZPL^FS
^FO25,25^A0N,50,50^FDName^FS
^FO25,75^A0N,50,50^FN1^FS
^FO25,125^A0N,50,50^FDSurname^FS
^FO25,175^A0N,50,50^FN2^FS
^XZ

^FD fields in line 3 and 5 are the fixed fields (Name and Surname)
^FN1 and ^FN2 these are the variable fields 1 and 2

Recalling the template

^XA
^XFE:TEMPLATE.ZPL^FS
^FN1^FDJohn^FS
^FN2^FDDoe^FS
^PQ1
^XZ

^XF recalls the TEMPLATE.ZPL file stored on memory E
^FN1 recalls the ^FN1 fields on the template and fills it with "John"
^FN2 recalls the ^FN2 fields on the template and fills it with "Doe"


Example 3
If you are constantly printing the same label but one of the fields is a counter, you can recall a saved format which includes a counter as a variable field using the ^SN command.

Storing the template

^XA
^DFE:TEMPLATE.ZPL^FS
^FO25,25^A0N,50,50^FDTest Model^FS
^FO25,125^A0N,50,50^FDSerial number^FS
^FO25,150^A0N,50,50^FN1^FS
^XZ


Recalling the template

^XA
^XFE:TEMPLATE.ZPL^FS
^FN1^SN123001,1^FS
^PQ100
^XZ

 

The command ^SN will send to the printer “123001” as the initial value for the first label, then, according to “1” which is the increment value and to the value that follows ^PQ (Print quantity), it will print 100 labels incrementing the value of 1 on each label (123001, 123002…).
If you need to decrement the value, a minus must precede the number (E.G. -1).

More information can be found on the ZPL Programming Guide

+ Product Codes

  • 105SLPlus Industrial Printers
  • 105SLPlus Industrial Printers
  • 110PAX Print Engines (disc.)
  • 110Xi4 Industrial Printer
  • 140Xi4 Industrial Printer
  • 170Xi4 Industrial Printer
  • 220Xi4 Industrial Printer
  • 2824 Plus Series
  • 2824-Z Series
  • All Surface RFID Label Solution
  • Desktop Printers
  • EZ320 Mobile Printers
  • G-Series GC Desktop Printers
  • G-Series GK Desktop Printers
  • G-Series GX Desktop Printers
  • GC420d Desktop Printer
  • GC420t Desktop Printer
  • GK420 Healthcare Desktop Printers
  • GK420d Desktop Printer
  • GK420d Healthcare Desktop Printer
  • GK420t Desktop Printer
  • GK420t Healthcare Desktop Printer
  • GT800 Desktop Printer
  • GX420Rx Desktop Printer
  • GX420d Desktop Printer
  • GX420t Desktop Printer
  • GX430d Desktop Printer
  • GX430t Desktop Printer
  • HC100 Wristband Printer
  • HC100 Wristband Printer
  • LP 2824 Plus Desktop Printer
  • Mobile Printers
  • P4T Mobile Printers
  • P4T Mobile Printers
  • Print Engines
  • QL Series Mobile Printers
  • QL320 Mobile Printer
  • QL420 Mobile Printer
  • QLn Series Healthcare Mobile Printers
  • QLn Series Mobile Printers
  • QLn220 Healthcare
  • QLn220 Mobile Printer
  • QLn320 Healthcare
  • QLn320 Mobile Printer
  • QLn420 Mobile Printer
  • R110Xi4 RFID Printer
  • RFID Printers
  • RP4T RFID Printers
  • RP4T RFID Printers
  • RW 220 Mobile Printer
  • RW 420 Mobile Printer
  • RW 420 Print Station
  • RW Series Mobile Printers
  • TLP 2824Plus Desktop Printer
  • Xi Series Industrial Printers
  • ZD410 Series
  • ZD410D
  • ZD420 Series
  • ZD420-HC
  • ZD420C
  • ZD500 Desktop Printer
  • ZD500 Desktop Printer
  • ZD500R RFID Printers
  • ZD500R RFID Printers
  • ZE500 Print Engines
  • ZE500 Print Engines
  • ZE500R RFID Print Engine
  • ZE500R RFID Print Engine
  • ZM400
  • ZM600
  • ZQ500 Series Mobile Printers
  • ZQ510 Mobile Printer
  • ZQ520 Mobile Printer
  • ZR300 Series Mobile Printers
  • ZR338 Mobile Printers
  • ZR600 Series Healthcare Mobile Printers
  • ZR600 Series Mobile Printers
  • ZT200 Series Industrial Printers
  • ZT210 Industrial Printer
  • ZT220 Industrial Printer
  • ZT230 Industrial Printer
  • ZT400 Series Industrial Printers
  • ZT400 Series RFID Printers
  • ZT410 Industrial Printer
  • ZT410 RFID Industrial Printer
  • ZT420 Industrial Printer
  • ZT420 RFID Industrial Printer
  • iMZ Series Mobile Printers
  • iMZ220 Mobile Printer
  • iMZ320 Mobile Printer