Connecting Tech Pros Worldwide Help | Site Map

Print PDF file using javascript without opening it

Newbie
 
Join Date: Jun 2009
Posts: 1
#1: Jun 19 '09
I got this link from your site..
http://bytes.com/groups/javascript/9...print-pdf-file

I found following code to print pdf file from the link

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>
  4. function doit() {
  5. var x = document.getElementById("doodad");
  6. //.document.plugins.whatever
  7. x.click();
  8. x.setActive();
  9. x.focus();
  10. x.print();
  11. }
  12. </script>
  13. </head>
  14. <body>
  15. <embed id="doodad" src ="D:\Documents and
  16. Settings\ron\Desktop\eth_cli.pdf" width="550" height="550"
  17. name="whatever">
  18. <button onclick="doit()">howdy</button>
  19. </body>
  20. </html>
I am using this code in asp.net application
This code is working fine in IE but in Mozilla this is not working.

Please resolve it
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jun 19 '09

re: Print PDF file using javascript without opening it


If you embed it, you are technically opening (downloading) it.

Perhaps you could try using PDF JavaScript to print it on load.
Reply


Similar JavaScript / Ajax / DHTML bytes