jQuery - Printing PDF in iFrame
HTML
<div>
<span>
The iFrame is below
</span>
</div>
<br />
<iframe src='http://www.stluciadance.com/prospectus_file/sample.pdf' width="100%" height="300px" id="PDF" name="PDF"></iframe>
JavaScript
$(document).ready(function() {
//Grabs the Iframe
var ifr = document.getElementById("PDF");
//PDF is completely loaded. (.load() wasn't working properly with PDFs)
ifr.onreadystatechange = function() {
if (ifr.readyState == 'complete') {
ifr.contentWindow.focus();
if ($.browser.msie) {
document.execCommand('print', false, null);
} else {
window.print();
}
}
}
});