Printing from a web app directly to a printer

Three ways to print directly to printers from a web app:

1. Print by email

HP printers support ePrint, which is the ability to email a doc, pdf, html, or jpg to a printer. It will print automatically, without going through a PC. If it's a recent HP printer (~3 years or less old), it will support ePrint. I worked on a Rails app about two years ago where we built this. We asked the user for the printer's email address and stored it. When we had a print ready for them, we used ActionMailer to build an email, attach a PDF, and send it. ActionMailer supports attachments pretty easily:

Some wikipedia info on HP ePrint:
I work for HP, but I just checked, and it looks like Epson also supports (Email Print).

2. Print by Cloudprint

Another choice, especially if you want to check if the printer is online or if the print job completed, is to use Google Cloudprint. I haven't implemented anything with Cloudprint, but it has a RESTful API: On the user's side, they can use a printer that directly supports Cloudprint. Again, I know HP printers can do this (, but other manufacturers might support it as well. (Indeed, Google shows many that do.)

If the user doesn't have a cloudprint capable printer, all is not lost! Google Chrome can act as a proxy for any legacy printer. Google has a support doc that explains how.

3. Print by local network

If you know the printer is on the local network, such as when you've got a centralized reporting server for a company, then you've got a third option. Assuming your app server is on a Linux box, you can use CUPS to send a job to the printer. Then you can use lpr to send a PDF file to the printer.



More from Will

Code Tutorials

Here are Will's detailed code tutorials that we have migrated to Print Fundamentals for Developers on the HP Developers' Portal

Will's blog and forum posts


Author : TheSkipper

How to know whether printer has printed successfully or not and the exact error message from a web app or client application ?

It is possible via Googe CloudPrint, via the Cloud Job State API call: ---- For the Linux/CUPS scenario, it is possible using lpstat: ----- It’s not possible to determine the print status via HP ePrint because we have not made a public API.

My company currently relies on Google Cloud Print to manage hundreds of printers across the country. We are looking for an alternative option for remote printing (i.e. print jobs will be triggered from off-site, and will not be on the same local network as the printers). HP ePrint gets close, but does not allow for our desired media size or print quality. We are trying to duplex print B5 media with the highest quality, and we are using HP Pagewide Pro 552dw printers. Do you have any recommendations?