OpenAction support
Some tools (like masterpdfeditor, etc.) allow to define the behavior at opening time, about "fitting" the whole page to adjust it with the most adequate zoom.
Pragmatically speaking, this is the diff between one PDF without this and one PDF with this OpenAction having been added (diff) :
<</Outlines 1 0 R /PageLayout/TwoPageRight/PageMode/UseOutlines/Pages 54 0 R /Type/Catalog/ViewerPreferences<</FitWindow true>>>>
---
> <</Outlines 1 0 R /PageLayout/TwoPageRight/PageMode/UseOutlines/Pages 54 0 R /Type/Catalog/ViewerPreferences<</FitWindow true>>/OpenAction[ 13 0 R /Fit]>>
So it seems the only difference is an extra "ViewerPreferences", with an "OpenAction" : OpenAction[ 13 0 R /Fit]
Is it possible to do this in some way through pdfcpu ?
Hello!
If you want to fit or center your pages etc. you can already do that using pdfcpu viewerpref set and pdfcpu pagelayout set.
If you want to jump to a certain page when opening your document then that's the use case for an OpenAction.
Right now pdfcpu does not allow to add OpenActions which in addition to jumping to a page also allow jumping to urls and execute Javascript.
There are valid security concerns around using PDF OpenActions using URIs or Javascript - we can provide a basic implementation that allows jumping to a specific page, would that work for you?
Yes, having the capacity to add some OpenAction just with that basic feature :
- jump to a specific internal page of the PDF (ideally just by specifying the page number)
- capacity to define the "zoom" feature when landing on that page (allowing a "FitPage", "FitHeight", "FitWidth" configuration) would be perfectly fine.
Indeed, OpenAction with "URLs" / "javascript" may generate security issues. Not needed for most cases.