以下代码无法在Internet Explorer中请求客户端的其他工具。
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML = "<html><head></head><body>" + divElements + "</body>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
//disable postback on print button
return false;
}
答案 0 :(得分:0)
window.print()
将只打开浏览器打印对话框。因此,如果您想以PDF格式安全打印输出,则需要在操作系统上安装pdf打印机驱动程序。