How can I create a tree table of content in a PDF that can be expanded and collapse like the image below?

I know we can go to a page and add a bookmark to include that page in the table of content, but I cannot create a "tree" this way. In addition, if we create a table of contents in a Word document using styles, we can have a table of content by converting the Word into PDF, but I'm talking about a PDF created from scanned book images.

enter image description here


Jpdfbookmark can work for scanned books

  1. Prepare the TOC in a .txt file in this format:

    Chapter 1. The Beginning/23
        Para 1.1 Child of The Beginning/25,FitWidth,96
            Para 1.1.1 Child of Child of The Beginning/26,FitHeight,43
    Chapter 2. The Continue/30,TopLeft,120,42
        Para 2.1 Child of The Beginning/32,FitPage

    You can ORC the TOC and use regex to fix it.

  2. Load that TOC

  3. Expand all bookmarks (Ctrl + E), select all of them, then go to Tools > Apply Page Offset

  4. Enter the first pages that outmatch the page number in the TOC

    You can read its manual or watch a quick video tutorial. It has command line mode and can work on Linux, Mac.

How to OCR tables of contents to proper outputs?
How can I split in half a double-page scanned PDF in a single pass?

  • Hi there, I'm another random guy! I appreciate it. – living being Oct 29 '17 at 7:19
  • Hi random guy, thanks for visiting my profile. Hope you like it – Ooker Oct 29 '17 at 11:50

If you do OCR, then you could use Aerialist by Debenu, an Acrobat plug-in, to create bookmarks.

In case OCR is not possible or does not provide satisfactory results, I don't see any other way than to create the bookmarks manually.

To manually create hierarchical bookmarks in Acrobat, you grab the bookmark for the lower level, move it over or just below the upper level bookmark entry and pull it towards the right. You will see an insertion line which is more indented than if it is on the same level.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.