Skip to content

refactor: printToPDF should be headless - #33654

Merged
codebytere merged 30 commits into
mainfrom
print-to-pdf-wip
May 31, 2022
Merged

refactor: printToPDF should be headless#33654
codebytere merged 30 commits into
mainfrom
print-to-pdf-wip

Conversation

@codebytere

@codebytere codebytere commented Apr 7, 2022

Copy link
Copy Markdown
Member

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 recently 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
Copy Markdown
Member

API LGTM

@itsananderson itsananderson left a comment

Copy link
Copy Markdown
Member

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.

Comment thread docs/api/web-contents.md Outdated
@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 recently label Apr 14, 2022
@pushkin-

Copy link
Copy Markdown

@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
Copy Markdown
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-

pushkin- commented May 9, 2022

Copy link
Copy Markdown

@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 recently label May 12, 2022

@ckerr ckerr left a comment

Copy link
Copy Markdown
Member

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

Comment thread docs/api/web-contents.md
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label May 16, 2022

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

API LGTM

@ckerr ckerr left a comment

Copy link
Copy Markdown
Member

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

@codebytere
codebytere requested review from ckerr and jkleinsc May 24, 2022 10:43

@VerteDinde VerteDinde left a comment

Copy link
Copy Markdown
Member

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

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Contributor

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

release-clerk Bot commented May 31, 2022

Copy link
Copy Markdown

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