问题
I want my application to print directly to the default printer without the Windows select printer dialog coming up and I really dont need to display the screen. All the user wants is a printout, receipt.
回答1:
No, you cannot do it.
You can only do window.print()
with javascript and it displays the window.
Why you cannot: because safety.
回答2:
No I'm afraid this is not possible. You could just run millions of print tasks at the time, and it wouldn't be good for user
回答3:
yes, you can. In Firefox about:config you can make property print.always_print_silent equal to true.Then Firefox will print without prompt. And using "JS Print setup" you can adjust some printer parameters directly from javascript
回答4:
Short answer: you can't do that with JavaScript.
来源:https://stackoverflow.com/questions/7448008/php-or-javascript-auto-print