How can i print a page /html content to specific printer through electron?


#1

How can i print a page / HTML content to a specific printer through electron?

I know the page can be printed using win.webContents.print({silent:true}). But that’s printing through the default printer. I want it to be printed through the printer which i specify, by “printer name”.

Then i tried node-printer, which prints through the specified printer, but just as text. It’s not printing as in HTML page. It prints the text only. And the type available are just RAW & TEXT.

Then i tried to creating a PDF using mainWindow.webContents.printToPDF and tried to convert the PDF to RAW (also tried to convert PDF to EMF, but EMF not working in windows) using imagemagick and pdfium. But both not working at all.

My Configuration:
OS: Windows 7
Nodejs: 6.9.2
npm: 3.10.9
Electron: 1.4.12 / 1.4.13

Can you please suggest a solution for this? Any help will be appreciated