I successfully tried it for the newer versions of jspdf (version 2.5.1) and autotable (version 3.5.25).
Minimal example:
<!DOCTYPE html>
<html>
<head>
<title>jspdf-autotable demo</title>
</head>
<body>
<div>save pdf modal will pop up automatically</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js"></script>
<script>
const { jsPDF } = window.jspdf;
const doc= new jsPDF();
doc.autoTable({
head: [['Name', 'Email', 'Country']],
body: [
['David', '[email protected]', 'Sweden'],
['Castille', '[email protected]', 'Spain'],
],
})
doc.save("demo.pdf");
</script>
</html>
Answer from jean-acsas on Stack Overflownpm
npmjs.com › package › jspdf-autotable
jspdf-autotable - npm
February 26, 2025 - --></table> autoTable(doc, { html: '#my-table' }) // Or use javascript directly: autoTable(doc, { head: [['Name', 'Email', 'Country']], body: [ ['David', '[email protected]', 'Sweden'], ['Castille', '[email protected]', 'Spain'], // ... ], }) doc.save('table.pdf') You can also use the plugin methods directly on the jsPDF documents:
» npm install jspdf-autotable
Published Feb 26, 2025
Version 5.0.2
Author Simon Bengtsson
GitHub
github.com › simonbengtsson › jsPDF-AutoTable
GitHub - simonbengtsson/jsPDF-AutoTable: jsPDF plugin for generating PDF tables with javascript
--></table> autoTable(doc, { html: '#my-table' }) // Or use javascript directly: autoTable(doc, { head: [['Name', 'Email', 'Country']], body: [ ['David', '[email protected]', 'Sweden'], ['Castille', '[email protected]', 'Spain'], // ... ], }) doc.save('table.pdf') You can also use the plugin methods directly on the jsPDF documents:
Starred by 2.5K users
Forked by 637 users
Languages TypeScript 89.5% | HTML 7.6% | JavaScript 2.9%
Videos
14:12
jsPDF-Autotable Tutorial to Add Dynamic Nested HTML5 ...
12:28
jsPDF-Autotable Project to Add Images inside Table Rows ...
07:19
jsPDF-Autotable Tutorial to Insert Array of JSON Objects Data ...
05:36
jsPDF-Autotable Tutorial To Add Colorful Border to Header ...
jsPDF-Autotable Tutorial to Add Dynamic Tables in PDF ...
10:11
jsPDF Library & jsPDF AutoTable Library Crash Course in ...
jsDocs.io
jsdocs.io › package › jspdf-autotable
[email protected] - jsDocs.io
February 26, 2025 - type autoTableInstanceType = (options: UserOptions) => void; type CellHook = (data: CellHookData) => void | boolean; type CellInput = null | string | string[] | number | boolean | CellDef; ... No dependencies. ... To add a badge like this oneto your package's README, use the codes available below. You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/jspdf-autotable.
GitHub
github.com › JonatanPe › jsPDF-AutoTable
GitHub - JonatanPe/jsPDF-AutoTable
Only the drawCell hook can be used with the native style jspdf style changes such as doc.setLineWidth. If you use the other hooks for changing styles, they will be overridden. autoTableHtmlToJson(tableElem, includeHiddenElements) Use it to generate the javascript objects required for this library from an html table (see from html example).
Starred by 17 users
Forked by 4 users
Languages TypeScript 81.5% | JavaScript 18.5%
Top answer 1 of 3
3
I successfully tried it for the newer versions of jspdf (version 2.5.1) and autotable (version 3.5.25).
Minimal example:
<!DOCTYPE html>
<html>
<head>
<title>jspdf-autotable demo</title>
</head>
<body>
<div>save pdf modal will pop up automatically</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/3.5.25/jspdf.plugin.autotable.min.js"></script>
<script>
const { jsPDF } = window.jspdf;
const doc= new jsPDF();
doc.autoTable({
head: [['Name', 'Email', 'Country']],
body: [
['David', '[email protected]', 'Sweden'],
['Castille', '[email protected]', 'Spain'],
],
})
doc.save("demo.pdf");
</script>
</html>
2 of 3
1
The only solution, that works for me now, is to save the code of jsPDF and AutoTable in the same file. It's not good idea, I know, I would like to have them in separate files, but I haven't founded another way. It anybody could tell a better way to avoid the errors, it would be great
cdnjs
cdnjs.com › home › libraries › jspdf-autotable
jspdf-autotable - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
jspdf-autotable · Generate PDF tables with jsPDF · 2k · GitHub · MIT licensed · Tags: pdf, table, jspdf · Version · 5.0.2 · Loading... Asset Type · All · Loading... https://cdnjs.cloudflare.com/ajax/libs/jspdf-autotable/5.0.2/jspd...
Simonbengtsson
simonbengtsson.github.io › jsPDF-AutoTable
AutoTable sample
It appears you don't have PDF support in this web browser. Click here to download the PDF
Maven Repository
mvnrepository.com › artifact › org.webjars.bowergithub.simonbengtsson › jspdf-autotable
Maven Repository: org.webjars.bowergithub.simonbengtsson » jspdf-autotable
Home » org.webjars.bowergithub.simonbengtsson » jspdf-autotable · WebJar for jsPDF-AutoTable · Central (3) Web site developed by @frodriguez Powered by: Scala, Play, Spark, Akka and Cassandra · Copyright © 2006-2019 MvnRepository. All rights reserved.
Appsmith
community.appsmith.com › tutorial › data-driven-pdf-generator-jspdf-and-autotable
Data-Driven PDF Generator with JSPDF and Autotable | Appsmith Community Portal
October 12, 2024 - In this guide, we'll be using the JSPDF library and the JSPDF-AutoTable plug-in to generate PDFs from customer order data. This method builds a PDF programmatically, one line at a time, as opposed to other methods that use a template or HTML. Using this approach, you can input data from any Appsmith datasource, and transform it with JavaScript to generate a PDF from the live data.
DevExpress
supportcenter.devexpress.com › ticket › details › t1062815 › exportdatagrid-method-requires-a-autotable-plugin-for-jspdf-object
"exportDataGrid" method requires a autoTable plugin for jsPDF object | DevExpress Support
January 26, 2022 - Hi, I am testing export to pdf and running into runtime error: core.mjs:6495 ERROR Error: The "exportDataGrid" method requires a autoTable p
UNPKG
unpkg.com › jspdf-autotable
jspdf-autotable
Generate pdf tables with javascript (jsPDF plugin) · simonbengtsson.github.io/jsPDF-AutoTable
Top answer 1 of 9
19
Just delete the 2 first line of imports and add the following lines:
import { jsPDF } from 'jspdf';
import { autoTable } from 'jspdf-autotable';
autoTable(doc, { ... })
You can see an example here
2 of 9
3
i was geting same issue and I fixed it like this:
import jsPDF from '../../node_modules/jspdf/dist/jspdf.umd.min.js'
import { applyPlugin } from 'jspdf-autotable'
applyPlugin(jsPDF)
i use "jspdf": "^2.3.1", "jspdf-autotable": "^3.5.20" i hope it helps you!
CodeSandbox
codesandbox.io › examples › package › jspdf-autotable
jspdf-autotable examples - CodeSandbox
Use this online jspdf-autotable playground to view and fork jspdf-autotable example apps and templates on CodeSandbox.