I have a simple electronJS application which interacts with my laravel backend server. The backend server produces a PDF to a certain size such as 86mm x 54mm and streams the PDF to my electronJS application for it to print silently to the default printer. Currently in my Electron application I get the popup to save the streamed PDF to the machine rather than it print silently.
My electronJs code handling the print method.
const printWindow = new BrowserWindow({ show: false });
printWindow.loadURL('http://localhost:8000/pass');
printWindow.webContents.on('did-finish-load', () => {
printWindow.print({ silent: true, deviceName: '' });
});
My laravel code for returning the PDF after hitting a route.
Route::get('/pdf', function () {
$pdf = \PDF::loadView('pdf.layout');
$pdf->setPaper([0, 0, 175.748, 243.78], 'landscape');
return $pdf->stream('pdf.pdf');
});
I expected the pdf to print to the default printer however this produces a popup to download the PDF file?