Originally, I had planned to use a JavaScript script to add missing TOC bookmarks, but then I found a great Open Source Java program that allows TOC boookmarks to be added from a text file:
JPdfBookmarks
To use it you'll have to create a bookmarks text file that looks at a bare minimum like this (bookmark title/page number):
Code:
Chapter 1/1
Chapter 2/10
Chapter 3/20
Then all you have to do is:
1. Open the .pdf file with JPdfBookmarks.
2. Click the
Load Bookmarks from a text file... button and select your bookmarks text file.
3. Save the .pdf file.
For more information, see the program's
Wiki page.
The only downside is that JPdfBookmarks is a bit slow. If you have an older machine or a very large .pdf file, it might take some time until all bookmarks are added.