How to extract bookmarks from a PDF file

pdf

I have a PDF file. I need the bookmarks in that file extracted to a text file or an Excel spreadsheet. I also need to validate the bookmarks from the large PDF file. How would I do that?

Best Answer

You can use the CLI of jpdftweak to extract bookmarks in CSV format:

java -jar -Xmx512M jpdftweak.jar "file.pdf" -savebookmarks "bmarks.csv" /dev/null

After validating and possibly modifying the bookmark data you could load it back into the PDF file with the following command:

java -jar -Xmx512M jpdftweak.jar "file.pdf" -loadbookmarks "bmarks.csv" "file_updated.pdf"

The -Xmx512M Java parameter is optional but can help with processing larger PDF files that require more memory.

You might want to read this related Q&A as well.

Related Question