| Docs Help
  AppSource  
Docs  /  NVXZPL ZPL Printer Management Base  /  Tasks

Developer Information


2024/10/28 • 2 min. to read
This app only provides basic functionality and entities as well as interfaces. The connection to a printer and the conversion of an image to zpl code has to be implemented in subapps.

Interfaces

This app provides following interfaces and corresponding enums:

ZPLIPrinterConnectorNVX

Enum: ZPLConnectionTypeNVX

Methods

Methodname Description
Print(Text; Code[20]) Prints the zpl code in text format to the selected printer.

ZPLIImageConverterNVX

Enum: ZPLImageConversionFormatNVX

Methods

Methodname Description
Convert(var ImageInStr: InStream; Size: Integer): Text; Converts an image from stream to zpl code.
Convert(var ImageInStr: InStream; Size: Integer; Rotation: Enum "Rotate Flip Type"): Text Converts and rotates an image from stream to zpl code

Print a ZPL Layout

On the table ZPLPrinterNVX the field "Connection Type" is defined, which implements the interface ZPLIPrinterConnectorNVX. This enum can be extended in subapps to support different connection methods to the printer.
procedure PrintLayout(LayoutCode: Code[20]; NoOfCopies: Integer)
var
    ZPLLayout: Record ZPLLayoutNVX;
    ZPLPrinter: Record ZPLPrinterNVX;
    ZPLPrinterMgt: Codeunit ZPLPrinterMgtNVX;
    PrinterCode: Code[20];
    IZebraConnector: Interface ZPLIPrinterConnectorNVX;
    Placeholders: List of [Text];
    LabelLayout: Text;
begin
    ZPLLayout.Get(LayoutCode);
    ZPLPrinterMgt.GetPrinter(ZPLLayout.Code, PrinterCode); //determines the printer according to the ZPL printer selection
    ZPLPrinter.Get(PrinterCode);
    IZebraConnector := ZPLPrinter."Connection Type"; //connection to the printer must be implemented in subapps
    
    Placeholders.Add('Test');
    Placeholders.Add('Test2'); //Definition of the values that replace the placeholders. The placeholder %1 is being replaced with 'Test' and placeholder %2 is being replaced with 'Test2'.
    LabelLayout := ZPLLayout.GetLayoutAsText();
    ZPLLayout.SetNoOfCopiesForLayout(NoOfCopies, LabelLayout);
    LabelLayout := ZPLLayout.ReplacePlaceholders(LabelLayout, Placeholders);
    IZebraConnector.Print(LabelLayout, PrinterCode);
end;


Submit feedback for
DE|EN Imprint