Two tables and header with jspdf-autotable
How do I make an two tables and header with jspdf-autotable?
For stackoverflow question: http://stackoverflow.com/questions/33743540/problems-with-jspdf-and-autotable. What is a two tables and header with jspdf-autotable? How do you make a two tables and header with jspdf-autotable? This script and codes were developed by Simon Bengtsson on 07 December 2022, Wednesday.
Two tables and header with jspdf-autotable - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Two tables and header with jspdf-autotable</title>
</head>
<body> <button onclick="generate()">Generate PDF</button>
<table id="basic-table" style="display: none;"> <thead> <tr> <th>ID</th> <th>First name</th> <th>Last name</th> <th>Email</th> <th>Country</th> <th>IP-address</th> </tr> </thead> <tbody> <tr> <td align="right">1</td> <td>Donna</td> <td>Moore</td> <td>[email protected]</td> <td>China</td> <td>211.56.242.221</td> </tr> <tr> <td align="right">2</td> <td>Janice</td> <td>Henry</td> <td>[email protected]</td> <td>Ukraine</td> <td>38.36.7.199</td> </tr> <tr> <td align="right">3</td> <td>Ruth</td> <td>Wells</td> <td>[email protected]</td> <td>Trinidad and Tobago</td> <td>19.162.133.184</td> </tr> <tr> <td align="right">4</td> <td>Jason</td> <td>Ray</td> <td>[email protected]</td> <td>Brazil</td> <td>10.68.11.42</td> </tr> <tr> <td align="right">5</td> <td>Jane</td> <td>Stephens</td> <td>[email protected]</td> <td>United States</td> <td>47.32.129.71</td> </tr> <tr> <td align="right">6</td> <td>Adam</td> <td>Nichols</td> <td>[email protected]</td> <td>Canada</td> <td>18.186.38.37</td> </tr> </tbody>
</table> <script src='https://cdn.rawgit.com/simonbengtsson/jsPDF/requirejs-fix-dist/dist/jspdf.debug.js'></script>
<script src='https://unpkg.com/[email protected]'></script> <script src="js/index.js"></script>
</body>
</html>
Two tables and header with jspdf-autotable - Script Codes JS Codes
function generate() { var doc = new jsPDF('p', 'pt'); var res = doc.autoTableHtmlToJson(document.getElementById("basic-table")); doc.autoTable(res.columns, res.data, {margin: {top: 80}}); var header = function(data) { doc.setFontSize(18); doc.setTextColor(40); doc.setFontStyle('normal'); //doc.addImage(headerImgData, 'JPEG', data.settings.margin.left, 20, 50, 50); doc.text("Testing Report", data.settings.margin.left, 50); }; var options = { beforePageContent: header, margin: { top: 80 }, startY: doc.autoTableEndPosY() + 20 }; doc.autoTable(res.columns, res.data, options); doc.save("table.pdf");
}
Developer | Simon Bengtsson |
Username | someatoms |
Uploaded | December 07, 2022 |
Rating | 3 |
Size | 2,245 Kb |
Views | 74,888 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
AutoTable Base | 1,984 Kb |
JsPDF 1.1 | 1,985 Kb |
DataTables Buttons | 4,284 Kb |
DataTables Base | 3,668 Kb |
A Pen by Simon Bengtsson | 1,579 Kb |
Bootstrap Datepicker i18n | 1,899 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Starfield using KineticJS | Asp | 3,512 Kb |
A Pen by Jess | Jessamyne | 5,100 Kb |
Hamburger Menu Animation | Salmanraza | 2,580 Kb |
Fullscreen Parallax | Bassta | 3,313 Kb |
Simple yet functional | Matheusxaviersi | 2,025 Kb |
A Pen by Sooba | Sooba | 2,516 Kb |
Weird glowy CSS3 game | Toneworm | 3,684 Kb |
Price table | Serluk | 5,928 Kb |
GrcJS | Vino6 | 2,047 Kb |
A Pen by aaron k saunders | Aaronksaunders | 2,916 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!