Adam,
Thanks for your help.
I have to let go of this one for now and attack it again when I actually have
to use the
page number to jump from a selected lucene-search result.
When I ignore PDAction and getDestination() and just use
findDestinationPage(doc)
I get what I call the Sheet #, which is not the number that you would see on
the printed
page, nor is it the number that would appear in the TOC but it will probably
work for
jumping to the correct location.
Thanks again for all you help,
Tim
Reference: org.apache.pdfbox.examples.pdmodel.PrintBookmarks.java
PDOutlineItem current = bookmark.getFirstChild();
Integer pageNum = null;
while (current != null) {
try {
PDPage pdp = current.findDestinationPage(document);
List allpages = new ArrayList();
document.getDocumentCatalog().getPages().getAllKids(
allpages);
pageNum = allpages.indexOf(pdp) + 1;
} catch (IOException ioe) {
}
System.out.println(indentation + current.getTitle() +
((pageNum != null)? " ... page[ " + pageNum + " ]" : "" ) );
printBookmark(current, indentation + " ");
current = current.getNextSibling();
}