如何使用Apache PDFBox打印页面no?
我有一个PDF文件,其中我必须使用Java中的Apache PDFBox库在PDF的每个页面上打印页面。 PDF有一个具有动态内容的表,我不知道我的内容需要多少页来在PDF上打印,因为它包含一个带有动态数据的表。
例如: - 在创建PDF时,文件可能具有4或5页,在这种情况下,我必须在PDF页脚上的每个页面上打印页面。像下面的那样,
假设内容将在
第1页的PDF中的4页上打印在第1页第1页,of 4
第2页第2页,第4页,of 4
第3页,第3页第3页,共4页
第4页第4页,共4页
I have a PDF file where I have to print page no on each page of PDF using the Apache PDFBox library in Java.
And Pdf has a table with dynamic content I don't know how many pages my content will be required to print on PDF because it contains a table with dynamic data.
For e.g:-
While creating the PDF a file may have 4 or 5 pages in that case I have to print page no on each page at the footer of the PDF. like below
Let's assume content will be printed on 4 pages in PDF
On page no 1 Page 1 of 4
On page no 2 Page 2 of 4
On page no 3 Page 3 of 4
On page no 4 Page 4 of 4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上面的代码将生成一个PDF文件,该文件包含PDF每个页面上的可重复标头行的表和每个页面上的页面。结果对您来说可能略有不同,但对我有用。
2使用库,一个是 apache pdfbox easytable 使用apachepdfbox
依赖性的库来创建表格
The above code will generate a pdf file that contains the table with repeatable header row on each page of pdf and page no on each page. Results might be slightly different for you but it works for me.
2 libraries are used one is Apache PDFBox and EasyTable to create tables using ApachePDFBox
dependency for libraries are:-