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 :
JavaScript to print :
function printPDF(pdfUrl)
{
var w = window.open(pdfUrl);
w.print();
w.close();
}
HTML-Code :
<table>
<tr>
<td><input type="submit" value="Print"
name="Submit" id="printbtn"
onclick="printPDF('http://www.irs.gov/pub/irs-pdf/fw4.pdf')" /></td>
</tr>
Now in MF it is coming like this :
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.
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 .