Open mmeciar opened 5 years ago
The method MetadataWriter\writeCatalog
already utilizes some of the page modes you proposed: /UseOutlines
, /FullScreen
and /UseOC
. They are all conditional. For example, it does not make sense to show bookmarks pane if there are no bookmarks/outlines in the document :)
I believe we should follow this philosophy. We could add /PageMode /UseAttachments
if and only if there exist any file annotations (attachments) in the document. I already did a working Proof-of-concept. It requires adding a new method to Mpdf
class: hasFileAnnotations()
.
However, /UseThumbs
could be specified whenever we want as the thumbnails pane do not need embedded thumbnails. This is something we could add to the existing Mpdf::$DisplayPreferences
.
We need to consider what to do when multiple /PageMode
commands will be specified. What happens when we have both bookmarks and attachments in the same document? I've checked it - specifying multiple /PageMode
commands do not break the document, however only the last setting is taken into account by the reader.
@finwe what do you think about my proposal?
I would like to have this new functionality
The attachment pane is automatically opened with PDF viewer.
I tink it is possible to insert code to end of method MetadataWriter\writeCatalog
It will be necessary to define new config parameter page_mode.
There are more possible values: /UseNone /UseOutlines /UseThumbs /FullScreen /UseOC /UseAttachments
see https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf#page=82
PDF result
`52 0 obj << /Type /Catalog /Pages 24 0 R /Metadata 25 0 R /Names 27 0 R /PageLabels << /Nums [ 0 << /S /D /St 1