Is there a command-line tool that can extract only the table of contents and bookmarks as metadata from a pdf?

I found the pdftk dump_data tool/command:

pdftk in.pdf dump_data output

It works but only for small files. Also, it seems to parse the entire file. I only want metadata about the table of contents and bookmarks.

  • Have a look at mutool from mupdf to decompress large pdf files. Your table of contents is probably just text, and what format your bookmarks are in really depends on the particular pdf, so you'll have to do some custom self-written parsing in any case. – dirkt Feb 20 '17 at 7:56
  • Possible with pyPDF, maybe? It kinda worked for me for named destinations. – Gilles 'SO- stop being evil' Feb 20 '17 at 23:06

Your Answer

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

Browse other questions tagged or ask your own question.