日期:2014-05-17 浏览次数:20919 次
PDDestination rawDest = null;
PDAction outlineAction = item.getAction();
if (outlineAction instanceof PDActionGoTo) {
rawDest = ((PDActionGoTo)outlineAction).getDestination();
}
PDPageDestination pageDest = null;
if (rawDest instanceof PDNamedDestination) {
PDNamedDestination namedDest = (PDNamedDestination) rawDest;
PDDocumentNameDictionary namesDict = doc.getDocumentCatalog().getNames();
if (namesDict != null) {
PDDestinationNameTreeNode destsTree = namesDict.getDests();
if (destsTree != null) {
pageDest = (PDPageDestination)destsTree.getValue(namedDest.getNamedDestination());
}
}
} else if (rawDest instanceof PDPageDestination) {
pageDest = (PDPageDestination) rawDest;
}
System.out.println(pageDest.findPageNumber());