Adding Footer to pdf using jsPDF

前端 未结 7 1485
南笙
南笙 2021-01-02 09:33

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 p

7条回答
  •  别那么骄傲
    2021-01-02 10:16

    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()
    

提交回复
热议问题