OpenPDF/PDFBox自动生成目录表
在我当前的Java/Springboot项目中,我需要创建一个包含段落,图像和表格的PDF Dynamicaly。 我还需要添加本文档的内容表。
我想知道是否有一种使用OpenPDF或PDFBox自动生成此目录的方法。
我注意到可以使用Itext这样做,但这不是免费的……
谢谢您的帮助。
In my current java/springboot project, I need to create a PDF dynamicaly containing paragraphs, images and tables.
And I also need to add the table of content of this document.
I'm wondering if there is a way to automatically generate this table of contents using either openPdf or pdfBox.
I noticed that it is possible to do so using IText, but it is not free...
Thanks in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以为此使用OpenPDF: https://github.com/librepdf/openpdf/openpdf
也请参见Flying flayer saucer : https://github.com/flyingsaucerproject/flyingsaucer
You can use OpenPDF for this: https://github.com/LibrePDF/OpenPDF
Also see Flying Saucer: https://github.com/flyingsaucerproject/flyingsaucer
实际上,OpenPDF和PDFBox都没有提供一种自动生成目录表的方法:-(
下无法使用...
Itext为我们提供了这样的功能,但是它在AGPL许可下,因此在我的情况 需要使用Apache POI,然后使用OpenSagres/XdocReport将生成的DOCX转换为PDF(请参阅:)
Actually neither openPdf nor pdfBox provide a way to automatically generate table of contents :-(
iText provide us with such functionality, but it is under AGPL licence so cannot be used in my case...
For the time being, I will try acheive my needs using apache POI then convert the generated docx to pdf using opensagres/xdocreport (see: Trying to make simple PDF document with Apache poi)