Example usage for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDNamedDestination getNamedDestination

List of usage examples for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDNamedDestination getNamedDestination

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDNamedDestination getNamedDestination.

Prototype

public String getNamedDestination() 

Source Link

Document

This will get the name of the destination.

Usage

From source file:org.pdfmetamodifier.OutlineHelper.java

License:Apache License

private static Integer getDestinationPageNumber(final PDDestination destination, final PDPageTree pages,
        final PDDestinationNameTreeNode destinations) throws IOException {
    if (destination != null) {
        if (destination instanceof PDPageDestination) {
            final PDPageDestination pageDestination = (PDPageDestination) destination;

            return getOutlinesPageNumber(pageDestination, pages);
        }//from  w  w  w  .j  a v a 2s  . c  o m

        if (destination instanceof PDNamedDestination) {
            final PDNamedDestination namedDestination = (PDNamedDestination) destination;

            final PDPageDestination pageDestination = destinations
                    .getValue(namedDestination.getNamedDestination());
            return getOutlinesPageNumber(pageDestination, pages);
        }

        // Should not happens.
        throw new RuntimeException(String.format("Unsupported type of bookmark destination: %s!",
                destination.getClass().getName()));
    }

    return null;
}