如何在ie6中使用javascript在iframe中打印pdf?
我已经在iframe中显示了一个pdf,它位于aspx页面中。我正在开发IE6浏览器。我使用以下html和javascript代码如何在ie6中使用javascript在iframe中打印pdf?,javascript,Javascript,我已经在iframe中显示了一个pdf,它位于aspx页面中。我正在开发IE6浏览器。我使用以下html和javascript代码 <iframe id = "frame_singleCheque" src = "../pdf/SingleCheque.pdf" runat = "server" style ="height:400px; width: 750px; overflow:scroll;" /> function printDoc() { window.f
<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()" />
如果按“打印”按钮,则显示“打印”对话框。但每当我按下打印按钮,它就不会打印任何东西。它不会打印空白页。如何打印它?试试这个:
function printDoc() {
document.getElementById('frame_singleCheque').focus();
document.getElementById('frame_singleCheque').contentWindow.print();
}
编辑:也看看。亲爱的贝朗·赛德扎德,我已经用过这个了。但它会打印除iframe部分之外的整个页面。@Mahedee:你确定还包括contentWindow吗?在代码中,您没有指定contentWindow。