简体   繁体   English

如何从网页打印而不显示打印对话框

[英]How to print from web page without showing print dialog

I need to implement Web based Point of Sales software where receipt printing will be done often and showing print dialogue every time would be annoying. 我需要实现基于Web的销售点软件,其中收据打印将经常进行,并且每次都显示打印对话会很烦人。 So I want to get rid of the print dialogue. 所以我想摆脱印刷对话。 How it could be achieved using JavaScript? 使用JavaScript如何实现?

I have searched a lot on internet and unable to find the proper solution. 我在互联网上进行了大量搜索,无法找到合适的解决方案。 It has to be supported on all the browsers (IE, FireFox, Chrome). 所有浏览器(IE,FireFox,Chrome)都必须支持它。

Short answer ... You can't .... 简短答案...您不能...。

Little longer answer ... You can't and probably never will be able to - its just to restrictive to force a user to print to a specific printer with specific settings 不再有答案了……您无法而且可能永远也不会—只能强制用户使用特定设置在特定打印机上进行打印

You can use a workaround - this one is not nice. 您可以使用一种解决方法-这不是很好。

If you can control the end computer, you can put a simple AutoIt or Autohotkey script on it. 如果可以控制终端计算机,则可以在其上放置一个简单的AutoIt或Autohotkey脚本。 The script can 1. check if your page is running 2. always apply the standard printer if so. 该脚本可以1.检查页面是否正在运行2.始终应用标准打印机。

We have done this for a terminal which shouldn't contain other software then ours. 我们为不包含其他软件的终端机执行了此操作。 Such things are not nice however if its an unmanaged pc, sooner or later on such devices you will have the problem that someone wants to print something on another printer. 这样的事情不太好,但是,如果它的计算机不受管理,迟早会在此类设备上出现,则您会遇到有人要在另一台打印机上进行打印的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM