Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-493

Ability to get page number for bookmarks

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.8.0-incubator
    • PDModel
    • None

    Description

      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).

      Attachments

        1. COSArrayList.diff
          0.6 kB
          Adam Nichols
        2. PDDocument.diff
          5 kB
          Adam Nichols

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            adamnichols Adam Nichols
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment