This article is only relevant if you are running ForNAV Customizable Report Pack version 18.104.22.168 or later – or ForNAV 22.214.171.1249 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()varPrintQueue: Record "ForNAV DirPrt Queue";InStr: InStream;OutStr: OutStream;TempBlob: Codeunit "Temp Blob";beginTempBlob.CreateOutStream(OutStr, TextEncoding::Windows);OutStr.WriteText('^XA^CFA,50^FDHello World^XZ~PS');TempBlob.CreateInStream(InStr);PrintQueue.Create('Hello World', 'Zebra', InStr, PrintQueue.ContentType::Zebra);end;
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.