views:

557

answers:

1

Is it possible to print to a networked printer from a web app? Are there any POS or similar form factor printers which can be connected to the internet and printed to directly(given that a port is opened through the router)?

My ideal case would be a printer to which I could send XML and have it print without requiring a PC and hence no driver.

Another thing that would be good is creating an ssl connection to the printer, but that's not as critical.

+2  A: 

Most thermal POS or label printers can be connected to a network with an add-on network card from the manufacturer. Big brand names are Zebra and Intermec.

The interesting thing is that most of these printers have a direct ASCII mode, so you just connect on a plain old TCP/IP connection and spit out some formatting commands, etc., written in a proprietary printer language that the manufacturer will give you. In the case of Intermec, it's called IPL (Intermec Printer Language).

You have two options... you can have the user click a button, do a page refresh, and on the server side just open a TCP/IP connection to the printer and print. This would also work for serial port printers and regular windows printers. In fact, this is how we implemented it in a recent project. Your second option is to write some client side code, in JavaScript or what-have-you, to open a connection to the printer and spit out the same printer message. Caveat: you'll probably run into security concerns doing that because the browser may not take kindly to your page initiating outbound connections to random IP addresses. If you're behind a corporate firewall and you can count on doing some tweaking to the client security models, this might be possible.

Personally, I prefer printing from the server side, not the client side.

Scott Whitlock