HitTestAnnotation

Annotations, Interaction

Description

Returns the 1-based index of the topmost annotation at a point on the selected page

The test uses QuadPoints for markup, segment distance for Line, PolyLine and Ink, polygon fill or edges, ellipse geometry for Circle and rectangle geometry for other subtypes

Syntax

Function TPDFlib.HitTestAnnotation(X, Y, Tolerance: Double; Options: Integer): Integer;

Parameters

X, YPoint in the current document unit and origin convention
ToleranceAdditional hit radius in current document units, or 0 for exact geometry
OptionsBit 1 includes Invisible, Hidden and NoView annotations; bit 2 includes Popup annotations; bit 4 uses bounding rectangles only

Return values

The topmost 1-based annotation index, or 0 when no eligible annotation is hit

Remarks

Later entries in the page Annots array are treated as higher Z order and tested first; the rectangle is checked before subtype geometry so sparse pages and misses avoid detailed path work

See also

GetAnnotationHitsJSON, MoveAnnotationZOrder, GetAnnotRectEx