I work with PDF a lot, and it bothers me that I can see an outline view when I open the document, but I don’t seem to be able to grab just that view. My presentations are mostly PDF and the titles and section headings show up nicely. Today I figured out how to get an outline view, so I’m putting that information here while I remember how to do it!
I used a tool called pdftk which is excellent, I’ve used it before for doing various other PDF-related things. To grab metadata such as bookmarks, use the dump-data command, like this:
pdftk myfile.pdf dump_data | grep BookmarkTitle > outline.txt
The above line takes all the bookmarks from the PDF (this was a slide deck created using powerdot and LaTeX, the section and slide titles nest appropriately), and outputs a bunch of information about the document and the various PDFs. The grep
command just gets the lines containing “BookmarkTitle”, then the whole thing gets written to a file. I cleaned that up and now I have the outline of my course, so I can add timings, notes for the exercises and so on.