After searching for a solution for printing using the javascript print(); command WITHOUT creating a print dialog box I finally found a solution. I couldn’t find any information online, so I thought I would put it here for the next guy.
We are creating an application using LINUX/MySQL/PHP/Apache. The application runs on a dedicated box and is used by customers. We have successfully removed all of the dialog boxes, but the print dialog box kept popping up every time the user hit our javascript window.print() button. This created a probelm of professionalism in the interface. After much searching, we discovered that the talented team at Mozilla.org has already solved this problem, but there were no instructions on how to make it work.
All you need to do, is set a preference up on the CLIENT BROWSER, you can’t do this through the web, you must have direct access to the local browser. If people could do this through the web, every porn popup in the world would come streaming through the printer.
Go to about:config (Type this in the address bar)
Right click on any preference and select “NEW” > “BOOLEAN” IMPORTANT: DO NOT SELECT STRING or NUMERIC as this will not work if you are an idiot (like me) and select “STRING”
type: print.always_print_silent
Hit OK
type: true
Restart the browser. This writes a line to the prefs.js file (on windows) (or the user.js file on Linux?) the next time you start the browser, any javascript print(); command will print directly to the printer using the currently configured print settings. The exact syntax is:
<a href=”#” OnClick=”window.print();”>PRINT THIS WINDOW</a>
I hope that this helps someone else, as we had much trouble tracking this down. The following are key words to help the next guy find this:
mozilla silent printing
silent print
always_print_silent
javascript print without dialog mozilla
print.always_print_silent
printing without dialog box
taken from mozila forums