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

335
Views
Laravel JSPDF output () no funciona pero save () funciona

Tengo un proyecto Laravel que usa JSPDF para generar un archivo PDF desde un DIV y descargarlo

Cuando lo probé en iPhone Safari descubrí que no funciona

Busqué el motivo y descubrí que puedo usar output('dataurl') en su lugar

Cuando reemplacé save() con output(), ahora no funciona en todas las plataformas

El código:

 $('#print').click(async function (e) { e.preventDefault(); const pdf = new jsPDF('p', 'mm', 'a4'); const imgWidth = 208; const position = 0; let page1 = document.querySelector('#report-one'); let page2 = document.querySelector('#report-two'); const [imgPage1, imgPage2] = await Promise.all([html2canvas(page1), html2canvas(page2)]); // Process first image let imgHeight = imgPage1.height * imgWidth / imgPage1.width; let contentDataURL = imgPage1.toDataURL('image/jpeg'); pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight); pdf.addPage(); // Process second image imgHeight = imgPage2.height * imgWidth / imgPage2.width; contentDataURL = imgPage2.toDataURL('image/jpeg'); pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight); pdf.output('dataurl'); });
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!