Jacob Collins Jacob is the JPedal Product Lead and specialises in PDF creation and manipulation. He also develops Salesforce backend systems and contributes to marketing and support. Outside of work, he’s a 1900‑rated chess player, guitarist, and French learner.

How to add a table of contents to a PDF in Java (Tutorial)

33 sec read

PDF Outline

To add a table of contents to a PDF file in Java, you can use our PDF toolkit JPedal.

Once you have downloaded the JPedal jar, you can use the following lines of code to generate a table of contents based on the bookmarks that already exist in the file. See our other blog post on how to add bookmarks to a PDF file.

You can customise the page dimensions, font, font size, and font color. Learn more on our support site.

Resources

JPedal contains a powerful PDF Manipulator which you can use to perform bulk edits to your documents.

We can help you better understand the PDF format as developers who have been working with the format for more than 2 decades!



The JPedal PDF library allows you to solve these problems in Java


Jacob Collins Jacob is the JPedal Product Lead and specialises in PDF creation and manipulation. He also develops Salesforce backend systems and contributes to marketing and support. Outside of work, he’s a 1900‑rated chess player, guitarist, and French learner.