Home > other >  OpenPdf/PdfBox automatically generate table of contents
OpenPdf/PdfBox automatically generate table of contents

Time:05-11

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.

CodePudding user response:

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

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

CodePudding user response:

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)

  • Related