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

refactor: printToPDF should be headless #33654

Merged
merged 30 commits into from May 31, 2022
Merged

refactor: printToPDF should be headless #33654

merged 30 commits into from May 31, 2022

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Apr 7, 2022

Description of Change

BREAKING CHANGE

Closes #24947.
Closes #30753.
Closes #27605.
Closes #29324.

This PR refactors our printToPDF implementation to match that of Chromium's headless implementation, seen here. Per https://bugs.chromium.org/p/chromium/issues/detail?id=1101596, we'd hit the limit with our previous approach, since with out of process iframes enabled we were unable to properly composite subframes. This removes that hacked-together implementation in favor of headless'.

Checklist

Release Notes

Notes: Refactored webContents.printToPDF to align with the Chrome Devtools implementation.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Apr 7, 2022
@codebytere codebytere force-pushed the print-to-pdf-wip branch 2 times, most recently from 0239b82 to b84824b Compare April 8, 2022 14:19
@codebytere codebytere changed the title wip: refactor printToPDF to use headless where appropriate refactor: printToPDF to use headless where appropriate Apr 8, 2022
@codebytere codebytere added the semver/major incompatible API changes label Apr 11, 2022
@codebytere codebytere force-pushed the print-to-pdf-wip branch 2 times, most recently from 1b29ac3 to 9bdd930 Compare April 11, 2022 11:11
@itsananderson
Copy link
Contributor

API LGTM

Copy link
Contributor

@itsananderson itsananderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. I forgot how Github's review workflow works and didn't submit my comment.

docs/api/web-contents.md Outdated Show resolved Hide resolved
@codebytere codebytere changed the title refactor: printToPDF to use headless where appropriate refactor: printToPDF should be headless Apr 11, 2022
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Apr 14, 2022
@pushkin-
Copy link

@codebytere By the way, I'm seeing a similar issue when using the print method instead of printToPDF on a window that's loading a PDF. Will that also be fixed by this PR, or should I create a new issue?

@codebytere
Copy link
Member Author

@pushkin- that's a totally different problem & there are already open issues for it :)

@codebytere codebytere marked this pull request as ready for review May 9, 2022 12:57
@codebytere codebytere requested review from a team as code owners May 9, 2022 12:57
@pushkin-
Copy link

pushkin- commented May 9, 2022

@pushkin- that's a totally different problem & there are already open issues for it :)

Cool, I found this one. If that's the one you're talking about, can the "blocked" label be removed since there is a repro gist now? And can the version tag be updated? Thank you @codebytere

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label May 12, 2022
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full review forthcoming; just sending this one suggestion out for rn

docs/api/web-contents.md Outdated Show resolved Hide resolved
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label May 16, 2022
Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM although if possible, backwards compatiability discussed here would be nice-to-have

Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent some time reviewing this yesterday on both Mac and Windows, using these two gists for testing (one, two). I didn't hit any errors, and the code looks good to me. Happy to do some smoke testing on Linux, but this looks good to me 👍

@codebytere codebytere requested a review from zcbenz May 30, 2022 08:37
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@codebytere codebytere merged commit 93b39b9 into main May 31, 2022
@codebytere codebytere deleted the print-to-pdf-wip branch May 31, 2022 06:21
@release-clerk
Copy link

release-clerk bot commented May 31, 2022

Release Notes Persisted

Refactored webContents.printToPDF to align with the Chrome Devtools implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants