Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
3,484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.50 KB | None | 0 0
  1. <!-- The HTML Code inside of the IFRAME: -->
  2. <embed src="path_to_script_which_generates.pdf" type="application/pdf" id="pdf"width="100%" height="100%"></embed>
  3.  
  4. <!-- JS Code (I would also put it inside of the IFRAME): -->
  5.  
  6. <script>
  7. var doPrinting = (id)
  8. {
  9.     var pdfObject = document.getElementById(id);
  10.     if (typeof(doc.print) === 'undefined') {    
  11.          setTimeout(function(){ doPrinting(id); }, 1000);
  12.     } else {
  13.         pdfObject.print();
  14.     }
  15. };
  16.  
  17. doPrinting('pdf');
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement