Skip to content

Commit

Permalink
docs: update webContents.printToPDF() example for promisified API (#2…
Browse files Browse the repository at this point in the history
…1550)

References: #16795 #17907
  • Loading branch information
trop[bot] authored and zcbenz committed Dec 18, 2019
1 parent 577d048 commit 2dc4297
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/api/web-contents.md
Expand Up @@ -1323,12 +1323,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)
})
})
```
Expand Down

0 comments on commit 2dc4297

Please sign in to comment.