I just need to use electron js to build my desktop app, I use simple BrowserWindow to load my website in the application.
I added some functionality to reload the window when the connection issues so when the internet turn-on again the app will reload the page so it will not show "Page not found".
In my web page it received an orders and print it to receipt printer, I don't want the print dialog show out, is there any solution to print the receipt silently?
I know the way how to print it silent with the firefox but I need to use it now in my electron app.
my code:
There is the silent
option of BrowserWindow.webContents.print
:
Prints window’s web page. When
silent
is set totrue
, Electron will pick the system’s default printer ifdeviceName
is empty and the default settings for printing.Calling
window.print()
in web page is equivalent to callingwebContents.print({silent: false, printBackground: false, deviceName: ''})
.
let win = new BrowserWindow(params);
win.webContents.print({silent: true});