View Full Version : Need javascript to open print dialog box in PDF

02-22-2011, 12:16 AM
We are using a PDF generator plugin for Wordpress that creates the PDF for the page being viewed. We'd also like to add the option for the visitor to generate AND print the PDF (option #1 just to generate and download, option #2 to generate and print). However, when they choose the 'print' option we want the PDF file to generate, open in a new tab/window, and immediately display the printer dialog box so all they have to do is hit the Print button.

I've seen this done before and, from what i've found on how to do it, it requires embedding the javascript code into the PDF file which then, when being opened by the browser, acts on the command to open the printer dialog box.

Anyone have a solution for this? Thanks in advance!