Skip to content
Discussion options

You must be logged in to vote

Is there an easier way to achieve this? Alternatively, would it be possible to add parameter to fitz.open() (or to set_toc itself) to set this /PageMode key and value to Document Catalog object?

There are two questions:

  1. Is there an easier way to achieve this?

    • Yes, there is: you can set PDF dictionary key-value pairs with method doc.xref_set_key(doc.pdf_catalog(), "PageMode", "/UseOutlines"). This does what you already have done so marvelously using string manipulation. The advantages of the method are that it (1) automatically resolves multiple nested xref sub-references, (2) automatically inserts, resp. overwrites the key (here /PageMode) if not present, respectively already there. …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@PeterSlezak
Comment options

@JorjMcKie
Comment options

Answer selected by JorjMcKie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants