Example usage for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDPageXYZDestination getPage

List of usage examples for org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination PDPageXYZDestination getPage

Introduction

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

Prototype

public PDPage getPage() 

Source Link

Document

This will get the page for this destination.

Usage

From source file:org.xwiki.test.misc.PDFTest.java

License:Open Source License

private String getDestinationText(PDPageXYZDestination destination) throws Exception {
    PDFTextStripperByArea stripper = new PDFTextStripperByArea();
    stripper.addRegion("destination", getRectangleBelowDestination(destination));
    stripper.extractRegions(destination.getPage());
    return stripper.getTextForRegion("destination").trim();
}

From source file:org.xwiki.test.misc.PDFTest.java

License:Open Source License

private Rectangle2D getRectangleBelowDestination(PDPageXYZDestination destination) {
    PDPage page = destination.getPage();
    PDRectangle pageSize = page.getMediaBox();
    float x = destination.getLeft();
    float y = pageSize.getHeight() - destination.getTop();
    float width = pageSize.getWidth();
    float height = destination.getTop();
    return new Rectangle2D.Float(x, y, width, height);
}