Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use System Print Dialog in Chrome in JavaScript

We have an issue where Chrome's "Print Preview" does not print our pages correctly. If you use the "Use System Print Dialog link" (Ctrl+Shift+P), it prints our page fine (almost identically to Firefox).

We have a button on our page that calls window.print() to open the print dialog. However, in Chrome it opens to the "Print Preview" dialog which ends up not printing our page correctly.

Is there away with JavaScript to print directly to the "system print dialog" in Chrome?

P.S. I do know how the end user can disable the Print Preview in chrome://flags, but what I want to know is there anyway to prevent it from showing when I programmatically call window.print() (or similar) regardless of user settings.

like image 958
Lloyd Cotten Avatar asked Feb 27 '12 18:02

Lloyd Cotten


People also ask

How do I print from system dialog in Chrome?

Chrome System Print Dialog If you've already pressed the Ctrl+P keyboard shortcut, then look for the 'Print using system dialog' option at the very bottom of the left column. What is this? To jump directly to the system print dialog, you can use the Ctrl+Shift+P keyboard shortcut.

How do I set printer with system dialog as default?

The CTRL + SHIFT + P key combination brings up the system print dialog box, from which you can configure your default print settings and print out the page you are viewing.


1 Answers

Print dialogs are not scriptable using JavaScript. They're proprietary parts of browsers themselves.

like image 139
Diodeus - James MacFarlane Avatar answered Sep 23 '22 10:09

Diodeus - James MacFarlane