C# – Print ZPL to Zebra Printer via C#.NET

cnetvisual-studio-2017windows 10zebra-printers

I am working on building a website that will print ZPL code to a Zebra printer "140XiIII". The specifics are as follows:

  1. The Printer is connected to the computer via Parallel Port.

  2. The Printer is not connected to the network.

  3. Website Administrator wished to avoid Javascript use if at all possible and instead focus on C#.

I have tried using the code at .NET code to send ZPL to Zebra printers that states that it will work on any port. I run through the code and get no errors, but also nothing gets sent to the printer.

I have attempted to decipher and use the InpOut32/64 DLL, though that is more complicated than my meager learnings are able to understand.

Other options either require the printer be connected to the network, or are outdated and no longer an option due to no longer being in the Windows code.

Thank you.

Best Answer

I would suggest trying the following:

  • Log into the server, preferably as the user that the service is set to run as.
  • Ensure your Zebra printer is installed as a local printer, and the printer name is correct.
  • Print a test page from the printer properties.
  • Print your ZPL manually:

net use lpt1 "printer shared name" print "C:\Users\serviceuser\desktop\label.txt"

If you try the above and it works, I would be surprised that the code you linked does not work.

Related Topic