Browse Source

Avoid Undefined Variable In printToPdf Example (#31455)

universalstrapping 3 years ago
parent
commit
14736c5f30
1 changed files with 1 additions and 1 deletions
  1. 1 1
      docs/api/web-contents.md

+ 1 - 1
docs/api/web-contents.md

@@ -1485,8 +1485,8 @@ win.loadURL('http://github.com')
 
 win.webContents.on('did-finish-load', () => {
   // Use default printing options
+  const pdfPath = path.join(os.homedir(), 'Desktop', 'temp.pdf')
   win.webContents.printToPDF({}).then(data => {
-    const pdfPath = path.join(os.homedir(), 'Desktop', 'temp.pdf')
     fs.writeFile(pdfPath, data, (error) => {
       if (error) throw error
       console.log(`Wrote PDF successfully to ${pdfPath}`)