API referenceAnnotations

pdfGetAnnotCount

Return the total number of annotations across every page

C
int32_t __stdcall pdfGetAnnotCount(PPDF IPDF);
Delphi
function pdfGetAnnotCount(const IPDF: PPDF): Integer; stdcall;

Purpose. Return the total number of annotations across every page in the document.

Description. Sums CreatedAnnots.Count over every page — not FAnnotByHandle.Count. These two counts can diverge: pdfDeleteAnnotationFromPage (below) removes an annotation from a page's list (decrementing this count) without removing its entry from FAnnotByHandle, so a handle can remain resolvable via pdfGetAnnot for an annotation this count no longer includes.

Parameters.

ParameterDescription
IPDFDocument handle.

Return value. The total per-page annotation count summed across the document; 0 if IPDF is invalid.

See also. pdfGetPageAnnotCount (the current-page-only counterpart).

C# (P/Invoke)

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

Annotations

Exported names

pdfGetAnnotCount

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.