Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print silently in Chrome

I need to be able to print silently in Chrome. In my ticket system no print dialog can appear, I just wont it to print on my javascript command.

I've done this before in Firefox but now I will change to Chrome as browser.

There is a ticket on this: https://code.google.com/p/chromium/issues/detail?id=31395#c4

Comment #4 says:

If --kiosk is specified and the preference printing/printer/default is specified, the print dialog will be skipped.

I have set kiosk mode but dont know where to change the preference printing/printer/default he is talking about? At least it does not exists in my version of Chrome (14.0.835.35 dev-m). But I have a default printer in windows.

like image 420
Johan Davidsson Avatar asked Aug 11 '11 10:08

Johan Davidsson


2 Answers

For silent printing, you must start Chrome with the --kiosk AND --kiosk-printing flags. This will cause Chrome to display but immediately close the print dialog upon the user attempting to print the page or javascript executing window.print().

Because the print dialog will no longer be available, the printing will automatically use the settings that were last selected in Chrome (or the system default).

like image 199
Aaron Cicali Avatar answered Sep 22 '22 17:09

Aaron Cicali


The issue you linked to isn't resolved - it is marked as "Available" meaning that it is waiting for some developer to work on it. "printing/printer/default" preference is merely a suggestion for how this feature should be implemented. Comment 4 is about merging a similar issue, not about the actual implementation.

like image 33
Wladimir Palant Avatar answered Sep 21 '22 17:09

Wladimir Palant