API referenceRendering & Viewer

rasSelectAnnotOrField

Select a specific annotation or field by handle

C
TUpdBmkAction __stdcall rasSelectAnnotOrField(IPGC CachePtr, uint32_t Handle, BOOL32 IsField, uint32_t SelColor, float* NewX, float* NewY, float* NewZoom, TPDFPageScale* NewPageScale);
Delphi
function rasSelectAnnotOrField(CachePtr: IPGC; Handle: Cardinal; IsField: LongBool; SelColor: Cardinal; var NewX, NewY, NewZoom: Single; var NewPageScale: TPDFPageScale): TUpdBmkAction; stdcall;

Purpose. Select a specific annotation or field by handle (rather than by hit-testing a point) — sets the marquee selection to that object's rectangle so rasGetSelRect/rasGetSelectionPath report it.

Description. Resolves Handle's bounding box (GetAnnotBBoxH — the same lookup used regardless of IsField, meaning this function does not actually branch its resolution logic on IsField despite the parameter existing) and converts it to device pixels using the current page's zoom/scroll/border state (the same accumulation pattern used throughout Page Navigation, Layout, and Geometry/E04), then sets C.SelAX/AY/BX/BY and C.SelectionMode (2 for IsField, 1 for an annotation — IsField is consulted here, just for the mode tag, not the lookup). Verified: NewX, NewY, NewZoom, and NewPageScale — all declared as var/output parameters, strongly suggesting this function also reports a navigation target (e.g. "scroll/zoom here to see the selected object", matching the bookmark-execution pattern of rasExecBookmark below) — are never written anywhere in the body. A caller relying on these outputs to navigate to the newly-selected object will get whatever value it originally passed in, not a real destination.

Parameters.

ParameterDescription
CachePtrTarget page cache.
HandleThe annotation/field handle to select.
IsFieldOnly affects the stored SelectionMode tag (1/2); the bounding-box lookup itself is identical either way.
SelColorAccepted; not observed to be consulted (same as rasSelectObject).
NewX, NewY, NewZoom, NewPageScaleDeclared as outputs but never written.

Return value. TUpdBmkAction(1) if Handle resolved to a real annotation/field on the current page and the selection was applied; TUpdBmkAction(0) otherwise.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern uint rasSelectAnnotOrField(IntPtr CachePtr, uint Handle, [MarshalAs(UnmanagedType.Bool)] bool IsField, uint SelColor, ref float NewX, ref float NewY, ref float NewZoom, ref TPDFPageScale NewPageScale);
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasSelectAnnotOrField

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.