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

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

Introduction

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

Prototype

public boolean isReadOnly() 

Source Link

Document

Get the readOnly 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  av a  2 s.  c  om
 */
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;
}