www.sitepoint.com
Open in
urlscan Pro
2600:9000:21c7:a800:10:7abf:f800:93a1
Public Scan
URL:
https://www.sitepoint.com/community/t/jspdf-autotable-footer/250895
Submission: On April 07 via manual from IN — Scanned from DE
Submission: On April 07 via manual from IN — Scanned from DE
Form analysis
2 forms found in the DOMPOST /community/login
<form id="hidden-login-form" method="post" action="/community/login" style="display: none;">
<input name="username" type="text" id="signin_username">
<input name="password" type="password" id="signin_password">
<input name="redirect" type="hidden">
<input type="submit" id="signin-button" value="Log In">
</form>
Name: free-book-form — https://www.sitepoint.com/premium/register-user
<form name="free-book-form" id="free-book-form" action="https://www.sitepoint.com/premium/register-user">
<input type="hidden" name="campaign" value="">
<input type="text" name="name" placeholder="Name" required="">
<input type="email" name="email" placeholder="Enter your Email" required="">
<button type="submit">Go</button>
</form>
Text Content
SitePoint Forums | Web Development & Design Community JSPDF-AUTOTABLE FOOTER JavaScript tqmd1 January 21, 2017, 6:37am 1 Sir I am using these codes function generate() { var doc = new jsPDF('p', 'pt'); doc.setFontSize(18); doc.text('Chart of Accounts', 220, 50); // doc.text(document.getElementById("rptname").value, 220, 50); doc.setFontSize(8); doc.setTextColor(100); var res = doc.autoTableHtmlToJson(document.getElementById("mytable")); doc.autoTable(res.columns, res.data, {margin: {top: 70}}); doc.save("chartofaccounts.pdf"); } Now I want to use page number and number of pages in footer. Here is link of jsPDF-AutoTable https://simonbengtsson.github.io/jsPDF-AutoTable/#header-footer but I could not understand how to adjust these codes in above codes // Header and footers - shows how header and footers can be drawn examples['header-footer'] = function () { var doc = new jsPDF(); var totalPagesExp = "{total_pages_count_string}"; var pageContent = function (data) { // HEADER doc.setFontSize(20); doc.setTextColor(40); doc.setFontStyle('normal'); if (base64Img) { doc.addImage(base64Img, 'JPEG', data.settings.margin.left, 15, 10, 10); } doc.text("Report", data.settings.margin.left + 15, 22); // FOOTER var str = "Page " + data.pageCount; // Total page number plugin only available in jspdf v1.0+ if (typeof doc.putTotalPages === 'function') { str = str + " of " + totalPagesExp; } doc.setFontSize(10); doc.text(str, data.settings.margin.left, doc.internal.pageSize.height - 10); }; doc.autoTable(getColumns(), getData(40), { addPageContent: pageContent, margin: {top: 30} }); // Total page number plugin only available in jspdf v1.0+ if (typeof doc.putTotalPages === 'function') { doc.putTotalPages(totalPagesExp); } return doc; }; Or is there any other way to show page number? Please help system Closed April 22, 2017, 1:38pm 2 This topic was automatically closed 91 days after the last reply. New replies are no longer allowed. * Home * Categories * FAQ/Guidelines * Terms of Service * Privacy Policy Powered by Discourse, best viewed with JavaScript enabled Skip to main content ArticlesPremium Sign UpLog In * * JSPDF-AUTOTABLE FOOTER JavaScript You have selected 0 posts. select all cancel selecting Jan 2017 1 / 2 Jan 2017 Apr 2017 tqmd1SitePoint Member 1 Jan '17#1 Sir I am using these codes function generate() { var doc = new jsPDF('p', 'pt'); doc.setFontSize(18); doc.text('Chart of Accounts', 220, 50); // doc.text(document.getElementById("rptname").value, 220, 50); doc.setFontSize(8); doc.setTextColor(100); var res = doc.autoTableHtmlToJson(document.getElementById("mytable")); doc.autoTable(res.columns, res.data, {margin: {top: 70}}); doc.save("chartofaccounts.pdf"); } Now I want to use page number and number of pages in footer. Here is link of jsPDF-AutoTable https://simonbengtsson.github.io/jsPDF-AutoTable/#header-footer 835 but I could not understand how to adjust these codes in above codes // Header and footers - shows how header and footers can be drawn examples['header-footer'] = function () { var doc = new jsPDF(); var totalPagesExp = "{total_pages_count_string}"; var pageContent = function (data) { // HEADER doc.setFontSize(20); doc.setTextColor(40); doc.setFontStyle('normal'); if (base64Img) { doc.addImage(base64Img, 'JPEG', data.settings.margin.left, 15, 10, 10); } doc.text("Report", data.settings.margin.left + 15, 22); // FOOTER var str = "Page " + data.pageCount; // Total page number plugin only available in jspdf v1.0+ if (typeof doc.putTotalPages === 'function') { str = str + " of " + totalPagesExp; } doc.setFontSize(10); doc.text(str, data.settings.margin.left, doc.internal.pageSize.height - 10); }; doc.autoTable(getColumns(), getData(40), { addPageContent: pageContent, margin: {top: 30} }); // Total page number plugin only available in jspdf v1.0+ if (typeof doc.putTotalPages === 'function') { doc.putTotalPages(totalPagesExp); } return doc; }; Or is there any other way to show page number? Please help * CREATED Jan '17 * LAST REPLY Apr '17 * 1 REPLY * 19.8k VIEWS * 1 USER * 1 LINK 3 months later Closed on Apr 22, '17 This topic was automatically closed 91 days after the last reply. New replies are no longer allowed. Reply SUGGESTED TOPICS Topic Replies Views Activity Filter out element in deeply nested array JavaScript 7 565 Jan 18 Including bundle.min.js inside an html app JavaScript 0 588 Jan 23 Is there a reason this location.assign does not work? JavaScript 3 279 Jan 10 Select rows, add amounts and display the total in angular JavaScript angularjs typescript angular 1 1.1k Jan 17 How to have a Smooth/Fast scroll in mobile popup window? JavaScript 2 874 Jan 29 WANT TO READ MORE? BROWSE OTHER TOPICS IN JAVASCRIPT OR VIEW LATEST TOPICS. Share Invalid date Invalid date Go This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.