Including Carriage Return Line Feed in QR Barcode Using ZPL

Article ID: 24066958




It is possible to include a carriage return/line feed to separate data within a 2D QR Barcode using ZPL

Applies To

Zebra ZPL Printers and the ZPL Programming Language
Excludes: 2824 Series, 2844 Series, S4M (E53 Firmware Version), 888 DD/TT Series, MZ Series, ZQ110, EM220, EM220II


Communication with printer and knowledge of the ZPL Programming Language


If you are writing ZPL for your printing needs and intended on including a 2D QR Barcode within your label contents that requires a carraige return/line feed to separate data within the barcode, see the example below:

In order to include a carriage return/line feed within the barcode, you need to include a ^FH (Field Hex) command within the barcode command structure to allow for special hexadecimal characters to be used.  If a carriage return/line feed is needed, the hex value for this would be  "_0D_0A".  You also need to include the "B" switch command to specify the amount of characters that will be contained in the data to ensure the barcode data is not truncated (spaces are seen as characters).  See below for example:

^FO100,100^BQN,2,10^FH^FDMM,B0024First Word_0D_0ASecond Word^FS

The barcode output should scan as follows:

First Word
Second Word

The ^FDMM,B0024 specifies the amount of characters to be represented, the follow link provides more detail on the "B" switch  Read More>>

The inclusion of the ^FH command allows for the hex values for carriage return/line feed to be properly interpreted by the printer.  So long as the command is properly constructed, the output should be correct.

Helpful Information

ZPL Programming Guide  Read More>>

USB Communication Information  Read More>>

ASCII Chart  Read More>>