Web Direct Print Plug-in
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.
Can 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 command.
AIR has nativeprocess capability so you can either develop your own executables or use any other command 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 commands to a file, this file is being watched by a background "server" that has already claimed the desired printer and will send print commands 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 commands 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 communicate 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.com). They take most of the complexity 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.
精彩评论