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

361
Views
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 answers
Answer question

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 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!