title: I want to print only the content of the iframe and not the whole page
body: <p>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.</p>
  
  <pre><code>try {
  iframe = document.getElementById('id of iframe');
  iframe.contentWindow.document.execCommand('print', false, null);
  }
  
  catch (e) {
  window.print();
  }
  </code></pre>
  
  <p>How can I print only the content of the iframe which is the PDF in this case?</p>