I know how to open a webpage in a new window and add javascript so the print dialog pops up. Is there a way to do a similar thing with a PDF file?
Probably not because the print command is being sent directly from the PDF application and not the browser(which the JS interacts with).
if you embed the pdf in your webpage and reference the object id, you should be able to do it.
eg. in your HTML:
<object ID="examplePDF" type="application/pdf" data="example.pdf" width="500" height="500">
in your javascript:
<script>
var pdf = document.getElementById("examplePDF");
pdf.print();
</script>
I hope that helps.
Yes you can...
PDF have Javascript support. I needed to have auto print capabilities when a PHP generated PDF was created and I was able to use FPDF to get it to work:
embed:
< object type="application/pdf" data="example.pdf" width="100%" height="100%" id="examplePDF" name="examplePDF" >< param name='src' value='example.pdf'/>< /object>
< script> examplePDF.printWithDialog(); < /script>
May have to fool around with the ids/names. Using adobe reader...