1

I am looking for a free (free of charge; open source preferred, but not required) tool that can set the display flags of a PDF file, in particular the flag to automatically display the bookmarks list.

More specifically, it seems1 that I need to set the page mode to UseOutlines.

Both GUI and command line tools are acceptable. The tool should run on Windows or be platform-independent (Java, Mono, ...).

Background:

I create PDF documents with LaTeX and the hyperref package, where I can define bookmarks and configure the resulting PDF file to have Acrobat Reader automatically display the bookmarks list upon opening the file.

However, I combine several of these PDF files with pages from other PDF files by using PDF Split and Merge. This preserves the bookmarks (which are apparently considered a part of a page), but does not preserve the overall setting for the file to be opened with the bookmarks list visible.

1: I am not an expert on the PDF file format, so my conclusions are merely based upon looking at the raw contents of PDF files with different settings.

  • I'm not sure (which if why this is a comment instead of an answer), but you may be able to do this using pdftk and the update_info command. – Moshe Katz Oct 14 '15 at 19:34
  • @MosheKatz: That looks promising at first sight. However, this comment suggests the feature had not been added a month ago. Given that it had already been added to the wishlist 5 years ago, I do not expect it to be added to pdftk anytime soon :/ – O. R. Mapper Oct 14 '15 at 21:47
  • Apache PDFBox seems to have this feature. – baitisj Oct 15 '15 at 8:57
  • @baitisj: This should be an answer. While I am a bit undecided whether I will accept a programming library as the answer on this question (future visitors might not have any programming skills and indeed be looking for a runnable tool), it will certainly be sufficient for my own purposes and thus deserve at least my upvote. – O. R. Mapper Oct 15 '15 at 9:00
1

Although not a tool in the sense of a compiled and ready-to-use application, it appears that the Apache PDFBox library supports setting of the page mode to use outlines as required in your specification.

Additionally, the PDFBox library is open-source.

| improve this answer | |
  • 1
    It seems like adding a tool to modify PDF flags would be a very useful contribution to the PDFBox project. – baitisj Oct 15 '15 at 9:17
  • Will try this in the next few days, then report back. – O. R. Mapper Oct 15 '15 at 9:18
  • This works - a simple PDDocument doc = PDDocument.load(inFile); PDDocumentCatalog catalog = doc.getDocumentCatalog(); catalog.setPageMode(PDDocumentCatalog.PAGE_MODE_USE_OUTLINES); doc.save(inFile.replaceFirst(".pdf", ".out.pdf")); does everything I was looking for. As I suggested above, I will not quite select this as an accepted answer yet, for the sake of future visitors, but at least +1 for now. – O. R. Mapper Oct 15 '15 at 21:56
  • I have ended up accepting this answer as it seems to be the "solution that comes closest to what I was looking for" at this time, for lack of any alternative answers. – O. R. Mapper Apr 8 '18 at 20:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.