pdfGetPageAnnotCount
Enumerate the annotations on whichever page is currently
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);
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: Text→atText, Link→atWebLink, Square→atSquare, Circle→atCircle, Line→atLine, Widget→atWidget, 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.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Index | 0-based index into the current page's annotation list. |
Annot | Output: 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)
public static extern int pdfGetPageAnnotCount(IntPtr IPDF);
Getters
pdfGetPageAnnotCount
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.