fix: webContents.print() ignoring mediaSize when silent - #50855
Merged
codebytere merged 1 commit intoApr 10, 2026
Merged
Conversation
PR #49523 moved the default media size fallback into OnGetDeviceNameToUse, but the new code unconditionally writes kSettingMediaSize — clobbering any mediaSize the caller had already set in WebContents::Print() from options.mediaSize / pageSize. As a result, silent prints with an explicit pageSize (e.g. "Letter") fell back to A4 with tiny content. Only populate the default/printer media size when the caller hasn't already supplied one, preserving the precedence: 1. user-supplied mediaSize / pageSize 2. printer default (when usePrinterDefaultPageSize is true) 3. A4 fallback Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
4 tasks
dsanders11
approved these changes
Apr 10, 2026
codebytere
approved these changes
Apr 10, 2026
codebytere
deleted the
trop/42-x-y-bp-fix-webcontents-print-ignoring-mediasize-when-silent-1775755016171
branch
April 10, 2026 10:09
|
Release Notes Persisted
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #50808
See that PR for details.
Notes: Fixed an issue where webContents.print() would ignore pageSize / mediaSize when silent was true.