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

428
Views
Crear PDF a partir de una cadena HTML jsPDF

Quería crear un documento PDF a partir de la cadena HTML que obtengo de SQL usando jsPDF .

//Cadena HTML (parte de)

 <table style='width:100%'> <table class="test_listview" width="100%"><tr><td width="1%"></td><td width="20%";padding: 5px; style="line-height: 20px;"><b>SG:</b></td><td width="28%";padding: 5px; style="border-bottom: 1px solid #000;line-height: 20px;">Test</td></tr></table></table>

//Intentó

 var tag = document.createElement("p"); tag.textContent = //Pasted the above HTML; const input = tag; html2canvas(input) .then((canvas) => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF(); pdf.addImage(imgData, 'JPEG', 0, 0); pdf.save("download.pdf"); });

El compilador no funcionó. Entonces, ¿hay alguna forma de hacer que funcione usando jsPDf y htmlCanvas ? O alguna alternativa a esto??

Algo así como pasar esta cadena HTML y generar el PDF.

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!