[ https://issues.apache.org/jira/browse/PDFBOX-493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adam Nichols updated PDFBOX-493: -------------------------------- Attachment: COSArrayList.diff PDDocument.diff These two files enable users of PDFBox to get a page number based on the page's object ID. > 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. - You can reply to this email to add a comment to the issue online.