docs: update webContents.printToPDF() example for promisified API (#21549)

This commit is contained in:
trop[bot]
2019-12-16 21:29:03 -08:00
committed by Shelley Vohr
parent 4a66bed930
commit 8c15619905

View File

@@ -1340,12 +1340,13 @@ win.loadURL('http://github.com')
win.webContents.on('did-finish-load', () => {
// Use default printing options
win.webContents.printToPDF({}, (error, data) => {
if (error) throw error
win.webContents.printToPDF({}).then(data => {
fs.writeFile('/tmp/print.pdf', data, (error) => {
if (error) throw error
console.log('Write PDF successfully.')
})
}).catch(error => {
console.log(error)
})
})
```