By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

I want to print only the content of the iframe and not the whole page

P: 2
I'm displaying a PDF within an Iframe and I have a dynamic button which says Print. On the click of that button, I want to print only the PDF which is displayed in the iframe and not the complete page. I'm using the below code to print but it is printing the whole page.

Expand|Select|Wrap|Line Numbers
  1.   try {
  2.                       iframe = document.getElementById('id of iframe');
  3.                       iframe.contentWindow.document.execCommand('print', false, null);
  4.         } 
  5.  
  6.                   catch (e) {
  7.                     window.print();
  8.                            }
How can I print only the content of the iframe which is the PDF in this case?

Thank you!!
Sep 5 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.