mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Avoid Undefined Variable In printToPdf Example (#31464)
Co-authored-by: universalstrapping <90921972+universalstrapping@users.noreply.github.com>
This commit is contained in:
@@ -1479,8 +1479,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}`)
|
||||
|
||||
Reference in New Issue
Block a user