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

121
Views
jsPDF inserta html desde la identificación especificada en una página pdf específica

Estoy creando un pdf usando jsPDF en angular.

el html

 <div id="myid">HTML GOES HERE</div>

crear PDF js:

 genPDF(){ html2canvas(document.getElementById('myid'), { allowTaint: true, useCORS: false, scale: 1, }).then((canvas) => { var img = canvas.toDataURL("image/png"); var imgWidth = 210; var pageHeight = 297; var imgHeight = canvas.height * imgWidth / canvas.width; var heightLeft = imgHeight; var position = 10; var doc = new jsPDF() doc.setFontSize(16); doc.addImage(img, 'PNG', 0, position, imgWidth, imgHeight); doc.setProperties({ title: 'Test pdf' }); heightLeft -= pageHeight; while (heightLeft >= 0) { position += heightLeft - imgHeight; doc.setFontSize(22); doc.text(20, 20, 'This is a title'); doc.addPage(); doc.addImage(img, 'PNG', 10, position, imgWidth, imgHeight); heightLeft -= pageHeight; } doc.save( 'mypdf.pdf'); }); }

¿Es posible llamar a diferentes elementos para ir a una página en particular cuando sea necesario?

Por ejemplo, quiero crear una portada para la página 1 y me gustaría tenerla en otro elemento.

Entonces, ¿es posible tener algo para la página 1 como:

 <div id="mycoverpageId">My Cover page html here</div>

¿Cómo puedo hacer esto?

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!