A Pen by Yerlin Matu on CodePen.
Created
February 9, 2019 23:59
-
-
Save YerlinMatu/02275a5a10b860d6095561b2c946451a to your computer and use it in GitHub Desktop.
TablePDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table id="my-table"><!-- ... --></table> | |
<script src="jspdf.min.js"></script> | |
<script src="jspdf.plugin.autotable.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = new jsPDF(); | |
// You can use html: | |
doc.autoTable({html: '#my-table'}); | |
// Or JavaScript: | |
doc.autoTable({ | |
head: [['Name', 'Email', 'Country']], | |
body: [ | |
['David', 'david@example.com', 'Sweden'], | |
['Castille', 'castille@example.com', 'Norway'], | |
// ... | |
] | |
}); | |
doc.save('table.pdf'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://unpkg.com/jspdf"></script> | |
<script src="https://unpkg.com/jspdf-autotable"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generate table pdf