Click or drag to resize

FormatUtilLinkOs Interface

Defines functions used for interacting with Link-OS™ printer formats.

Namespace: Zebra.Sdk.Printer
Assembly: SdkApi.Core (in SdkApi.Core.dll) Version: 3.0.3271
Syntax
public interface FormatUtilLinkOs

The FormatUtilLinkOs type exposes the following members.

Methods
 NameDescription
Public methodPrintStoredFormatWithVarGraphics(String, DictionaryInt32, String) Prints a stored format on the printer, filling in the fields specified by the Dictionary.
Public methodPrintStoredFormatWithVarGraphics(String, DictionaryInt32, String, String) Prints a stored format on the printer, filling in the fields specified by the Dictionary.
Public methodPrintStoredFormatWithVarGraphics(String, DictionaryInt32, ZebraImageI, DictionaryInt32, String) Prints a stored format on the printer, filling in the fields specified by the Dictionaries.
Public methodPrintStoredFormatWithVarGraphics(String, DictionaryInt32, ZebraImageI, DictionaryInt32, String, String) Prints a stored format on the printer, filling in the fields specified by the Dictionaries.
Top
Example
C#
using System;
using System.Collections.Generic;
using System.IO;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Graphics;
using Zebra.Sdk.Printer;

public class FormatUtilLinkOsExample {

    /// Print a stored format with the given variables.
    /// 
    /// The following ZPL will store a format on the Link-OS™ printer.
    /// 
    /// ^XA
    /// ^DFE:FORMAT2.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
    /// ^FO100,100^XG^FN13,1,1^FS
    /// ^FO5,17^GB601,379,8^FS
    /// ^XZ
    public static void Main(string[] args) {
        string pathToImageFileOnHost = "/path/to/my/image/example.png";
        Connection connection = new TcpConnection("1.2.3.4", TcpConnection.DEFAULT_ZPL_TCP_PORT);
        try {
            connection.Open();

            Dictionary<int, string> vars = new Dictionary<int, string> {
                { 12, "John" },
                { 11, "Smith" }
            };

            ZebraImageI image = ZebraImageFactory.GetImage(pathToImageFileOnHost);
            Dictionary<int, ZebraImageI> imgVars = new Dictionary<int, ZebraImageI> {
                { 13, image }
            };

            ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
            ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);
            if (linkOsPrinter != null) {
                linkOsPrinter.PrintStoredFormatWithVarGraphics("E:FORMAT2.ZPL", imgVars, vars);
            }
        } catch (ConnectionException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine(e.ToString());
        } catch (IOException e) {
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
        }
    }
}
See Also