IE内置WebBrowser控件打印遇到的问题:很多图片的页面不能打印
我用IE内置WebBrowser控件打印frame中的页面,当页面中含有较多图片时,当在选择打印机的页面点击“打印”按钮时,打印机没反应,在打印机属性里也没有挂起的打印任务,但是当页面中只有4、5个图片时就能打印正常,一个图片大约200多K,请问有没有遇到相同问题的童鞋,以下是代码,也是从网上找的
我在考虑是否和页面的大小有关系,请教各位是否能给一些建议,谢谢!
function printFrame(frame, onfinish) {
if (!frame) frame = window;
function execOnFinish() {
switch (typeof (onfinish)) {
case "string": execScript(onfinish); break;
case "function": onfinish();
}
if (focused && !focused.disabled) focused.focus();
}
if ((frame.document.readyState !== "complete") && (!frame.document.confirm("The document to print is not downloaded yet! Continue with printing?"))) {
execOnFinish();
return;
}
var eventScope = printGetEventScope(frame);
var focused = document.activeElement;
window.printHelper = function () {
execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");
printFireEvent(frame, eventScope, "onafterprint");
printWB.outerHTML = "";
execOnFinish();
window.printHelper = null;
}
document.body.insertAdjacentHTML("beforeEnd",
"<object id=\"printWB\" width=0 height=0 \
classid=\"clsid:8856F961-340A-11D0-A96B-00C04FD705A2\">");
printFireEvent(frame, eventScope, "onbeforeprint");