0

What are some options to have a website print a pdf file directly to the default printer?

Secondly what are some options to print a pdf file directly to a specific pre-determined printer (i.e. receipt printer)?

In my research it seems like you can't just print directly from a browser (you can't control the user's PC from a browser directly), but what about any type of plug-ins or such that would allow such a thing?

I'd like to offer a "print" button, and as soon as the user clicks it a PDF file is generated behind the scenes and printed directly to the printer (the user doesn't need to see the PDF on the screen).

I'm thinking this isn't possible with the browser alone, but possibly with a browser plug-in or something like that?

Thank you.

user3513237
  • 655
  • 3
  • 8
  • 20

1 Answers1

1

It was possible with some old version of Adobe Reader to automate printing of local PDF documents but it is not considered as good practice to print without user's consent. You should better consider displaying the instruction to print the PDF document as either separated page or as an iframe on the same page.

added from comments on March 25, 2016: Google Cloud Print may help to automate the printing by sending documents remotely to the previously configured printer(s). See the official API reference and open-source applications on Github

Eugene
  • 2,614
  • 17
  • 21
  • So how do web based POS applications for example allow printing to receipt printers automatically? – user3513237 Mar 17 '16 at 21:29
  • no way without user confirmation. Or you should implement your own browser or browser plugin that is installed locally first. Or use the cloud printing service like https://developers.google.com/cloud-print/ – Eugene Mar 18 '16 at 17:36
  • or, force your users to use IE (not good): http://stackoverflow.com/a/1124848/712093 – Eugene Mar 18 '16 at 17:40
  • check these samples on Github to learn about google cloud print: https://github.com/search?utf8=✓&q=google+cloud+print&type=Repositories&ref=searchresults – Eugene Mar 23 '16 at 10:28