-
-
Save RohitSaroj/ca0341da6abe965d752bf3fafac7c494 to your computer and use it in GitHub Desktop.
webContents.getPrintersAsync() not returning printer list on Linux Mint Cinnamon 19.1
This file contains 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
/* | |
This code snippet gets the printer list and then returns default printer in the event response | |
This piece of code was working in electron version 13.2.2 but not in 24.8.8 for Linux Mint Cinnamon 19.1 | |
*/ | |
win.webContents.getPrintersAsync().then((printers) => { | |
const defaultPrinters = printers?.filter((p) => p.isDefault); | |
if (printers.length > 0) { | |
event.reply(EVENTS.PRINTER.RESPONSE, defaultPrinters[0]); | |
} | |
win.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment