Defines functions used for interacting with printer formats.
Namespace:
ZSDK_API.PrinterAssembly: ZSDK_API (in ZSDK_API.dll) Version: 1.1.123.0
Syntax
C# |
---|
public interface FormatUtil |
Visual Basic (Declaration) |
---|
Public Interface FormatUtil |
Examples
Print a stored format with the given variables.
This ZPL will store a format on a printer, for use with the example code.
Copy
^XA ^DFE:FORMAT.ZPL ^FS ^FT26,243^A0N,56,55^FH\^FN12"First Name"^FS ^FT26,296^A0N,56,55^FH\^FN11"Last Name"^FS ^FT258,73^A0N,39,38^FH\^FDVisitor^FS ^BY2,4^FT403,376^B7N,4,0,2,2,N^FH^FDSerial Number^FS ^FO5,17^GB601,379,8^FS ^XZ
CopyC#
using System; using ZSDK_API.Comm; using ZSDK_API.ApiException; using ZSDK_API.Printer; TcpPrinterConnection zebraPrinterConnection = new TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT); try { zebraPrinterConnection.Open(); ZebraPrinter printer = ZebraPrinterFactory.GetInstance(zebraPrinterConnection); // FORMAT.ZPL has two fields - the first is number 12, the second is number 11 Dictionary<int,String> vars = new Dictionary<int,String> (){{12,"John"},{11,"Smith"}}; printer.GetFormatUtil().PrintStoredFormat("E:FORMAT.ZPL", vars); zebraPrinterConnection.Close(); } catch (ZebraPrinterConnectionException e) { Console.Write(e.Message); } catch (ZebraPrinterLanguageUnknownException e) { Console.Write(e.Message); }
CopyVB.NET
Imports ZSDK_API.ApiException Imports ZSDK_API.Comm Imports ZSDK_API.Printer Dim zebraPrinterConnection As New TcpPrinterConnection("192.168.1.100", TcpPrinterConnection.DEFAULT_ZPL_TCP_PORT) Try zebraPrinterConnection.Open() Dim printer As ZebraPrinter = ZebraPrinterFactory.GetInstance(zebraPrinterConnection) ' FORMAT.ZPL has two fields - the first is number 12, the second is number 11 Dim vars As New Dictionary(Of Integer, String)() vars.Add(12, "John") vars.Add(11, "Smith") printer.GetFormatUtil().PrintStoredFormat("E:FORMAT.ZPL", vars) zebraPrinterConnection.Close() Catch e As ZebraPrinterConnectionException Console.Write(e.Message) Catch e As ZebraPrinterLanguageUnknownException Console.Write(e.Message) End Try