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

166
Views
Javascript-Electron No se puede crear el pdf del navegador actual. Tiene un problema con el método printToPDF

Con los fragmentos de código a continuación, estoy tratando de crear un archivo pdf que muestre el contenido del navegador de electrones.

Veo los primeros tres registros de la consola, pero no puedo ver el que está justo después del método printToPDF .
Parece que se atascó al alcanzar el método printToPDF y no tengo mensajes de error para compartir.
¿Alguna idea de por qué no puedo ir más allá?

Principal.js:

 "use strict"; const electron = require('electron') const fs = require('fs') const app = electron.app const BrowserWindow = electron.BrowserWindow const ipc = electron.ipcMain const path = require('path') const url = require('url') const shell = electron.shell ipc.on("print-to-pdf", function (event) { console.log("reached to ipc"); const pdfPath = "C:\\Temp\\print.pdf"; console.log("pdfPath:" + pdfPath); const win = BrowserWindow.fromWebContents(event.sender); console.log("created const win"); win.webContents.printToPDF({printBackground: true, landscape: true},function (error, data) { console.log("reached to printToPDF method:"); if (error) throw error; fs.writeFile(pdfPath, data, function (error) { if (error) { throw error; } shell.openExternal("file://" + pdfPath); event.sender.send("wrote-pdf", pdfPath); }); }); });
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!