handle cancel in save pdf dialog

pull/432/head
Lex Neva 2019-04-18 09:33:53 -04:00
rodzic 67027f0704
commit 0a41ad6f71
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -44,7 +44,8 @@ app.on('window-all-closed', () => {
ipcMain.on('print', function (event, pageSize) {
mainWindow.webContents.printToPDF({"pageSize": pageSize}, function(error, data) {
dialog.showSaveDialog(mainWindow, {"defaultPath": "inkstitch.pdf"}, function(filename, bookmark) {
fs.writeFileSync(filename, data, 'utf-8');
if (typeof filename !== 'undefined')
fs.writeFileSync(filename, data, 'utf-8');
})
})
})