Dear Zebra Team,
I cannot connect the zebra printer via USB. Here is the code. It is showing like Unable to connect USB device port "USB003". Printer configuration are perfectly setup and test print is working fine. Kindly guide me what is missed in the below code. My zebra SDK version is 2.14.1919 and .net framework is 4.7. Printer model is zebra zt411
private void SendZplOverUSB()
{
Console.WriteLine("Finding Zebra printer...!!!");
Connection thePrinterConn = new UsbConnection("USB003");
Console.WriteLine("USB Connection Open...!!!");
try
{
thePrinterConn.Open();
string zplData = @"^XA
^ILR:SAMPLE.GRF^FS
^XZ";
thePrinterConn.Write(Encoding.UTF8.GetBytes(zplData));
Console.WriteLine("Write ZPL data to printer");
Console.ReadLine();
}
catch (ConnectionException e)
{
// Handle communications error here.
Console.WriteLine(e.ToString());
Console.ReadLine();
}
finally
{
thePrinterConn.Close();
}
3 Replies
The USB string of "USB003" is incorrect. You need to use the UsbDiscoverer class to find the proper string for the USB connected printer. See the example code in the UsbDiscoverer class.
My USB String is "\\?\usb#vid_0a5f&pid_0174#99j210604359#{28d78fad-5a12-11d1-ae5b-0000f803a8c2}"
Connection thePrinterConn = new UsbConnection(@"\\?\usb#vid_0a5f&pid_0174#99j210604359#{28d78fad-5a12-11d1-ae5b-0000f803a8c2}");
It is also throws "Connection is not open"
Kindly help me..
Thanks in advance
I'm encountering an issue while attempting to connect my Zebra printer via USB. I've provided the relevant code snippet below for your reference. The error message I'm receiving is: "Unable to connect USB device port 'USB003'."
The printer configuration appears to be correctly set up, and I can successfully perform a test print. However, I'm unsure about what might be missing or causing this USB connection problem.