electron Print issue on Electron from v7 - Print only works once (window.print()) - Cplusplus
Preflight Checklist
- [x] I have read the Contributing Guidelines for this project.
- [x] I agree to follow the Code of Conduct that this project adheres to.
- [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version:
Not working since v7.00.
Tested on:- v8.0.0-beta.4
- v7.0.0
- Operating System:
- macOS 10.14.5
- Last Known Working Electron version:
- v6.1.5
Expected Behavior
That the window.print()
will work, even after the first time.
Like in versions prior to v7.0.0
Actual Behavior
The window.print()
function only works one time.
After the first time, it's not working.
The print dialog appears but the actual printing is not.
To Reproduce
Run window.print()
twice.
On the Electron Fiddle app example, click on the Print Page and print.
After that first time, click on the Print Page button again and try to print again.
Link to the Gist
Screenshots
9 Answer:
@ChenAlon Running that exact gist on v8.0.0-beta.4
on macOS 10.14.5 works for me without incident as expected - are you sure that it's broken there?
@codebytere, yes. Did you see the video?
I just tried the same on a different machine, macOS 10.14.6 and I still see the same issue (v8.0.0-beta-4
).
Here are some logs from the Console app logs:
This happen after I click the print button:
default 09:20:26.517943 +0200 Electron failed to get application bundle
default 09:20:26.517986 +0200 Electron Error in AHRegisterHelpBookWithURL: -50
default 09:20:26.546347 +0200 Electron failed to get application bundle
default 09:20:26.546375 +0200 Electron Error in AHRegisterHelpBookWithURL: -50
default 09:20:26.546978 +0200 Electron failed to get application bundle
default 09:20:26.547006 +0200 Electron Error in AHRegisterHelpBookWithURL: -50
default 09:20:26.551532 +0200 Electron failed to get application bundle
default 09:20:26.551558 +0200 Electron Error in AHRegisterHelpBookWithURL: -50
And this after I click Print on the Print dialog (Save to PDF):
error 09:20:44.808648 +0200 Electron errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
default 09:20:44.808700 +0200 Electron OSErr AERemoveEventHandler(AEEventClass, AEEventID, AEEventHandlerUPP, Boolean)(ficl,askM handler=0x7fff4f4e929b isSys=NO) err=0/noErr
default 09:20:44.902731 +0200 Electron Adding presenter FB6315CE-2576-4C18-9CD3-6FD62B32F914 for URL: <private>
default 09:20:49.907229 +0200 Electron Removing presenter FB6315CE-2576-4C18-9CD3-6FD62B32F914
default 09:20:51.715695 +0200 Electron LSExceptions shared instance invalidated for timeout.
I think this should block a stable release until fixed. Only being able to print once seems like a pretty severe issue. I know it's a show-stopper for us. We tried resolving by rolling back to v6.x, but then got hit with https://github.com/electron/electron/issues/19768 . In our case (site wrapper) the workarounds don't help, so we're pretty much stuck. IMO getting back to print stability in v8 would finally take this off the table.
@barbalex yes, as you can see above i PR'd a fix into this yesterday. That means it will be fixed in the next released versions of 6, 7, and 8.
@codebytere sorry, that printing works only once.
And yes, obviously your merge will only be in the next release so sorry for bugging.
And THANKS A LOT for solving the issue!
@barbalex of course! printing is an ongoing struggle so apologies for the occasional failures, but it's something i care about to large extent so i'm always happy to tackle printing bugs when they come up :D
Hi,
I am encountering the exact same problem in version 10.1.1 (latest version currently) on mac. Can anyone else please confirm if the issue has been reintroduced?
Btw, I have tried to approaches to printing:
- button onclick="window.print()"
- using ipc, window.webContents.print()
PS: I am new to electron. Thank you!
Update: I downgraded to 7.1.11 and it seems to be working. Looks like it has been reintroduced.
I just tested with https://gist.github.com/0f0e776b138452d6815ef4efc16aa0d1 and had no issues running window.print multiple times on v10 with macOS. Additionally you absolutely do not want to use a version as old as 1.8 for any reason.
Edit: found an issue i think - it looks specific to 10 though as i cannot reproduce it on 11 and master. I'll try to suss it out.
@codebytere thank you for that gist. I will compare your gist with my code and update you here.
Read next
- lotus Move bootstrap nodes to configuration Go
- orleans Is it possible to use the Azure Gateway type without Azure Cloud Services / AzureSilo ? C#
- M2M 100 for low resource languages - fairseq
- polkadot Thread 'tokio-runtime-worker' panicked at 'Storage root must match that calculated.', /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/macros.rs:13 - Rust
- drake Support clang-4.0 in CMake (+ MATLAB) builds C++
- shaka-player Can't close playback window in demo while casting - JavaScript
- nushell Have `ps` show the full command name - Rust
- tokio Change `max_threads` to `max_blocking_threads` - Rust