Is it possible, with pdftk, to render a bookmarked PDF that opens with bookmarks displaying? I've been able to set that as an option with various GUI tools over the years (Ipro+, PDFDocs, etc…) but I've been unable to find documentation that indicates pdftk 'knows' (so to speak) how to set that flag, nor have I been able to find a likely value after comparing dumps of
pdftk input.pdf output_data output data.txt
from files with bookmarks that display by default against dumps of those that don't.
Best Answer
Is it possible, with pdftk, to render a bookmarked PDF that opens with bookmarks displaying?
I did a little research on this topic and wanted to compile an answer with references.
According to this guy from this post claiming to be the
pdftk
maintainer, it's stated that:So I think this means that if you created a new PDF document, or created a new PDF document with
cat
operations, or started with a PDF document that did not already have this initial view metadata properties in it to start with, then PDFtk it'll open up in a "view" that's set to open however the default PDF viewing software tells it to open up. If there's no metadata in the document related to the Bookmark Panel view, then obviously it won't be able to utilize it regardless.According to the PDFtk Man page there are two options that are related to metadata and bookmarks and another statement related to bookmarks.
So I think this means that if you have a PDF document with bookmark metadata that you need to use the
dump_data
option first to export that metadata to a flat file. You will then use the flat file with that metadata in it with theupdate_info
option to put the correlated metadata from that file into the PDF file you create, etc.Furthermore, if no pages are specified (e.g.
cat
option) in the PDFtk operation then it sounds like the entire PDF document and it's correlated metadata including default "view" settings will be merged over to the output file.