Salesforce

Creating GS1 Barcodes via ZPL Script

« Go Back

Information

 
Issue / QuestionCreating GS1 Barcodes with Zebra Printers using DataMatrix, Code 128 and QR code.
Applicable ToZebra ZPL Compatible Printers
Excludes: 2824 Series, 2844 Series, S4M (E53 Firmware Version), 888 DD/TT Series, MZ Series, ZQ110, EM220, EM220II
Resolution / Answer

A unique start character is used to identify barcodes as GS1. The start character is called FNC1. The FNC1 character instructs a decoder that the following characters are GS1 AI. The FNC1 character is also used in the middle of a barcode to denote the end of a variable-length GS1 field and the beginning of a new AI.

  • Zebra ZPL printers support the FNC1 character using an escape sequence as part of the barcode data string.  
  • An escape sequence is defined as an escape sequence control character and an escape sequence code. The escape sequence control character denotes the start of the escape sequence.
  • In ZPL, different barcode types use different escape sequences to create the FNC1 character.

 

Code 128

The escape sequence control character for Code 128 barcodes is the greater-than symbol (">"). The escape sequences for a Code 128 barcode are as follows:

User-added image

The escape sequence is inserted in the barcode data string; it is not part of the label format.
 

For example, the GS1 data string containing a GTIN and Serial Number:

>;>8011234567890123421123456

User-added image

 

For example, the GS1 data string containing a GTIN, Serial Number and Batch Number:

>;>8011234567890123421123456>810>6ABC123

User-added image

 

Data Matrix

Data Matrix barcodes' escape sequence control character varies based on the printer firmware version. For this reason, the safest action is to define the escape sequence control character directly in the ZPL file instead of relying on the firmware default.

The ZPL command to print a Data Matrix barcode is:

 ^BXo,h,s,c,r,f,g

User-added image

 The “g” field is the one that defines the escape sequence control character. This field should be set to the underscore symbol (“_”).
 

For example, the Data Matrix command:

^BXN,9,200,20,20,,_

User-added image

 After the ZPL has been modified to define the escape sequence control character, then the barcode data string can be created with the proper escape sequence. The Data Matrix escape sequence code for the FNC1 character is the one symbol (“1”), making the FNC1 escape sequence “_1”.
 

For example, the GS1 data string containing a GTIN and Serial Number:

_1011234567890123421123456

 User-added image


 For example, the GS1 data string containing a GTIN, Serial Number, and Batch Number:

_1011234567890123421123456_110ABC123

User-added image


QR Code

To create a GS1-QR barcode via ZPL script, the Printer Firmware should be 6.6 or higher. See Link-OS 6.7 Release Notes.
And refer to convert from Code 128 to GS1-128 barcode.

image.png

For example, the GS1 data string containing a GTIN and Serial Number:

>;>8011234567890123421123456

User-added image

ZPL Example: Same script used for Code128 and QR Code]

^XA
^FT101,59^A0N,31,30^FH\^CI28^FDGS1-128 : ^FS^CI27
^FT101,174^A0N,31,30^FH\^CI28^FDGS1-DataMatrix : ^FS^CI27
^FT548,174^A0N,31,30^FH\^CI28^FDGS1-QR: ^FS^CI27
^BY2,3,54^FT110,134^BCN,,N,N
^FH\^FD>;>8011234567890123121123456^FS
^FT185,324^BXN,6,200,0,0,1,_,1
^FH\^FD_1011234567890123121123456^FS
^FO642,206^BQN,2,5
^FH\^FD>;>8011234567890123121123456^FS
^PQ1,0,1,Y
^XZ

image.png
[Print out and Scan Data Result]
 

NOTE If you have issues converting GS1 (]d2) barcodes to data matrix (]d1) barcodes, please reach our Technical Support team with your print file, expectations, and scanned results. Be sure your printer is running the latest version of Firmware provided on the printer support web page.


Helpful Information:

URL NameCreating-GS1-Barcodes-with-Zebra-Printers-for-Data-Matrix-and-Code-128-using-ZPL
TitleCreating GS1 Barcodes via ZPL Script

Powered by