I have displayed a pdf in iframe which is in aspx page. I am working on IE6 browser. I use the following html and javascript code.
<iframe id = "frame_singleCheque" src = "../pdf/SingleCheque.pdf" runat = "server" style ="height:400px; width: 750px; overflow:scroll;" />
function printDoc()
{
window.frames['ctl00_contPlcHdrMasterHolder_frame_singleCheque'].focus();
window.frames['ctl00_contPlcHdrMasterHolder_frame_singleCheque'].print();
}
<input type="button" id = "btnCPrint" value = "Print" onclick="javascript:printDoc()" />
If press print button it shows print dialog. but whenever I press print button it doesn't print any 开发者_JS百科thing. It doesn't print event a blank page. How can I print it?
Try this:
function printDoc() {
document.getElementById('frame_singleCheque').focus();
document.getElementById('frame_singleCheque').contentWindow.print();
}
EDIT: Have a look at this as well.
精彩评论