I am developing a web-application (.net, c#) that needs to print png files using Zebra ZT410 printer. I am trying to use code from zebra examples (connect to printer with TCP/IP, port 9100 and print a sample text) - Zebra Technologies - Send ZPL Commands via TCP/IP in C#
I don't get any errors, but nothing is printing. I tried port 6101 too, no luck.
Any suggestions why it is not working?
string ZPLString =
"^XA" +
"^FO50,50" +
"^A0N50,50" +
"^FDHello, World!^FS" +
"^XZ";
try
{
// Open connection
System.Net.Sockets.TcpClient client = new System.Net.Sockets.TcpClient();
client.Connect(ipAddress, port);
// Write ZPL String to connection
System.IO.StreamWriter writer =
new System.IO.StreamWriter(client.GetStream());
writer.Write(ZPLString);
writer.Flush();
// Close Connection
writer.Close();
client.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
Console.Read();
Zebra ZT410 |
2 Replies
Hi Kate, this code is fine. I tried it just now with good results.
Can you verify the data LED on the printer does not blink at all when you run this code?
Can you try pinging the printer? Just to verify there are no major firewall/network issues.
Hi Robin. Thanks for quick reply!
The light is not blinking when I run the code (I see constant Status and Network lights on).
I pinged ip and results are good.
I also installed Zebra Utilities and tried to open communication with printer. Got the message below. Can it be related to my issue with running code? Maybe it is some permission error?
The printer I am using is a network shared printer. I installed drivers and can print images using the usual windows print tools.
Anything else I can do to resolve the issue?