[
https://issues.apache.org/jira/browse/PDFBOX-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13103377#comment-13103377
]
Maruan Sahyoun commented on PDFBOX-1088:
----------------------------------------
@Adam
Thanks for doing a quick review. I did a very basic although not full test for
the signature which worked fine. As generatePageMap() didn't work at all I also
don't think that it was used.
@Ngi
For a single bookmark entry you can do either
((PDPageDestination)item.getDestination()).findPageNumber()
if the bookmark entry is a PDPageDestination or
COSArray destination = (COSArray) item.getDestination().getCOSObject();
// Get the page reference from the destination
String pageKey = ((COSObject)destination.get(0)).getObjectNumber().intValue() +
"," + ((COSObject)destination.get(0)).getGenerationNumber().intValue();
// get the page number from the page map
int pageNumber = (Integer) document.getPageMap().get(pageKey);
for other Destination types.
You might want to look up the different types in the PDF reference (PDF:1.7,
section: 8.2.1)
> 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, PDDocument.patch,
> TestPDDocumentCatalog.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