Issue / Question
Is it possible to include a carriage return or line feed to separate data within a 2D QR Barcode using ZPL?
Applicable 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
Resolution / Answer
Requirements
Communication with printer and knowledge of the ZPL Programming Language.
Procedure
If you are writing a ZPL code to include a 2D QR Barcode within your label content, which requires a carriage return (CR) or line feed (LF) to separate data within the barcode, you need to include a Field Hex (^FH) command within the barcode command structure to allow for special hexadecimal characters to be used.
If a CR or LF is needed, the hex value for this would be "_0D_0A". You also need to include the "B" switch command to specify the number 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:
^XA ^FO100,100^BQN,2,10^FH^FDMM,B0024First Word_0D_0ASecond Word^FS ^XZ
The barcode output should scan as follows:
- First Word
- Second Word
The ^FDMM,B0024 specifies the amount of characters to be represented, the following link provides more detail on the "B" switch: Using the "B" Switch to Add Special Unprintable Characters to a QR Bar Code.
The inclusion of the ^FH command allows for the hex values for a CR or an LF to be properly interpreted by the printer. Ensure that the command is appropriately constructed. For more information, refer to QR Barcode.
Helpful Information