API referenceAnnotations

pdfGetPageAnnotCount

Enumerate the annotations on whichever page is currently

C
BOOL32 __stdcall pdfGetPageAnnot(PPDF IPDF, uint32_t Index, TPDFAnnotation* Annot);
BOOL32 __stdcall pdfGetPageAnnotEx(PPDF IPDF, uint32_t Index, TPDFAnnotationEx* Annot);
int32_t __stdcall pdfGetPageAnnotCount(PPDF IPDF);
Delphi
function pdfGetPageAnnot(const IPDF: PPDF; Index: Cardinal; var Annot: TPDFAnnotation): LongBool; stdcall;
function pdfGetPageAnnotEx(const IPDF: PPDF; Index: Cardinal; var Annot: TPDFAnnotationEx): LongBool; stdcall;
function pdfGetPageAnnotCount(const IPDF: PPDF): Integer; stdcall;

Purpose. Enumerate the annotations on whichever page is currently open, by 0-based index.

Description. All three operate against FCurrentPageIdx's own CreatedAnnots list — no handle is involved. pdfGetPageAnnot derives AnnotType directly from the annotation dict's /Subtype name (a small, explicit mapping: TextatText, LinkatWebLink, SquareatSquare, CircleatCircle, LineatLine, WidgetatWidget, anything else →atUnknown) and reads /Rect for the bounding box, rather than consulting FAnnotByHandle at all — this type-name mapping is noticeably narrower than the full TAnnotType enum (no explicit case for Highlight/Ink/Polygon/Stamp/FreeText/etc — all of those fall through to atUnknown via this specific lookup path, even though dedicated creator functions for them exist elsewhere in this volume).

Parameters.

ParameterDescription
IPDFDocument handle.
Index0-based index into the current page's annotation list.
AnnotOutput: type (narrow /Subtype-name mapping — see above) and bounding box.

Return value. pdfGetPageAnnot/Ex: True if Index is in range for the current page; False if there is no current page or Index is out of bounds. pdfGetPageAnnotCount: the current page's annotation count; 0 if no page is open.

See also. pdfGetAnnot (the unrelated, handle-based mechanism — its type resolution is a fuller, separate code path and does not share this narrower mapping).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetPageAnnotCount(IntPtr IPDF);
Area
Annotations
Category

Getters

Exported names

pdfGetPageAnnotCount

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.