[Feature Idea] Additional `PdfBookmark` data -> `BookmarkDestination`

According to the Adobe®PDF reference -> Interactive Features -> Document-Level Navigation -> Destinations.

A bookmark can have explicit destinations as coded in the /Dest [3 0 R /XYZ 300.000 792.000 0] which will jump to position (300, 792) in the page desiered when the user clicks a bookmark.

22 0 obj
<< /Title ( Chapter 1 )
/Parent 210 R
/Next 260 R
/First 230 R
/Last 250 R
/Count 3
/Dest [3 0 R /XYZ 300.000 792.000 0]
>> endobj

Right now, bookmarks generated by update_info can only be /Dest [3 0 R /Fit], and the /Fit is simply goto that page.


I propose adding a new optional field BookmarkDestination:

When dump_data,

If a bookmark has the format of [pdge /XYZ left top zoom], a BookmarkDestinationXYZ: left top zoom will be generated,

Else, when the format of /Desk is a simply /Fit, nothing new will be generated.


When update_info,

if -> BookmarkDestinationXYZ present from the input file => generate /Dest [3 0 R /XYZ 300.000 792.000 0],

else -> just /Dest [3 0 R /Fit]`


This feature is particularly useful for documents that have multiple things to be in the bookmarks.

The test file cat-refs-refsalt.pdf is such an example, the bookmarks are on different positions of same page.

https://gitlab.com/pdftk-java/pdftk/-/blob/master/test/files/cat-refs-refsalt.pdf


Thank you for saving my time by crafting this nice software!

Edited by shenlebantongying