1

I am working on an internal Java web application for my company where I have full access to every machine that will be using the application and can configure as needed. Part of the requirements are to force print a dynamically generated HTML file with the push of a button in the web app to the printer that is configured as the default print (no print prompt). Another optional requirement I am working very hard to meet is that this is mostly browser and operating system independent.

What are my options to accomplish this? I know there is no way to default a force print automatically due to security restrictions. I've researched and played with some various options, including changing security settings in the various browsers, running a signed applet with a print server and local machine settings like registry updates in Windows machines.

Long story short is I know some sort of settings update(s) on the machine will have to be done to accomplish my goal but I am trying to find the least invasive solution with no user prompts that requires the least amount of settings updates as well.

Chad Cook
  • 619
  • 5
  • 15
  • 2
    "mostly browser and operating system independent" is a very hard goal to meet on doing anything. can you clarify which operating systems and browsers are you mainly targeting at? what can you assume about the environment? – eis Jan 24 '13 at 16:46
  • We are focusing on IE, Firefox, Chrome and Safari and operating systems will be Windows and Mac. Versions and backward compatibility are still up in the air. Part of the reason for Safari and Mac is we are investigating wireless printing options with iPads and other mobile devices. Can you be more specific about what assumpitions you're curious about? This is an internal company application so we have a lot of control over the machine setup and configuration but there are different types of equipment that we will be running this on, hence the desire to make it as flexible as possible. – Chad Cook Jan 24 '13 at 17:00

2 Answers2

1

Don't know what you're targeting for, but:

  • For IE, this vbscript should do the trick.
  • On Firefox, one should set print.always_print_silent and print.show_print_progress settings in about:config to true & false.
  • For Chrome, I think this can be achieved by using --kiosk --kiosk-printing startup arguments. It does make the whole app to work in Kiosk mode, though.
  • I'm not aware of Safari solutions.

If you could use PDF, there's an option called Silent Printing there (source: this manual) that could let you have silent printing across variety of browsers.

Also, "If it is just an internal application, then you can avoid printing from the browser, and send a printout directly from the server to the nearest printer to the user" as commented in this similar thread.

Community
  • 1
  • 1
eis
  • 51,991
  • 13
  • 150
  • 199
  • Excellent start. Are there similar options for Chrome and Safari? – Chad Cook Jan 24 '13 at 17:02
  • @ChadCook added what I know of – eis Jan 24 '13 at 17:30
  • I've tried the applet approach and it works, for the most part. I have been unable to get rid of the prompt to allow access to the printer though and this appears to be a common problem when searching for a solution on the web. I have also looked for ways to update the security settings in Java to allow the applet to always have access to the printer, but to no avail. Thanks for the Chrome possibility. – Chad Cook Jan 24 '13 at 17:55
  • Ok. As you probably know, at least [this guy claims](http://stackoverflow.com/questions/13419829/applet-printing-applet-discards-security-permission-windows7-java7) that at least for XP, it works for him. No experience about that myself. – eis Jan 24 '13 at 18:19
-1

One (not very elegant) solution is to call a webservice by clicking your button. This webservice would then start a browser on some server machine (e.g. with Selenium). The browser would open the page exactly the way you did it and then enter 'ctrl+p' and 'enter'. You can to make sure that the default printer is the one you need and that there are no further dialogues. I have once implemented such a solution for the PDFCreator (also a printer). There you could configure it in such a way that it does not ask any more questions.

Volokh
  • 380
  • 3
  • 16