简体   繁体   English

打印到默认打印机而不使用 Javascript 打开 html 中的打印机确认对话框

[英]Print to default printer without open the printer confirmation dialog box in html using Javascript

在 html 文件中点击按钮打印特定的 div 而不打开打印机确认弹出对话框自动打印该内容。

This it not practically possible in a way that's supported by all modern browsers.以所有现代浏览器都支持的方式,这实际上是不可能的。 And for good reason.并且有充分的理由。

You don't want random websites to start printing stuff without your intervention.您不希望随机网站在没有您干预的情况下开始打印内容。

Right Click the google chrome shortcut in the desktop,Select PROPERTIES Then in Target右键单击桌面上的 google chrome 快捷方式,选择属性,然后在目标中

Add the given code at the end在最后添加给定的代码

--user-data-dir=c:\\tmp --kiosk-printing --user-data-dir=c:\\tmp --kiosk-printing

For example:例如:

"C:\\Users\\alpha\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" --user-data-dir=c:\\tmp --kiosk-printing. "C:\\Users\\alpha\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" --user-data-dir=c:\\tmp --kiosk-printing。

It's useful for instant billing using the normal window.print option without any popup box interfere.这对于使用普通 window.print 选项进行即时计费非常有用,不会有任何弹出框干扰。

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

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