This article is only relevant if you are running ForNAV Customizable Report Pack version 126.96.36.199 or later – or ForNAV 188.8.131.529 or later.
When printing to a Zebra label or receipt printer, it is often advantageous to use the ZPL language to print instead of using the normal Windows driver. The benefits include faster printing, cutting, dynamic page heights, and programming of RFID chips.
To print ZPL to a Zebra printer with ForNAV, the ForNAV Print Queue is used as in the following example:
local procedure HelloWorld()
PrintQueue: Record “ForNAV DirPrt Queue”;
TempBlob: Codeunit “Temp Blob”;
PrintQueue.Create(‘Hello World’, ‘Zebra’, InStr, PrintQueue.ContentType::Zebra);
In this example, the ZPL string is static. However, the ZPL string can be built in AL to contain dynamic content from the database such as value and bitmap.
The PrintQueue.Create method takes the following parameters:
- The name of the print job.
- The Direct printer name.
- An InStream containing the ZPL ASCII string.
- An option value, which in this case is telling the ForNAV print queue that this is a Zebra ZPL job.
There are a few limitations:
- Because ZPL only supports 8bit ASCII, the InStream used to contain the ZPL string must be encoded with TextEncoding::Windows.
- Unless the installation has a valid ForNAV license, every fifth print is randomly replaced with a “Trial” message. If this is a problem, you can contact ForNAV to get a test license.