You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linux: webContents.print() returns "Invalid printer settings" in Electron 43, works in Electron 42 #52266
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
43.0.0
What operating system(s) are you using?
Ubuntu
Operating System Version
Ubuntu 24.06 (x11)
What arch are you using?
x64
Last Known Working Electron version
42.6.0
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
win.webContents.print with a non empty options object (for example, {silent: true, deviceName: "MyPrinter"}) is supposed to print the content seamlessly.
Actual Behavior
win.webContents.print with an empty options ({}) object, opens the print dialog alright but when I put options like silent or deviceName the function returns with an error saying Invalid printer settings.
Would you be able to download Electron Fiddle, use it to create a small sample app that allows maintainers to reproduce this issue, and upload it as a GitHub gist from Fiddle?
Hello @8lurry. Thanks for reporting this and helping to make Electron better!
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
Now adding the
blocked/need-reproNeeds a test case to reproduce the bug
label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
webContents.print(opts) fails with "Invalid printer settings" for any non-empty opts. print({}) works. Not Linux specific, we see it on Windows, macOS and Linux. Broken in 43.0.0 through 43.1.1 and on main as of 44.0.0-alpha.3. 42.x is fine.
Cause: Chromium moved UpdatePrintSettings() out of PrintViewManagerBase into the preview-only PrintViewManager. PrintViewManagerElectron now overrides it and rejects every request:
In 42.x there is no override, so the working base class implementation handled it. Any print call that carries settings now fails before the system dialog opens.
Minimal repro:
const{ app, BrowserWindow }=require('electron')app.whenReady().then(()=>{constwin=newBrowserWindow()win.loadURL('data:text/html,<h1>print test</h1>')win.webContents.once('did-finish-load',()=>{win.webContents.print({printBackground: true},(ok,err)=>{console.log(ok,err)// false 'Invalid printer settings' on 43, dialog opens on 42})})})
Our workaround is to retry with print({}) when that error comes back, but then pageSize, scaleFactor and margins are all ignored. We have reverted to 42.7.0 for now. Happy to test a fix.
Activity
nikwen commentedon Jul 6, 2026
Thanks for reporting!
Would you be able to download Electron Fiddle, use it to create a small sample app that allows maintainers to reproduce this issue, and upload it as a GitHub gist from Fiddle?
electron-issue-triage commentedon Jul 6, 2026
Hello @8lurry. Thanks for reporting this and helping to make Electron better!
Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.
Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.
Now adding the blocked/need-reproNeeds a test case to reproduce the bug
label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
davidjgraph commentedon Jul 15, 2026
Root cause and repro from draw.io desktop, where all printing broke after moving to 43 (jgraph/drawio-desktop#2476, jgraph/drawio-desktop#2484).
webContents.print(opts) fails with "Invalid printer settings" for any non-empty opts. print({}) works. Not Linux specific, we see it on Windows, macOS and Linux. Broken in 43.0.0 through 43.1.1 and on main as of 44.0.0-alpha.3. 42.x is fine.
Cause: Chromium moved UpdatePrintSettings() out of PrintViewManagerBase into the preview-only PrintViewManager. PrintViewManagerElectron now overrides it and rejects every request:
https://github.com/electron/electron/blob/v43.1.1/shell/browser/printing/print_view_manager_electron.cc#L119-L123
In 42.x there is no override, so the working base class implementation handled it. Any print call that carries settings now fails before the system dialog opens.
Minimal repro:
Our workaround is to retry with print({}) when that error comes back, but then pageSize, scaleFactor and margins are all ignored. We have reverted to 42.7.0 for now. Happy to test a fix.
Reverts to Electron 42 until print settings work in Electron 43 [#2476]