0

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.

David ROSEY
  • 1,414
  • 1
  • 7
  • 20

2 Answers2

0

You can use OpenPDF for this: https://github.com/LibrePDF/OpenPDF

Also see Flying Saucer: https://github.com/flyingsaucerproject/flyingsaucer

roschdal
  • 103
  • 1
  • 9
0

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)

David ROSEY
  • 1,414
  • 1
  • 7
  • 20