Guest User

Untitled

a guest
Jul 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. <embed src="vehinvc.pdf" id = "Pdf1" name="Pdf1" hidden>
  2. <a onClick="document.getElementById('Pdf1').printWithDialog()" style="cursor:hand;">Print file</a>
  3.  
  4. <OBJECT id = "Pdf2" name="Pdf2" CLASSID="clsid:CA8A9780-280D-11CF-A24D-444553540000" WIDTH="364" HEIGHT="290">
  5. <PARAM NAME='SRC' VALUE="file.pdf">
  6. </OBJECT>
  7. <a onClick="document.Pdf2.printWithDialog()">Print file</a>
  8.  
  9. function printTrigger(elementId) {
  10. var getMyFrame = document.getElementById(elementId);
  11. getMyFrame.focus();
  12. getMyFrame.contentWindow.print();
  13. }
  14.  
  15. (an onClick on an a or button or input or whatever you wish)
  16.  
  17. <input type="button" value="Print" onclick="printTrigger('iFramePdf');" />
  18. an iframe pointing to your PDF...
  19.  
  20. <iframe id="iFramePdf" src="myPdfUrl.pdf" style="dispaly:none;"></iframe>
  21.  
  22. <?php
  23.  
  24. $browser_ver = get_browser(null,true);
  25. //echo $browser_ver['browser'];
  26.  
  27. if($browser_ver['browser'] == 'IE') {
  28. ?>
  29.  
  30. <!DOCTYPE html>
  31. <head>
  32. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  33. <title><strong class="highlight">pdf</strong> <strong class="highlight">print</strong> test</title>
  34. <style>
  35. html { height:100%; }
  36. </style>
  37. <<strong class="highlight">script</strong>>
  38. function printIt(id){
  39. var <strong class="highlight">pdf</strong> = document.getElementById("samplePDF");
  40. <strong class="highlight">pdf</strong>.click();
  41. <strong class="highlight">pdf</strong>.setActive();
  42. <strong class="highlight">pdf</strong>.focus();
  43. <strong class="highlight">pdf</strong>.print();
  44. }
  45. </script>
  46. </head>
  47.  
  48. <body style="margin:0; height:100%;">
  49.  
  50. <embed id="samplePDF" type="application/pdf" src="/pdfs/2010/dash_fdm350.pdf" width="100%" height="100%" />
  51. <button onClick="printIt('samplePDF')"><strong class="highlight">Print</strong></button>
  52.  
  53.  
  54. </body>
  55. </html>
  56.  
  57. <?php
  58. } else {
  59. ?>
  60. <HTML>
  61. <<strong class="highlight">script</strong> Language="javascript">
  62.  
  63. function printfile(id)
  64. {
  65. window.frames[id].focus();
  66. window.frames[id].print();
  67. }
  68.  
  69. </script>
  70. <BODY marginheight="0" marginwidth="0">
  71.  
  72. <iframe src="/pdfs/2010/dash_fdm350.pdf" id="objAdobePrint" name="objAdobePrint" height="95%" width="100%" frameborder=0></iframe><br>
  73.  
  74. <input type="button" value="<strong class="highlight">Print</strong>" onclick="javascript<b></b>: printfile('objAdobePrint');">
  75.  
  76. </BODY>
  77. </HTML>
  78. <?php
  79. }
  80. ?>
Add Comment
Please, Sign In to add comment