Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

363
Vistas
Error while generating PDF out of HTML Table using jsPDF & autotable

I am using jsPDF & autotable to generate a PDF out of a Table in my DOM-Tree. My project is based on Wordpress and I registered and enqueued () both librarys via a CDN.

But when executing my pdf generation code, which is basically dummy code to test, it fails with the following 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

Since I couldn't find any questions like it and couldn't fix it myself, I wanted to share my problem.

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 Respuestas
Responde la pregunta

0

I've managed to get it working by calling an older version of autotable.js

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

Seems to be in the latest version 3.5.23, it's missing a method for getFillColor.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda