My WPF app is using .NET 7 and it need to connect with KR403 printer to check connectivity and print status. I installed Zebra.Printer.SDK v2.16.2905 to Visual Stusdio 2022 from Nuget but I can't find the .dll files for .NET 7 to add my project. So I try to add the lib of .Net4.7.1 and I can check to connectivity but I always get below error when checking current status.
Using this code:
string printerName ="";
List<DiscoveredPrinterDriver> discoPrinters = UsbDiscoverer.GetZebraDriverPrinters();
foreach (DiscoveredPrinterDriver device in discoPrinters)
{
printerName = device.PrinterName;
}
Connection connection = new DriverPrinterConnection(printerName);
connection.Open();
ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);
PrinterStatus printerStatus = printer.GetCurrentStatus();
Exception message:
Zebra.Sdk.Comm.ConnectionException: Malformed status response - unable to determine printer status
at Zebra.Sdk.Printer.Internal.PrinterStatusZpl.GetStatusInfoFromPrinter()
at Zebra.Sdk.Printer.Internal.PrinterStatusZpl.GetPrinterStatus()
at Zebra.Sdk.Printer.Internal.PrinterStatusZpl.UpdateStatus()
at Zebra.Sdk.Printer.PrinterStatus.GetStatusFromPrinter()
at Zebra.Sdk.Printer.PrinterStatus..ctor(Connection printerConnection)
at Zebra.Sdk.Printer.Internal.PrinterStatusZpl..ctor(Connection connection)
at Zebra.Sdk.Printer.Internal.ZebraPrinterZpl.GetCurrentStatus()
So, how I get the status of the KR403? Anyone can help me to solve this error?
Besides, is it normal if I use Windows PrintDocument.PrintPage Event to print receipt?
2 Replies
What is the setting of the device.languages on the KR403? A KR403 can be either on ZPL or on CPCL. If the device.languages and the printer instance mismatch, the malformed status response error will show.
I use the below command in Zebra Setup Utilities to check and result that the current language is ZPL. Then I use this code to get the status but it still gets the malformed status error. What do I need to do next?