Link to home
Start Free TrialLog in
Avatar of 7of9121098
7of9121098

asked on

Print a PDF document via Jscript without opening the pdf document.

I'm using I.e 7.0 and I'm trying to print a PDF document via JScript. I just want to hit the print button and the print-wiindow should show up. The below code works but only prints-out the contents of the webpage but not the PDF document. I'm I missing something?

   <iframe id="iFramePdf" runat="server" src="tt877A6.pdf" style="display:none;"></iframe>
   <input type="button" value="Print" onclick="javascript:printTrigger('iFramePdf');" />

      function printTrigger(elementId) {
            var getMyFrame = document.getElementById(elementId);
           // alert(elementId);
           // iFramePdf.focus();
            //window.print();
            iFramePdf.focus();
            iFramePdf.print();
            //iFramePdf.contentDocument.print();
        }
   
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial