[
https://issues.apache.org/jira/browse/PDFBOX-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13093153#comment-13093153
]
Maruan Sahyoun commented on PDFBOX-1088:
----------------------------------------
Nghi,
getPageMap is generating a map of all pages not only for the pages with a
bookmark pointing to it. You can then use the map to get the page number of the
page a bookmark is pointing to as the reference in the bookmark will be the
objectnumber and generation number not the page number.
Adam,
I had the same issue Nghi had which is a ClassCastException for PDPage to
COSObject. The object handled is a PDPage at least that's what
getClass().getName() said. Unfortunately I didn't check against earlier
versions of PDFBox which I just did now. So the bug was introduced in version
1.6.0. Version 1.5.0 works fine. So I think you're right - it might be a
parsing issue introduced in 1.6.0. The test document I was using is the pdf
reference 1.7. So instead of applying the patch the parsing issue - if it
proves to be one - should be fixed. I can start to look into that mid next week
at the earliest.
Sorry for the confusion I might have caused.
> Class PDDocument Method getPageMap returns a ClassCastException
> ---------------------------------------------------------------
>
> Key: PDFBOX-1088
> URL: https://issues.apache.org/jira/browse/PDFBOX-1088
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.6.0
> Environment: Windows XP
> Reporter: Nghi Nguyen
> Fix For: 1.7.0
>
> Attachments: PDDocument.patch
>
>
> Trying to get the map of bookmarks to page numbers by using method getPageMap
> but throws a java.lang.ClassCastException: org.apache.pdfbox.pdmodel.PDPage
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira