How to Create PDF Bookmarks for Each Chapter in an InDesign Book
This article is also available as a short video on YouTube: How to Create PDF Bookmarks for Each Chapter in an InDesign Book
A reader on r/indesign wanted a parent PDF bookmark for each chapter file in a book, with that chapter's headings nested underneath. They also wanted to keep the chapter titles out of the printed table of contents.
I tested one way to get both with a single table of contents. The chapter titles go into the table of contents at Level 1, which makes them parent bookmarks. Their entries are then set to a paragraph style that does not show on the page.
What the book needs
For this setup, each chapter file needs exactly one chapter title paragraph in the same paragraph style, such as Chapter Title. Use separate styles for the headings within each chapter. The table of contents picks up paragraphs by style, so one title paragraph per file is what gives you one parent bookmark per file.
The table of contents itself goes in a document that is part of the same book. In my test it was a front-matter file at the top of the book.
Set up the hidden entry style first
In the document that will hold the table of contents, create a paragraph style for the chapter title entries, for example TOC Chapter (hidden):
- Point Size: 0.1 pt
- Leading: 0 pt
- Space Before and Space After: 0
- Character Color: [None]
Do this before you generate the table of contents. In my tests, each setup was generated from scratch with these settings already in place. I did not test changing them on a table of contents that was already placed.
Generate the table of contents
- Open the book, and open the document that will hold the table of contents.
- Choose Layout > Table of Contents and click More Options.
- Add
Chapter Titleto Include Paragraph Styles, then the heading styles. SetChapter Titleto Level 1 and the headings to Level 2. - Select
Chapter Titlein the list. Set its Entry Style toTOC Chapter (hidden)and its Page Number to No Page Number. - Turn on Create PDF Bookmarks and Include Book Documents. If Include Book Documents is grayed out, check that the book is open and that this document is in it.
- Click OK and place the table of contents.
- Check the contents page, then save the document.
In my test, the printed table of contents showed only the headings, with no empty lines where the chapter titles had been. The chapter titles are still in the InDesign story. They are only too small and colorless to see.
Include Book Documents matters. With it turned off, the table of contents looked only at the document it was in. My front-matter file had no titles or headings of its own, so the PDF had no bookmarks at all.
If you base the hidden style on an existing style, check the contents page for gaps. Other settings inherited by the entry style, such as alignment to a baseline grid, were not tested.
Export the whole book
Export from the Book panel menu with Export Book to PDF, so every document is included. If a document is selected in the Book panel, the menu shows Export Selected Documents to PDF instead. Click an empty area of the panel first. In the Export Adobe PDF dialog, turn on Bookmarks under Include in the General section.
Check the preset first. PDF/X-1a does not allow bookmarks, so a book exported with that preset has no bookmarks however the table of contents is set up. I used a preset with no PDF/X standard and Acrobat 7 compatibility.
Open the exported PDF and check that each chapter bookmark contains the expected headings and opens the first page of its chapter.
What I tested
I built a small book in InDesign 21.6 on Windows: a front-matter file and three chapter files of three pages each. I generated the table of contents from the book, exported the whole book to PDF, and read the bookmarks from the PDF.
| Table of contents setup | Printed contents page | PDF bookmarks |
|---|---|---|
| Chapter titles at Level 1, visible, Include Book Documents on | Chapter titles and headings | Chapter titles with headings nested under them |
| Same, with the hidden entry style and No Page Number | Headings only, no gaps | Same hierarchy and destinations as the row above |
| Include Book Documents off | Only the "Contents" title | None |
Text extraction with PyMuPDF's get_text() did not return the chapter titles from the exported contents page.
I did not test macOS, other InDesign versions, long books, tagged PDF output or screen readers. I also did not test a chapter with no chapter title paragraph or with more than one, or updating an existing table of contents after changing the setup.