admin管理员组文章数量:1415645
We all know that it's impossible to do native print in a browser that bypasses the browser's print dialog, however, we have the need to do a direct print, ideally where we could also select a particular printer, and other settings programmatically.
I know that ActiveX plug-ins exist that do this, however, we all know that ActiveX plug-ins only work in IE. Is there an existing plug-in, either in Flash or Silverlight that allows us to programmatically set printer properties and then direct print without opening the browser's native dialog?
A Java solution would be okay too. But clearly, it's not as desirable due to the installed footprint and ease of installation.
We all know that it's impossible to do native print in a browser that bypasses the browser's print dialog, however, we have the need to do a direct print, ideally where we could also select a particular printer, and other settings programmatically.
I know that ActiveX plug-ins exist that do this, however, we all know that ActiveX plug-ins only work in IE. Is there an existing plug-in, either in Flash or Silverlight that allows us to programmatically set printer properties and then direct print without opening the browser's native dialog?
A Java solution would be okay too. But clearly, it's not as desirable due to the installed footprint and ease of installation.
Share Improve this question edited Jul 19, 2011 at 19:54 asnyder asked Jul 13, 2011 at 15:49 asnyderasnyder 7118 silver badges17 bronze badges 5- 1 To be clear, are you attempting to bypass the browser's rendering engine and use your own in order to print the web page? – Kevin Stricker Commented Jul 16, 2011 at 5:17
- You can't do it with Flash, printing from Flash will always show a dialog. – Lars Blåsjö Commented Jul 17, 2011 at 18:57
- @lars fair enough, any non-browser exclusive solution would be fine. For example, a Java solution would be fine, but clearly not as desirable as a flash based solution due to installed footprint. – asnyder Commented Jul 19, 2011 at 19:52
- @mootinator We don't need to bypass the browser's rendering engine, but it is usually bypassed in order to do these solutions. All we need to do is direct print to a printer, for example, if you were to create a web-based POS, you wouldn't want a print dialog to print each receipt, or to select the appropriate printer, dimensions, etc. – asnyder Commented Jul 19, 2011 at 19:54
- I had this problem at a client - in the end we set up a web service that we streamed the document to and it then printed the document. Google Cloud print sort of works along thiese lines as well - code.google./apis/cloudprint/docs/overview.html – James Westgate Commented Jul 21, 2011 at 10:33
4 Answers
Reset to default 1Can Adobe AIR be a partial solution? I said partial because you first have to convince/tell people to download your printer AIR app that can basically invoked from browser which is in your case a print mand.
AIR has nativeprocess capability so you can either develop your own executables or use any other mand line print tools. This might be a good start.
We are also working on a similar problem. Our current working solution is to embed a java applet with permissions to talk to the local file system. It's still kinda hacky, but our current system has the embedded applet writing mands to a file, this file is being watched by a background "server" that has already claimed the desired printer and will send print mands directly to it based on the changes made to the file by the embedded applet... Spaghetti kinda solution, but we have it working 100% without the native system print dialog.
This "server" could be modified to claim multiple printers and print to a specific one base on other mands written to the file.
We also have a similar requirement. We tend to take the "use a Java Applet" approach for most problems involving things that a browser can't do on it's own. It's not always the best approach, but it's consistent and it can do everything that a stand-alone application can do.
If you want to print directly to the printer without opening a dialog, use the Java 2D Printing API. This allows you to design exactly what you want to print and send it right to the printer. Also, a java applet can municate back and forth with the browser using Javascript and possibly other technologies.
One easy solution if the printers and the web-servers are on the same network is to have the web-server directly print to network attached printers. No user browser involvement at all.
If not then you can use a service like PrintNode (https://www.printnode.). They take most of the plexity out of the problem but do require regular feeding with $ if your print usage is above their free tier.
I also considered Google CloudPrint but that fails from a web-server side because the web-server can't perform or redirect the login to the user.
本文标签: javascriptWeb Direct Print PluginStack Overflow
版权声明:本文标题:javascript - Web Direct Print Plug-in - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745242630a2649412.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论