使用jsPDF将页脚添加到pdf [英] Adding Footer to pdf using jsPDF

查看:873
本文介绍了使用jsPDF将页脚添加到pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 jsPDF api生成pdf,我想在页码中添加页脚.

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

如何实现.它可以选择从fromHTML插件添加页脚,但是我在编写时没有HTML.

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");

推荐答案

您必须自己实现它.您可以执行以下操作:

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

这篇关于使用jsPDF将页脚添加到pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆