Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
106
rated 0 times [  110] [ 4]  / answers: 1 / hits: 65442  / 9 Years ago, wed, november 4, 2015, 12:00:00

I am generating pdf from jsPDF api , I want to add footer to each page with page number .



How to achieve this . It is having option of adding footer from fromHTML plugin , but I am writing without HTML.



var doc = new jsPDF(portrait,px,a4);

More From » html

 Answers
11

You have to implement it yourself. You can do something like this:



var doc = new jsPDF();
doc.page=1; // use this as a counter.

function footer(){
doc.text(150,285, 'page ' + doc.page); //print number bottom right
doc.page ++;
};

// and call footer() after each doc.addPage()

[#64512] Monday, November 2, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lailab

Total Points: 706
Total Questions: 102
Total Answers: 95

Location: Falkland Islands
Member since Mon, Jul 13, 2020
4 Years ago
;