title: How to print a pdf?
body: <p>I have  a pdf url, embedded in  a rectangular area of an iframe. I am trying to print it on click of a button . My code looks like this :</p>
  
  <p><strong>JavaScript to print :</strong></p>
  
  <pre><code>function printPDF(pdfUrl)
  {
  var w = window.open(pdfUrl);
  w.print();
  w.close();
  }
  </code></pre>
  
  <p><strong>HTML-Code :</strong></p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;input type="submit"  value="Print"
  name="Submit" id="printbtn"
  onclick="printPDF('http://www.irs.gov/pub/irs-pdf/fw4.pdf')" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Now in MF it is coming like this :</p>
  
  <p><img src="https://i.stack.imgur.com/oqdML.png" alt="enter image description here"></p>
  
  <p>The problem , its not working properly in  chrome and IE. I have chrome 20 and IE 8. In chrome the print window gets loaded in a new tab(which is ok) but pdf does not get loaded in preview. In IE the pdf just gets opened in a new tab and print prompt does not come up. </p>
  
  <p>Before any one asks me, pdf might have inherent print functionality. but the pdfs that i am processing need to have a print button. People, kindly help me out here. Is there a solution, which is applicable in all the 3 browsers .</p>