如何强制网站打印 [英] How to force a website to print
问题描述
编辑:我知道我可以做window.print();让打印对话框出现......我问我是否可以在没有任何人工输入的情况下使页面从打印机中出来。根据这些帖子,似乎只有网页浏览器才能完成。
您可以编写一个具有Web浏览器控件的独立应用程序,并为您进行打印。尽管如此,在常规浏览器中没有办法做到这一点 - 考虑到这一点。
This is going to sound like an odd request, but... I have a web application that is set up to collect data and store it into a database on regular intervals. The application is designed to basically stay open all the time, and the screen displays what is most recently added into the database (by using ajax to check the database and refresh the page when there is something new). I also need to create a printout whenever something is added into the database as well. I currently have a print button, which forces the print dialogue box to come up and uses a different style sheet for a "print view" but the user is still required to press the print button, and then press print in the dialogue that comes up. Is there a way to fully automate the process to where the site will print the page to the default printer and bypass the print button and the dialogue screen that comes up?
Edit: I know I can do window.print(); to make the print dialog come up... I was asking if I can actually make a page come out of the printer with no human input. And based on the posts, it seems like it can't be done with just the web browser.
You could write a separate application that has a web-browser control, and have it do the printing for you. There's no way to do it in a regular browser, though --- think of the implications of that.
这篇关于如何强制网站打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!