为每个页面添加一个固定的页眉/页脚jsPDF [英] Adding a fixed header/footer for each page jsPDF
问题描述
我使用 jsPDF 从我的网络应用程序的动态HTML内容中生成PDF。
现在我试图给这些PDF的独特布局。我想添加一个标题& footer为我的PDF的每个页面。 jsPDF自动生成分页符,并且没有命令可以对这些分页进行操作。
I am using jsPDF to generate PDF's out of dynamic HTML content of my web-application. Right now I am trying to give those PDF's a unique layout. I want to add a "header" & "footer" for each page of my PDF. jsPDF generates page breaks automaticly and there is no command to act on those.
是否有任何已知的工作全面实现每个页面的固定页眉/页脚取决于doc.addPage();
Is there any known work-a-round to implement a fixed header/footer for each page without depending on doc.addPage();
期待任何帮助或想法。
Looking forward for any help or ideas.
推荐答案
请参阅 https://github.com/MrRio/jsPDF/pull/260
您可以使用HTML元素< header>
和< footer> ;
为此目的,例如:
You can use HTML's elements <header>
and <footer>
for that purpose, for example:
<footer>
<div style='text-align:center;'>Page <span class="pageCounter"></span>/<span class="totalPages"></span></div>
</footer>
这篇关于为每个页面添加一个固定的页眉/页脚jsPDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!