Dhrubajyoti Ghosh
Creating bookmarks in PDFs
Nobody likes having PDFs with no bookmarks (or an index as you might call it), but that won't be a problem any more! All we need is thepdftk
utility (it has a ton of other uses as well).
Suppose the PDF we're working with is called foo.pdf
.
Enter the following line in a terminal
pdftk foo.pdf dump_data output bookmark.txt
This will create a file called bookmark.txt
containing various data about foo.pdf
.
Now open bookmark.txt
using your favorite editor, and insert the following piece of code at the top (or bottom):
BookmarkBegin
BookmarkTitle: Page Cover
BookmarkLevel: 1
BookmarkPageNumber: 1
Exit the editor and enter
pdftk foo.pdf update_info bookmark.txt output bookmarked.pdf
If we open bookmarked.pdf
, we'll see the contents of foo.pdf
but this time there's a bookmark section with the entry "Page Cover" pointing to page 1.
You can continue to add more bookmarks as you deem necessary.
Note: As far as I know, there's also a GUI version of pdftk
, but I've never tried it out.