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