add print capability

This commit is contained in:
Niko
2019-12-15 09:56:14 +01:00
parent 68288d9d73
commit a3c452eea5
6 changed files with 213 additions and 13 deletions

View File

@@ -30,6 +30,16 @@ export = (socket: SocketIO.Socket) => {
}
});
socket.on('webContents-getPrinters', async (id) => {
const printers = await getWindowById(id).webContents.getPrinters();
electronSocket.emit('webContents-getPrinters-completed', printers);
});
socket.on('webContents-print', async (id, options = {}) => {
await getWindowById(id).webContents.print(options);
electronSocket.emit('webContents-print-completed', true);
});
socket.on('webContents-printToPDF', async (id, options = {}, path) => {
const buffer = await getWindowById(id).webContents.printToPDF(options);