D
Deleted member 2829
Guest
I am creating and printing a window in JavaScript with this code
which works fine. The window comes up with the Chrome print screen on top of it. Both buttons Print and Cancel do their job and then the window disappears as expected. So far so good !! But as always there is a snag.
The Chrome print screen also has an option "Print using system dialog" which I want to use if I want to print with different printer settings. When I click that option, I briefly see the Windows native print dialog pop up, and then the whole stack (my created window, the Chrome print window, and the Windows print dialog) is closed. I don't get a chance to print.
I tried fixing this by adding an
Any ideas would be much appreciated.
JavaScript:
var w = window.open("about:blank", "Print", "width=800,height=800");
w.document.write(html);
w.print();
w.close();
which works fine. The window comes up with the Chrome print screen on top of it. Both buttons Print and Cancel do their job and then the window disappears as expected. So far so good !! But as always there is a snag.
The Chrome print screen also has an option "Print using system dialog" which I want to use if I want to print with different printer settings. When I click that option, I briefly see the Windows native print dialog pop up, and then the whole stack (my created window, the Chrome print window, and the Windows print dialog) is closed. I don't get a chance to print.
I tried fixing this by adding an
onafterprint
even handler to the body of the printed window, and in that handler have the window close itself. But that runs into the same problem - the event handler fires when I click "Print using system dialog". It's as if Chrome is saying "Ok, Windows will handle it from here, I'm done, bye !". Perhaps that makes sense from Chrome's point of view, but it's quite a conundrum as I can't close my window before the Windows print dialog starts and completes the printing, and I have no way of knowing when that will be done.Any ideas would be much appreciated.