Adding QR Code Data Switches to the XML Data Stream

Article ID: 74231479



Topic or Information

QR Code Switches are required for proper QR Code encoding and requires special attention so it is included in the XML Data

Applies To

XML compatible printers printing QR Codes and requiring specific data switches for encoding 

Excludes ZQ110, EM220, EM220II, MZ Series (RW420 Rev A), 2824 Series, 2844 Series, S4M (E53 Firmware), ZM Series (E53 Firmware) 888 Series


When using ZebraDesigner for XML the required switches for a QR Code must be included in the XML data stream.  It is unique to QR Code that the required switches must come after the ^FD in ZPL.  However, we have also determined that when using XML to recall and print ZPL stored in a Zebra printer, the switches must be included with the XML data stream.    

You may see that when executing a test print with the ZebraDesigner for XML software running at print-time the full data stream prints and scans successfully.  This is only because the complete ZPL code is sent to the printer that includes the required switches and that is not recalled by XML. 
However, when the software is NOT running at print-time an XML file is sent to the printer to recall and print the stored ZPL.  In this case, when variable data comes from an XML data stream the required switches must come from the data stream.   
This sample XML recalls a stored QR.ZPL file:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE labels SYSTEM "label.dtd">
<labels _FORMAT="E:QR.ZPL" _QUANTITY="1" _PRINTERNAME="Printer 1" _JOBNAME="LBL101">
<variable name="Zebra"> LA,Sample</variable>
Note: See the Switch Details information below that details the " LA" entry above.
NOTE:  If the required switches are not included in the data stream, a QR bar code will print but when scanned only part of the data will show.  In this example, sending the XML below with no switches to a printer with a QR.ZPL file stored for recall, prints a QR code that scans only 'ple.'
<!DOCTYPE labels SYSTEM "label.dtd">
<labels _FORMAT="E:QR.ZPL" _QUANTITY="1" _PRINTERNAME="Printer 1" _JOBNAME="LBL101">
<variable name="Zebra"> Sample</variable>
Switch Details Details from the ZPL Manual ^BQ command Read More>>

 Error correction level (Required)

= H, Q, M, or L

H = ultra-high reliability level
Q = high reliability level
M = standard level (default) 
L =high density level


Data input (Required)

= A or M followed by a comma

A = Automatic Input (default). Character Mode is not specified.

Data character string JIS8 unit, Shift JIS. When the input mode is Automatic Input, the binary codes of 0x80 to 0x9F and 0xE0 to 0xFF cannot be set.

M = Manual Input. Character Mode must be specified.

Two types of data input mode exist: Automatic (A) and Manual (M). If A is specified, the character mode does not need to be specified. If M is specified, the character mode must be specified.

Character Mode (Required when data input = M)

= N, A, Bxxxx, or K

N = numeric: digits 0 – 9

A = alphanumeric: digits 0 – 9, upper case letters A – Z, space, and $%*+-./:) (45 characters) Bxxxx = 8-bit byte mode. The ‘xxxx’ is the number of characters and must be exactly 4 decimal digits.

This handles the 8-bit Latin/Kana character set in accordance with JIS X 0201 (character values 0x00 to 0xFF).

K = Kanji — handles only Kanji characters in accordance with the Shift JIS 0208. This means that all parameters after the character mode K should be 16-bit characters. If there are any 8-bit characters (such as ASCII code), an error occurs.

The data to be encoded follows immediately after the last switch.


Considerations for ^FD When Using the QR Code:

 QR Switches (formatted into the ^FD field data)

        mixed mode <D>

D = allows mixing of different types of character modes in one code.

         code No. <01 16>

Value  = subtracted from the Nth number of the divided code (must be two digits).

        No. of divisions <02 16>

                Number of divisions (must be two digits).

         parity data <1 byte>

Parity data value is obtained by calculating at the input data (the original input data before divided byte-by-byte through the EX-OR operation). 


Steve S