I spent a lot of time looking for a good representation of my tables, then I found this plugin (https://github.com/simonbengtsson/jsPDF-AutoTable), It works great, includes themes, rowspan, colspan, extract data from html, works with json, you can also personalize your headers and make them horizontals. The image below is an example:

Answer from Oscar Acevedo on Stack Overflow
🌐
GitHub
github.com › simonbengtsson › jsPDF-AutoTable
GitHub - simonbengtsson/jsPDF-AutoTable: jsPDF plugin for generating PDF tables with javascript
This jsPDF plugin adds the ability to generate PDF tables either by parsing HTML tables or by using Javascript data directly. Check out the demo or examples.
Starred by 2.5K users
Forked by 637 users
Languages   TypeScript 89.5% | HTML 7.6% | JavaScript 2.9%
🌐
Phppot
phppot.com › javascript › jspdf-autotable
jsPDF AutoTable example – Table to PDF - Phppot
PDF tables generation from HTML or JavaScript array using jsPDF AutoTables plugin.
🌐
npm
npmjs.com › package › jspdf-autotable
jspdf-autotable - npm
To see what is included in the Table, Row, Column and Cell types, either log them to the console or take a look at src/models.ts · // Example with an image drawn in each cell in the first column autoTable(doc, { didDrawCell: (data) => { if (data.section === 'body' && data.column.index === 0) { const base64Img = 'data:image/jpeg;base64,iVBORw0KGgoAAAANS...' doc.addImage(base64Img, 'JPEG', data.cell.x + 2, data.cell.y + 2, 10, 10) } }, }) ... jsPDF.autoTableSetDefaults({ /* ...
      » npm install jspdf-autotable
    
Published   Feb 26, 2025
Version   5.0.2
Author   Simon Bengtsson
🌐
CodePen
codepen.io › CJHARKINS › pen › JmjxvG
jsPDF table
const doc = new jsPDF({ orientation: "p", //set orientation unit: "pt", //set unit for document format: "letter" //set document standard }); const btn = document.querySelector("button"); const input = document.querySelector("input"); const data1 = 'Type/Type', data2 = 'asidghalwkghuahewlgauhlwegnva', status = 'STATUS', creator = 'James Dean', date = new Date(); const sizes = { xs: 10, sm : 14, p: 16, h3: 18, h2: 20, h1: 22 }; const fonts = { times: 'Times', helvetica: 'Helvetica' }; const margin = 0.5; // inches on a 8.5 x 11 inch sheet.
🌐
Plunker
embed.plnkr.co › enTDfltWHNZ6NjjCjkSA
jsPDF table example - Plunker
var app = angular.module('angularjs-starter', ['ui.bootstrap']); app.controller('MainCtrl', function($scope) { $scope.savePDF = function(){ var pdf = new jsPDF('p','pt','a4'); //var source = document.getElementById('table-container').innerHTML; console.log(document.getElementById('table-container')); var margins = { top: 25, bottom: 60, left: 20, width: 522 }; // all coords and widths are in jsPDF instance's declared units // 'inches' in this case pdf.text(20, 20, 'Hello world.'); pdf.addHTML(document.body, margins.top, margins.left, {}, function() { pdf.save('test.pdf'); }); }; $scope.data =
🌐
Medium
medium.com › @charkins.dev › build-a-custom-table-with-react-jspdf-7d43729f6d70
Build a custom table with React/jsPDF | by Cory Harkins | Medium
January 29, 2020 - We are setting the orientation to landscape, unit of measurement to point (jsPDF offers mm, in, and px as valid measurements), and the paper size format is a4 in this example. Now, we know that our paper size is A4, however, what does that really mean in context of our unit of measurement? We need to get the page dimensions in height and width based in Point sizes. In the source code here, there is a table that represents the [width, height] of each size paper available and because we are in landscape mode (see orientation in jsPDF config options above) I flipped the width and height values to reflect this in the pageDimensions object.
🌐
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 - See the JSPDF docs for more details and other methods. Run the function and you should get back a DataUrl. This is a base64 representation of the file, and can be used in place of a URL to display the PDF in a DocumentViewer widget. For more info on DataUrls and Base64, check out this post. ... The PDF should now be displaying in the DocumentViewer. Next, we need some sample data to display in a table on the PDF. For this example, we'll be using hard-coded sample data, but you can swap this out for your own datasource as needed.
Find elsewhere
🌐
MIT App Inventor
community.appinventor.mit.edu › mit app inventor help
Generate a pdf table with the jspdf library - MIT App Inventor Help - MIT App Inventor Community
January 20, 2020 - I see this example code on the ... code … lists?: var generateData = function (amount) { var result = []; var data = { coin: "100", game_group: "GameGroup", game_name: "XPTO2", game_version: "25", machine: "20485......
🌐
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
🌐
CodeSandbox
codesandbox.io › examples › package › jspdf-table
jspdf-table examples - CodeSandbox
Use this online jspdf-table playground to view and fork jspdf-table example apps and templates on CodeSandbox.
🌐
TheoryApp
theoryapp.com › how-to-create-a-table-using-jspdf
How to Create a Table using jsPDF – TheoryApp
July 9, 2023 - You can modify the columns, rows, and table options to fit your specific requirements. To add the jspdf-autotable library to your JavaScript project, you need to include the library script file in your HTML file. Here’s an example of the complete JavaScript code that includes the jspdf-autotable ...
🌐
CodeSandbox
codesandbox.io › examples › package › jspdf-autotable
jspdf-autotable examples - CodeSandbox
pdf-with-react-and-jspdf-forked · material-react-table-example-export-to-csv · surveyjs_react_quickstart · attendance-management-project · react-table-with-fakestore-api · surveyjs-vue-quickstart · antd-export-tableExport ant.design tables as Excel, CSV and PDF ·
🌐
UNPKG
unpkg.com [email protected] › README.md
Unpkg
For example the position on the page, which page it is on etc. `HookData`: - `table: Table` - `pageNumber: number` The page number specific to this table - `settings: object` Parsed user supplied options - `doc` The jsPDF document instance of this table - `cursor: { x: number, y: number }` ...
🌐
CodePen
codepen.io › someatoms › pen › adojWy
Two tables and header with jspdf-autotable
<td>Nichols</td> <td>[email protected]</td> <td>Canada</td> <td>18.186.38.37</td> </tr> </tbody> </table> ... function generate() { var doc = new jsPDF('p', 'pt'); var res = doc.autoTableHtmlToJson(document.getElementById("basic-table")); ...
🌐
C# Corner
c-sharpcorner.com › article › export-an-html-table-using-jspdf-autotable
Export An HTML Table To PDF Using jsPDF - Autotable
October 4, 2020 - In this article, you will learn how to export an HTML table to PDF using jsPDF - autotable.
🌐
Pdfnoodle
pdfnoodle.com › blog › generating-pdfs-from-html-with-jspdf
Generating PDFs from HTML with jsPDF and javascript
January 30, 2025 - Below are some jsPDF examples to ... plugin for structured data: doc.autoTable({ head: [['Name', 'Email']], body: [['Alice', '[email protected]'], ['Bob', '[email protected]']], }); Adding pages: Multiple page documents ...
🌐
UNPKG
unpkg.com › browse › [email protected] › README.md
jspdf-autotable
[https://rawgit.com/someatoms/... var columns = ["ID", "Name", "Country"]; var rows = [ [1, "Shaw", "Tanzania", ...], [2, "Nelson", "Kazakhstan", ...], [3, "Garcia", "Madagascar", ...], ... ]; var doc = new jsPDF('p', 'pt'); doc.autoTable(columns, rows); doc.save('table.pdf'); ``` ### Usage ...
🌐
GitHub
github.com › JonatanPe › jsPDF-AutoTable
GitHub - JonatanPe/jsPDF-AutoTable
Many examples use this option, but the above use case is presented in the With content example. margin Similar to margin in css it sets how much spacing it should be around the table on each page. The startY option can be used if the margin top value should be different on the first page.
Starred by 17 users
Forked by 4 users
Languages   TypeScript 81.5% | JavaScript 18.5%
🌐
jsDelivr
cdn.jsdelivr.net › npm › [email protected] › README.md
Jsdelivr
``` Or if using javascript modules and es6: ```js import jsPDF from 'jspdf'; import 'jspdf-autotable'; const doc = new jsPDF(); doc.autoTable({html: '#my-table'}); doc.save('table.pdf'); ``` Checkout more examples in [examples.js](examples) which is also the source code for the [demo](https://simonbengtsson.github.io/jsPDF-AutoTable/) documents.