Skip to content

fix: webContents.print() ignoring mediaSize when silent - #50855

Merged
codebytere merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-fix-webcontents-print-ignoring-mediasize-when-silent-1775755016171
Apr 10, 2026
Merged

fix: webContents.print() ignoring mediaSize when silent#50855
codebytere merged 1 commit into
42-x-yfrom
trop/42-x-y-bp-fix-webcontents-print-ignoring-mediasize-when-silent-1775755016171

Conversation

@trop

@trop trop Bot commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #50808

See that PR for details.

Notes: Fixed an issue where webContents.print() would ignore pageSize / mediaSize when silent was true.

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>
@trop
trop Bot requested review from a team and codebytere April 9, 2026 17:17
@trop trop Bot added 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Apr 9, 2026
@codebytere
codebytere merged commit eb19030 into 42-x-y Apr 10, 2026
215 of 228 checks passed
@codebytere
codebytere deleted the trop/42-x-y-bp-fix-webcontents-print-ignoring-mediasize-when-silent-1775755016171 branch April 10, 2026 10:09
@release-clerk

release-clerk Bot commented Apr 10, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed an issue where webContents.print() would ignore pageSize / mediaSize when silent was true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants