Created
May 4, 2016 16:56
-
-
Save darklilium/7dff0ef6d1a031bfed8dff8a567ea7ce to your computer and use it in GitHub Desktop.
How to export data to 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
Add the following files: | |
<script src="static/js/vendor/jspdf/jspdf.min.js"></script> | |
<script src="static/js/vendor/jspdf/jspdf.plugin.autotable.js"></script> | |
then make a fx with or w/o parameters, this one works like that just by example: | |
function exportToPDF(){ | |
var columns = ["ID", "Name", "Country"]; | |
var rows = [ | |
[1, "Shaw", "Tanzania"], | |
[2, "Nelson", "Kazakhstan"], | |
[3, "Garcia", "Madagascar"], | |
]; | |
// Only pt supported (not mm or in) | |
var doc = new jsPDF('p', 'pt'); | |
doc.autoTable(columns, rows); | |
doc.save('table.pdf'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment