我可以使用JavaScript选择打印机吗? [英] Can I have JavaScript select printer to use?

查看:890
本文介绍了我可以使用JavaScript选择打印机吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

从网络应用程序打印到特定打印机

我们的一个内部网应用程序需要打印到非默认打印机。当然人们经常忘记选择正确的打印机。

One of our intranet applications needs to print out to a non-default printer. Of course people regularly forget to select the correct printer.

我知道你不能通过JavaScript正常做到这一点,但鉴于浏览器是IE9,我可以添加Web应用程序到受信任区域(并随意调整安全设置),有没有办法编写自动选择正确打印机的JavaScript?也许使用一些ActiveX或其他IE特定的东西。

I'm aware that you can not do this normally via JavaScript but given that the browser is IE9 and I can add the webapp to the trusted zone (and fiddle around with the security settings at will), is there any way to write JavaScript that will automatically select the correct printer? Perhaps using some ActiveX or other IE specific stuff.

推荐答案

不,Javascript对象模型包含一个window.print()方法,可以激活Web浏览器的标准打印对话框,但就功能而言。 Javascript代码能够检查连接到计算机的打印机,查找打印机属性或任意配置其设置是不合适或安全的。

No, the Javascript object model includes a window.print() method that may activate the standard print dialogue of a Web browser, but that is as far as the functionality extends. It would not be appropriate or safe for Javascript code to be able to check the printers attached to a computer, look up printer properties or arbitrarily configure their settings.

我建议在打印之前添加一个弹出窗口,提醒用户选择适当的打印机。

I suggest to add a pop prior to printing where you remind the user to select the appropiate printer.

这篇关于我可以使用JavaScript选择打印机吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆