I want to print some card templates using code. I've tried copying the example code from the SDK documentation, but it just doesn't work.
Here's an example of the code I've tried. The code is supposed to print an image, but it doesn't.
//************************************************************************************************************
public static void Main(string[] args) {
//This line is for connect to printer by local net
//Connection connection = new TcpConnection("192.168.1.23", TcpConnection.DEFAULT_ZPL_TCP_PORT);
//This line is for connect to printer by USB
//Connection connection = new UsbConnection(UsbDiscoverer.GetZebraUsbPrinters(new ZebraCardPrinterFilter())[0].ToString());
try {
connection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(PrinterLanguage.ZPL, connection);
int x = 0; int y = 0;
printer.PrintImage(@"C:\Users\Gerardo-Sistemas\Pictures\unnamed - Copy-Recovered.bmp", x, y);
}
catch (ConnectionException e) {
Console.WriteLine(e.ToString());
}
catch (ZebraPrinterLanguageUnknownException e) {
Console.WriteLine(e.ToString());
}
catch (IOException e) {
Console.WriteLine(e.ToString());
}
finally {
connection.Close();
}
Console.ReadLine();
}
//**************************************************************************************************************
I know that the example code is for Console, but if I can make this single function work, I think I'll be able to proceed.
Perhaps, I have installed the Zebra.Printer.Card.SDK and Zebra.Printer.SDK libraries in the project. What am I doing wrong, or what else do I need to do?
1 Replies
The ZC300 Windows Forms is a versatile software solution designed for developing graphical user interfaces (GUIs) in Windows applications. AT&T Internet plan With its intuitive drag-and-drop interface and extensive library of pre-built controls, developers can quickly create interactive and visually appealing forms for various applications. The ZC300 Windows Forms framework offers robust functionality, including event handling, data binding, and customization options, facilitating efficient development and deployment of Windows-based software solutions.