Using ForNAV to print ZPL to a Zebra printer

This article is only relevant if you are running ForNAV Customizable Report Pack version 6.3.0.7 or later – or ForNAV 6.3.0.2289 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()
var
    PrintQueue: Record "ForNAV DirPrt Queue";
    InStr: InStream;
    OutStr: OutStream;
    TempBlob: Codeunit "Temp Blob";
begin
    TempBlob.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:

  1. The name of the print job.
  2. The Direct printer name.
  3. An InStream containing the ZPL ASCII string.
  4. 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.