问题
In html file print the particular div on clicking the button without open the printer confirmation popup dialog box automatically print that content.
回答1:
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.
回答2:
Right Click the google chrome shortcut in the desktop,Select PROPERTIES Then in Target
Add the given code at the end
--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.
It's useful for instant billing using the normal window.print option without any popup box interfere.
来源:https://stackoverflow.com/questions/40020826/print-to-default-printer-without-open-the-printer-confirmation-dialog-box-in-htm