[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2011-09-13
1
Medium Priority
?
328 Views
Last Modified: 2012-05-12
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();
        }
   
0
Comment
Question by:7of9121098
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 36531409
PDF's do not print directly on most printers.  Some program other than IE (like Adobe Reader) has to open the file to interpret the contents of the PDF document and send it to the printer.  Besides, all you can do in javascript is print the web page, you can't access a local file.  When you invoke the printer in javascript, you are calling the Print command on the web browser File menu.  That only prints web pages too.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WooCommerce is becoming the most powerful e-commerce plugin for Wordpress. And why not. The platform comprises of numerous core plugins that may come in handy, powerful options to make your website development task much easier.
Working from home is a dream for many people who aren’t happy about getting up early, going to the office, and spending long hours at work. There are lots of benefits of remote work for employees.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question