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

327
Views
¿Cómo evito que HTML2PDF descargue automáticamente el pdf?

Tengo un método HTML2PDF en mi código JavaScript. El código funciona muy bien, por un lado, ya que puedo abrir el pdf renderizado en una nueva pestaña de blob y abrir la ventana de impresión. Sin embargo, mientras hago eso, el pdf también se descarga automáticamente. Deseo evitar que el método descargue el archivo .pdf y solo abra la ventana de impresión en la nueva pestaña. El siguiente código es lo que tengo. ¡Cualquier ayuda sería muy apreciada!

 html2pdf(body, { filename: 'test.pdf', jsPDF: { orientation: 'portrait', } }) .from('element-to-print') .get('pdf') .then(function (pdfObj) { pdfObj.autoPrint(); window.open(pdfObj.output('bloburl'), 'F'); });
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Prueba este código:

 html2pdf() // move your config in the .set({...}) function below .set({ filename: 'test.pdf', jsPDF: { orientation: 'portrait', } }) .from('element-to-print') .outputPdf() // add this to replace implicite .save() method, which triggers file download .get('pdf') .then(function (pdfObj) { pdfObj.autoPrint(); window.open(pdfObj.output("bloburl"), "F") });
about 4 years ago · Santiago Trujillo Report
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!