Printing directly to a Printer

For one of our web applications we currently have a process that generates for a Zebra Label printer the native zpl code in a file. The client then hits a print button which then opens that zpl text file in whatever default editor they have on their system, eg. windows/notepad.

What we’d prefer is to have the ability to send that zpl code file directly to the printer after the client has hit the print button. Any help in what is involved in doing this would be much appreciated.


This is in windows or Mac

In windows you can use shell and this

I doubt this is at all possible with a WEB application as the server is unaware (nor has direct) access to the client computer/configuration…

I suppose your Zebra label printer is using a serial interface. The only way to send printing codes to it would be through a desktop app. The web app runs inside a browser that has no access to the serial port.

In principle you could do that through a desktop helper app that links to your web app through specialurl. When the users clicks print, the app sends the data to print to the helper which then sends that to the printer.

That would require delivering the helper to the user by download, and instruct him how to install it, and how to run the helper automatically, but it looks doable.

My company creates a popup that is the ZPL print document. The source looks something like this:


Please print to your Zebra printer... .zpl {display:none;} p {display:none;} .zpl {display:block;}

Please print to your Zebra printer...


Works great in our warehouse. It just opens to a small 300 x 100 window and opens the print dialog when open.

if the server is on the same network, or even a network that is reachable from the printer, i.e LAN/WAN
then you can just open a tcp port to a network printer on port 9100 and writeline the string

if its serial device then a simple serial to ethernet device works great. or get the official zebra ones.

if the clients are on the internet then it wont work, unless you do a bit of working around it. its definitely possible
to do it though. i know, i do.

Thank you all for your feedback. We’re trying out your solution Bob and so far it is looking promising.

The nice thing about it is that it looks polished and still gives the user a feeling of control.