Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print issue on Electron from v7 - Print only works once (window.print()) #21397

Closed
3 tasks done
ChenAlon opened this issue Dec 5, 2019 · 15 comments · Fixed by #21893
Closed
3 tasks done

Print issue on Electron from v7 - Print only works once (window.print()) #21397

ChenAlon opened this issue Dec 5, 2019 · 15 comments · Fixed by #21893

Comments

@ChenAlon
Copy link

ChenAlon commented Dec 5, 2019

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • 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

Link to video

@codebytere
Copy link
Member

@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?

@ChenAlon
Copy link
Author

ChenAlon commented Dec 8, 2019

@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.

@codebytere codebytere self-assigned this Dec 9, 2019
@codebytere
Copy link
Member

I'll do my best to check into this!

@sofianguy sofianguy added this to Unsorted Issues in 7.2.x Dec 9, 2019
@sofianguy sofianguy added this to Unsorted Issues in 8.2.x Dec 9, 2019
@sofianguy sofianguy moved this from Unsorted Issues to Does Not Block Stable in 8.2.x Jan 15, 2020
@daveajones
Copy link

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 #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.

@codebytere
Copy link
Member

codebytere commented Jan 24, 2020

@daveajones i'll be working on this soon.

@barbalex
Copy link

I can confirm this in v8.0.0-beta.7

@codebytere
Copy link
Member

codebytere commented Jan 28, 2020

@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.

@barbalex
Copy link

@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!

@codebytere
Copy link
Member

@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

@sofianguy sofianguy moved this from Fixed for Next Release to Fixed in 8.0.0-beta.8 in 8.2.x Jan 29, 2020
@sofianguy sofianguy moved this from Unsorted Issues to Fixed for Next Release in 7.2.x Feb 15, 2020
@sofianguy sofianguy moved this from Fixed for Next Release to Fixed in 7.1.11 in 7.2.x Feb 15, 2020
@dipunj
Copy link

dipunj commented Sep 11, 2020

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:

  1. button onclick="window.print()"
  2. 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.

@umeduardo
Copy link

Downgrade to version 1.8. Works to me.

@codebytere
Copy link
Member

codebytere commented Sep 18, 2020

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.

@dipunj
Copy link

dipunj commented Sep 18, 2020

@codebytere thank you for that gist. I will compare your gist with my code and update you here.

@codebytere
Copy link
Member

@dipunj #25530 will handle the issue! Should be fixed in next version of 10.

@exander77
Copy link

I still have problems on version 13 and 14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
7.2.x
Fixed in 7.1.11
8.2.x
Fixed in 8.0.0-beta.8
Development

Successfully merging a pull request may close this issue.

8 participants