Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <embed src="vehinvc.pdf" id = "Pdf1" name="Pdf1" hidden>
- <a onClick="document.getElementById('Pdf1').printWithDialog()" style="cursor:hand;">Print file</a>
- <OBJECT id = "Pdf2" name="Pdf2" CLASSID="clsid:CA8A9780-280D-11CF-A24D-444553540000" WIDTH="364" HEIGHT="290">
- <PARAM NAME='SRC' VALUE="file.pdf">
- </OBJECT>
- <a onClick="document.Pdf2.printWithDialog()">Print file</a>
- function printTrigger(elementId) {
- var getMyFrame = document.getElementById(elementId);
- getMyFrame.focus();
- getMyFrame.contentWindow.print();
- }
- (an onClick on an a or button or input or whatever you wish)
- <input type="button" value="Print" onclick="printTrigger('iFramePdf');" />
- an iframe pointing to your PDF...
- <iframe id="iFramePdf" src="myPdfUrl.pdf" style="dispaly:none;"></iframe>
- <?php
- $browser_ver = get_browser(null,true);
- //echo $browser_ver['browser'];
- if($browser_ver['browser'] == 'IE') {
- ?>
- <!DOCTYPE html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><strong class="highlight">pdf</strong> <strong class="highlight">print</strong> test</title>
- <style>
- html { height:100%; }
- </style>
- <<strong class="highlight">script</strong>>
- function printIt(id){
- var <strong class="highlight">pdf</strong> = document.getElementById("samplePDF");
- <strong class="highlight">pdf</strong>.click();
- <strong class="highlight">pdf</strong>.setActive();
- <strong class="highlight">pdf</strong>.focus();
- <strong class="highlight">pdf</strong>.print();
- }
- </script>
- </head>
- <body style="margin:0; height:100%;">
- <embed id="samplePDF" type="application/pdf" src="/pdfs/2010/dash_fdm350.pdf" width="100%" height="100%" />
- <button onClick="printIt('samplePDF')"><strong class="highlight">Print</strong></button>
- </body>
- </html>
- <?php
- } else {
- ?>
- <HTML>
- <<strong class="highlight">script</strong> Language="javascript">
- function printfile(id)
- {
- window.frames[id].focus();
- window.frames[id].print();
- }
- </script>
- <BODY marginheight="0" marginwidth="0">
- <iframe src="/pdfs/2010/dash_fdm350.pdf" id="objAdobePrint" name="objAdobePrint" height="95%" width="100%" frameborder=0></iframe><br>
- <input type="button" value="<strong class="highlight">Print</strong>" onclick="javascript<b></b>: printfile('objAdobePrint');">
- </BODY>
- </HTML>
- <?php
- }
- ?>
Add Comment
Please, Sign In to add comment