使用window.print()时跳过打印机的对话框 [英] skip the printer's dialog box while using window.print()
本文介绍了使用window.print()时跳过打印机的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用IE 7作为浏览器并使用window.print()方法进行打印.它运行良好.我要跳过的是打印机对话框.
好吧,可能有一些Windows的dll文件可能会跳过这一步,我正在使用javascript代码
I am using Ie 7 as browser and using window.print() method to print.it is working well.what i want is to skip the printer''s dialog box
Well there might be some dll file of windows that could skip this i was using javascript code
var sURL = document.location.href;
var WshShell = new ActiveXObject("wscript.shell");
WshShell.run("rundll32.exe c:\windows\system32\mshtml.dll, PrintHTML " + sURL);
但是效果不佳
现在我正在使用以下功能,并且遇到以下情况.它正在打印但不跳过打印对话框
But it is not working as well
Now i am using the following function and i am having following scenario.it is printing but not skiping the print dialog
function printPartOfPage(elementId)
{
var printContent = document.getElementById(elementId);
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
//var sURL = document.location.href;
//var WshShell = new ActiveXObject("wscript.shell");
//WshShell.run("rundll32.exe c:\windows\system32\mshtml.dll, PrintHTML " + windowUrl);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
推荐答案
您不能.您根本没有那种控制水平.
You can''t. you simply don''t have that level of control.
这篇关于使用window.print()时跳过打印机的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文