[
https://issues.apache.org/jira/browse/PDFBOX-493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13103231#comment-13103231
]
Adam Nichols commented on PDFBOX-493:
-------------------------------------
I'm not sure why you would want to do that. First, there may not be a bookmark
for every page, and certainly not for every object. Also, one page could
technically have multiple bookmarks. You could traverse the values in the map
which is generated by generatePageMap(). If you're looking for page numbers of
a particular page object, you'd want to look at the "/Pages" object. That can
be found in the "/Root" node, which is listed in the trailer section. All of
this is from memory, so it may be a little off, but I'm pretty sure that's
right.
> Ability to get page number for bookmarks
> ----------------------------------------
>
> Key: PDFBOX-493
> URL: https://issues.apache.org/jira/browse/PDFBOX-493
> Project: PDFBox
> Issue Type: New Feature
> Components: PDModel
> Reporter: Adam Nichols
> Priority: Minor
> Fix For: 0.8.0-incubator
>
> Attachments: COSArrayList.diff, PDDocument.diff
>
>
> Bookmarks are handled as references (object number and generation number) to
> page objects. Currently, it's not too difficult to get the reference to the
> page ID, and the page is quickly accessible. The problem is that we don't
> know what page number that is, which is a problem in some cases. For example
> if one wanted to split the document based on bookmarks, they would need to
> know how many pages to make each document.
> To solve this in the most efficient manner possible, I feel a Map is in order
> which will store page numbers using object IDs as the keys. This map will be
> loaded once and then can be quickly referenced many times. For the time
> being, the call to generatePageMap() will not happen when a PDF is loaded
> (it'll have to be called explicitly). If people find this very useful and
> not too costly (memory/CPU) it can be moved into the load function so users
> can access it automatically.
> I'll attach the code I've written to do this soon (as soon as I figure out
> how to do so).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira