ProfileUtil Interface |
Namespace: Zebra.Sdk.Printer
The ProfileUtil type exposes the following members.
Name | Description | |
---|---|---|
CreateBackup |
Save a backup of your printer's settings, alerts, and files for later restoration.
| |
CreateProfile(Stream) |
Create a profile of your printer's settings, alerts, and files for cloning to other printers.
| |
CreateProfile(String) |
Create a profile of your printer's settings, alerts, and files for cloning to other printers.
| |
LoadBackup(String) |
Takes settings, alerts, and files from a backup, and applies them to a printer.
| |
LoadBackup(String, Boolean) |
Takes settings, alerts, and files from a backup, and applies them to a printer.
| |
LoadProfile(String) |
Takes settings, alerts, and files from a profile, and applies them to a printer.
| |
LoadProfile(String, FileDeletionOption, Boolean) |
Takes settings, alerts, and files from a profile, and applies them to a printer.
|
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(); } } }