Driver is undefined while calling `getPrinter`
See original GitHub issueGetting following error when I try to print a page
"TypeError: Cannot read property 'getPrinter' of undefined"
The error happens when executing
/lib/interfaces/printer.js:31
if (this.driver.getPrinter(this.getPrinterName())) { ...
Because it doesn’t meet the condition in the constructor to set driver.
constructor(printerName, moduleName) {
super();
this.name = printerName;
if (moduleName && typeof moduleName === "object") {
this.driver = moduleName;
}
I wonder what is supposed to pass as the second argument here and why it may be undefined?
/lib/interfaces/index.js:17
} else if (printer) {
const Printer = require('./printer');
return new Printer(printer[1], printer[2]);
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Webdriver: Undefined name 'driver' - python - Stack Overflow
When testing if browser is already opened, there is a message in Spyder's editor: undefined name 'driver'. How to change the code to...
Read more >Win32 API GetPrinter function help - Page 2 - NI Community
Solved: I am using the WInspool.drv to determine printer status. Using that DLL, I am trying to execute the GetPrinter function. When I ......
Read more >WINPRINT-GET-PRINTER-INFO-EX - Micro Focus
WINPRINT-CURR-COLLATE, Determines if the collating feature of the currently selected printer is turned on or off. ; WINPRINT-CURR-PAPERSIZE, Returns the current ...
Read more >GetPrinter function (Winspool.h) - Win32 apps | Microsoft Learn
The GetPrinter function retrieves information about a specified printer. ... When this happens, the printer is unusable until the driver is ...
Read more >Solved: get printer out of mfg mode - Page 6 - HP Community
When I switched on this evening some 7 or 8 updated drivers automatically ... this and maybe I have to call HP UK...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Klemen1337 Yes, I realized, thank you.
@ertankara the correct way is:
@Klemen1337
Using the code below in an Electron project.
By the way this is of course in an async function, I didn’t include function signature.