Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

197
Views
How to export pdf on clicking Button in electron.js?

Did anyone worked on electron.js pdf export? I need to export the file to pdf while clicking on button and i used ".webContents.printToPDF" but "'did-finish-load'" is not working for me.

electron version - 16 node version - 14

electron.ipcMain.on('exportPdf', (event, path) => {
  console.log("data-above000");
  // Use default printing options
  console.log("data-above");
  // const pdfPath = ph.join(__dirname, 'docs/new.pdf');
  mainWindow.webContents.printToPDF(options).then(data => {
    console.log("data", data);
    fs.writeFile(path, data, (error) => {
      if (error) throw error
      console.log(`Wrote PDF successfully to ${path}`)
    })
  }).catch(error => {
    console.log(`Failed to write PDF to ${path}: `, error)
  })
  console.log("data-below");
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!