How to print from web client without seeing a print dialog box
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to print from web client without seeing a print dialog box
I'm in the process of rewriting a kiosk application. It was originally written in C#.Net as a Windows app. We want make it web based so it can be available to people with laptops, iPhones, iPads, etc. in addition to the dedicated kiosks.
The problem is that printer output is necessary, and it seems that for security reasons, browsers do not allow direct printing. I need some help to at least understand the kinds of approaches that would work.
Here are my assumptions and requirements:
The server can be platform specific, and is capable of generating the information to be printed (HTML, JSON, XML, PDF, Whatever).
All client software must be cross-platform (Linux, Windows, Mac, PDA).
All client software must be cross-browser (OK to limit to HTML5).
Client software is preferred to be open-source.
It's ok to assume printing on a default printer.
Printing must be automatic, with no printer dialog allowed.
I've spent about 10 hours so far researching possible solutions. I have come up with a couple of possibilities, but there are certain parts I don't know how to do yet.
Rather than lengthen this post, I'd like to invite ideas first. Someone may come up with something better than what I have thought of, that may get lost if the conversation gets started in a specific direction. I'll post my concepts in a day or two if no better ideas show up first.
I would suggest doing the printing via a plugin that you would write using a technology with printing support. Java (signed applet) or Silverlight would do it.
Can a plug-in be created that would work in all browsers? (See 3rd bullet point in original post) Or would I have to write one for each potential browser?
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
Quote:
Originally Posted by dickgregory
Can a plug-in be created that would work in all browsers? (See 3rd bullet point in original post) Or would I have to write one for each potential browser?
Thanks for your reply.
yes and no, browsers differ in how they handle plug-ins and each browser has a different API, so while you don't have to write a 'different' plug-in for each browser you would have to create a 'port' of that plug-in for each browser that is to say re-write the parts that actually interact with the browser and perhaps the operating system, however the main logic most likely could remain the same.
You would definitely not have to write a different plugin for each browser. PDAs might be a problem, but if your plugin is in Java then none of the other platforms you listed would be.
Cross-browser compatibility is one of the reasons that Java applets were invented in the first place.
Quote:
each browser has a different API, so while you don't have to write a 'different' plug-in for each browser you would have to create a 'port' of that plug-in for each browser that is to say re-write the parts that actually interact with the browser and perhaps the operating system
Each browser does not have a different API. Both Silverlight applications (which are plugins) and Java applets (which are plugins) have access to the DOMs of the webpages they are embedded in. DOM representations are standard. (Which is not to say all browsers follow standards and that no testing is necessary, of course).
The only interacting you'll do with the operating system is print. You will not have to rewrite that for each platform.
If you're talking about differences beyond these then I need an example.
Thanks. This gives me something to digest over the weekend. I'm starting to like this suggestion, even through I have no idea yet how to write a plug-in.
Would the plugin need to be installed on each client machine?
Any server-initiated access to a printer that happens without human intervention would be seen by me as a huge security vulnerability. If you do get that working, please tell us all so we can see to it that the browsers you use to do that get fixed. Imagine what fun net-vandals would have using all of your printer paper/toner/ink without your approval.
--- rod.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
um no, Plug-ins are NOT loaded from the server or embedded in the html, the content handled by the plugin IS, but the plugin itself is on the client and is operating system/browser specific.
in linux, plugins (such as the flash plugin for instance) have a .so extension and are ELF binaries, in windows they are probably dll files. they are at the very least, operating system specific, but then again there are also browser add-ons such as firebug which are browser sepecific.
Plug-ins are NOT loaded from the server or embedded in the html, the content handled by the plugin IS
True. What I obviously meant was to recommend writing "content" that would be handled by the plugin. For example, a Java applet. Which would be handled by the JRE plugin.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.