-
Notifications
You must be signed in to change notification settings - Fork 16.5k
Description
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 a bug report that matches the one I want to file, without success.
Electron Version
v25.3.0
What operating system are you using?
Windows
Operating System Version
Windows 10 version 21H2
What arch are you using?
x64
Last Known Working Electron version
v24.6.3
Expected Behavior
We specify a horizontal and vertical DPI of 0 to work around an issue with printing where providing unspecified DPI values seems to result in the lowest available DPI being used, whereas providing unsupported DPI values seems to result in the default DPI being used (#18917 (comment)). In Electron v24, calling webContents.print({ dpi: { horizontal: 0, vertical: 0 } })
doesn't crash and causes the default DPI to be used, as expected.
Actual Behavior
In Electron v25, the webContents.print()
call fails if given a DPI with horizontal and vertical sizes of 0. When running from Electron Fiddle, the following message is logged to the console:
[49556:0714/153022.964:ERROR:device_event_log_impl.cc(222)] [15:30:22.964] Printer: print_view_manager_base.cc:352 Printer settings invalid for Microsoft Print to PDF (destination type kLocal): content size is empty; page size is empty; printable area is empty; invalid DPI dimensions
Testcase Gist URL
https://gist.github.com/mgalla10/606893c8c876ff1396a1d87bdc5c0880
Additional Information
No response