3

I'm looking for a way to modify an existing pdf file so that the bookmarks panel opens automatically (on the right hand side) when I open the pdf file in acrobat reader or another reader.

In https://stackoverflow.com/questions/17333412/set-pdf-document-properties-initial-view you can see how this would be done in Acrobat.

However, I do not have, or really want Acrobat, and would like a way to do this from the unix command line.

I've looked at pdftk and qpdf but can't see how these tools can help me for the moment.

Any ideas ?

Best regards /Colm

6

1 Answer 1

2

Having done a comparison of the raw pdf files in a text editor I have a solution :

Replace the line

<</Type/Catalog/Pages 2 0 R/Lang(en-GB) /StructTreeRoot 32 0 R/Outlines 24 0 R/MarkInfo<</Marked true>>>>

with

<</PageMode/UseOutlines/Outlines 3 0 R/Pages 4 0 R/MarkInfo<</Marked true>> /Type/Catalog/Pages 2 0 R/Lang(en-GB) /StructTreeRoot 32 0 R/Outlines 24 0 R/MarkInfo<</Marked true>>>>

and now the bookmarks open automatically at opening.

It remains to see if this will work on different pdf files......

1
  • Thanks for finding the right tag, which pointed me in the right direction! You do not need to duplicate the other tags; you only need to add /PageMode/UseOutlines to the root object. However, by doing so, at least Adobe Reader will ask to save the file on every exit. The solution is to use Ghostscript; see this post: thechriskent.com/2017/03/06/…
    – Klaidonis
    Oct 18, 2020 at 7:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .