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

359
Views
Error al generar PDF a partir de una tabla HTML usando jsPDF y autotable

Estoy usando jsPDF y autotable para generar un PDF a partir de una tabla en mi DOM-Tree. Mi proyecto se basa en Wordpress y registré y puse en cola () ambas bibliotecas a través de un CDN.

Pero al ejecutar mi código de generación de pdf, que es básicamente un código ficticio para probar, falla con el siguiente error:

 Uncaught TypeError: t.getDocument().getFillColor is not a function f https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js:10 c https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js:10 drawTable https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js:10 drawTable https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js:10 autoTable https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.23/jspdf.plugin.autotable.min.js:10

Como no pude encontrar ninguna pregunta como esta y no pude solucionarlo yo mismo, quería compartir mi problema.

 const doc = new jsPDF({ orientation: "landscape", unit: "mm", format: [300, 260] }); doc.text(25, 25, "Header"); doc.addPage(); doc.autoTable({ html: '#my-table' }); doc.save(pdfName);
 <table id="my-table" class="table table-bordered table-custom"> <thead id="test-thead"> <tr> <td>Col 1</td> <td>Col 2</td> </tr> </thead> <tbody id="test-tbody"> <tr> <td>Test 1</td> <td>Test 2</td> </tr> </tbody> </table>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Me las arreglé para que funcione llamando a una versión anterior de autotable.js

 <script src="https://unpkg.com/jspdf-autotable@3.5.22/dist/jspdf.plugin.autotable.js"></script>

Parece estar en la última versión 3.5.23, falta un método para getFillColor.

about 4 years ago · Juan Pablo Isaza 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!