Search code examples
perlpdftableofcontents

perl, extract TOC from PDF file


I have checked through CAM::PDF and other PDF related modules, but can not figure if there a way to extract table of content from a clear PDF file.

If there any ideas I would be grateful!


Solution

  • I have not been able to find a library that supports the extraction of pdf bookmarks (which is what I assume you mean by table of contents) reliably.

    However, pdftk does a great job at this and can be run from the command line;

    pdftk myfile.pdf dump_data | grep BookmarkTitle > outline.txt