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.
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.
Share Improve this question edited Feb 28, 2012 at 19:22 Lloyd Cotten asked Feb 27, 2012 at 18:18 Lloyd CottenLloyd Cotten 4,5565 gold badges25 silver badges21 bronze badges 5- Which version of Chrome does this issue happen? – Nick Beranek Commented Feb 27, 2012 at 18:24
- ... "anagrammatically" ? edit oh prob. a hyperactive spell-checker :-) – Pointy Commented Feb 27, 2012 at 18:32
- If Chrome misprints your documents, please file a bug: new.crbug. If you pot the ID here, I can put it in front of the right engineers. – Mike West Commented Feb 28, 2012 at 8:07
- @MikeWest: thanks for the ment. I will file a bug, but the particular web application this occurs on is proprietary. I will have to create a public test case to demonstrate. Thanks for the input, and suggestion, though. – Lloyd Cotten Commented Feb 28, 2012 at 19:21
-
Windows 10 Chromium 59.0.3071.115 (Official Build) is inconsistent when hooking
window.matchMedia
API to alter page content users see behind a normalwindow.print()
system print box. Theslick
slideshow widget doesn't print well. Workaround: run it'sunslick
, re-init after invokingwindow.print()
. Works in system print-respecting Firefox. Chrom*'s print preview lags while 'Loading preview ...' but it's not waiting reliably forwindow.matchMedia
code to run. Result: inconsistency! UX inconsistencies in gray areas b/w browsers, platforms are ball ache for users, devs, grrrrr – pd_au Commented Jan 11, 2018 at 2:44
2 Answers
Reset to default 2Print dialogs are not scriptable using JavaScript. They're proprietary parts of browsers themselves.
Hi i am facing the same issue... I even tried firing keyboard event ctrl+shift+P from my script in order to show system print dialog.
You can fire a keyboard event and that issue is successfully dispatched, however the value of keyCode that the browser receives is always 0 (instead of ASCII value of ‘P’)
There is a bug logged https://bugs.webkit/show_bug.cgi?id=16735 against webkit for the same… and here are some posts http://code.google./p/chromium/issues/detail?id=27048, http://code.google./p/chromium/issues/detail?id=52408 mentioning the same issue in Safari and Chrome…