You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Nghi Nguyen (JIRA)" <ji...@apache.org> on 2011/09/12 22:47:08 UTC

[jira] [Commented] (PDFBOX-493) Ability to get page number for bookmarks

    [ https://issues.apache.org/jira/browse/PDFBOX-493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13103030#comment-13103030 ] 

Nghi Nguyen commented on PDFBOX-493:
------------------------------------

That fixed the problem, Thanks! Would anyone happen to know how to get the bookmarks if you have the object number and generation number?

> 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