Example usage for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotation isHidden

List of usage examples for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotation isHidden

Introduction

In this page you can find the example usage for org.apache.pdfbox.pdmodel.interactive.annotation PDAnnotation isHidden.

Prototype

public boolean isHidden() 

Source Link

Document

Get the hidden flag.

Usage

From source file:airviewer.AbstractDocumentCommandWrapper.java

License:Apache License

/**
 * This method finds and returns the "last" (upper most) annotation in
 * annotations that contains the specified x and y coordinates
 *
 * @param annotations A list of candidate annotations
 * @param x An X coordinate in the PDF coordinate system
 * @param y A Y coordinate in the PDF coordinate system
 * @return The annotation if any that was found at {x,y} on the page with
 * pageIndex/*from   w  w  w .  j ava  2  s . c  o  m*/
 */
protected PDAnnotation getLastAnnotationAtPoint(List<PDAnnotation> annotations, float x, float y) {
    PDAnnotation result = null;

    for (int i = annotations.size() - 1; i >= 0; --i) {
        PDAnnotation candidate = annotations.get(i);
        if (!candidate.isHidden() && !candidate.isReadOnly()) {
            PDRectangle boundingBox = candidate.getRectangle();

            if (boundingBox.contains(x, y)) {
                return candidate;

            }
        }
    }

    return result;
}