View Full Version : Opening the Printer Dialog box to print a PDF
05-25-2005, 09:43 PM
This can't be difficult, but i can't seem to find any info on how to do this.
I would like to have a link that opens the Printer Dialog box so a PDF can be printed. This is without opening the PDF at all, but printing out the PDF on a printer. Can this be done?
P.S. I bet it's so simple I'm going to slap myself...
05-25-2005, 11:10 PM
I stand corrected. Nice one Glennv :thumbsup:
<input type="button" value="Print" name="btnPrint" id="btnPrint" onclick="window.print();">
this would print the html page the button resides on.
It's untested, but if you had something like:
<iframe src="myDocument.pdf" id="myIframe"></iframe>
<input type="button" value="Print" name="btnPrint" id="btnPrint" onclick="document.getElementById("myIframe").print();">
It should print the content of that window/frame.
hope this helps
05-26-2005, 04:37 AM
05-26-2005, 06:04 PM
IE only. :(
05-27-2005, 04:00 AM
At the moment, you have to make do with a workaround.
Load the PDF in a hidden iframe. That will confuse users though as the Acrobat splash screen will show up even if they won't see a PDF file.
var pdf = document.getElementById("pdfDoc").contentWindow;
<iframe src="myDocument.pdf" id="pdfDoc" style="display:none"></iframe>
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.