Click or drag to resize

ProfileUtil Interface

Defines functions used for creating and applying profiles to a Zebra printer.

Namespace:  Zebra.Sdk.Printer
Assembly:  SdkApi_Core (in SdkApi_Core.dll) Version: 2.14.1869
Syntax
public interface ProfileUtil

The ProfileUtil type exposes the following members.

Methods
  NameDescription
Public methodCreateBackup
Save a backup of your printer's settings, alerts, and files for later restoration.
Public methodCreateProfile(Stream)
Create a profile of your printer's settings, alerts, and files for cloning to other printers.
Public methodCreateProfile(String)
Create a profile of your printer's settings, alerts, and files for cloning to other printers.
Public methodLoadBackup(String)
Takes settings, alerts, and files from a backup, and applies them to a printer.
Public methodLoadBackup(String, Boolean)
Takes settings, alerts, and files from a backup, and applies them to a printer.
Public methodLoadProfile(String)
Takes settings, alerts, and files from a profile, and applies them to a printer.
Public methodLoadProfile(String, FileDeletionOption, Boolean)
Takes settings, alerts, and files from a profile, and applies them to a printer.
Top
Examples
using System;
using System.IO;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;

public class ProfileUtilExample {

    private enum ProfileOperations {
        CREATE_PROFILE, RESTORE_BACKUP, CLONE_A_PRINTER
    };

    public static void Main(string[] args) {
        string pathToProfile = "C:\\MyNewProfile.zprofile";
        ProfileOperations whatToDo = ProfileOperations.CREATE_PROFILE; // Change this to load the profile.
        TcpConnection connection = new TcpConnection("192.168.1.32", TcpConnection.DEFAULT_ZPL_TCP_PORT);
        try {
            connection.Open();

            ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
            ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);

            if (linkOsPrinter != null) {
                Console.WriteLine("Start profile operation");
                switch (whatToDo) {
                    case ProfileOperations.CREATE_PROFILE:
                        linkOsPrinter.CreateProfile(pathToProfile);
                        break;

                    case ProfileOperations.RESTORE_BACKUP:
                        linkOsPrinter.LoadBackup(pathToProfile);
                        break;

                    case ProfileOperations.CLONE_A_PRINTER:
                        linkOsPrinter.LoadProfile(pathToProfile);
                        break;
                }
            }
        } catch (ConnectionException e) {
            Console.WriteLine("Could not use connection");
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine("Could not recognize Zebra printer");
            Console.WriteLine(e.ToString());
        } catch (ZebraIllegalArgumentException e) {
            Console.WriteLine("Unexpected response from Zebra printer");
            Console.WriteLine(e.ToString());
        } catch (IOException e) {
            Console.WriteLine("Could not write to " + pathToProfile);
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
        }
    }
}
See Also