API referenceAnnotations

pdfImportPendingAnnots

Materialise annotations that a lazy import has deferred, so

Exported namespdfImportPendingAnnots
Calling conventionstdcall
Thread safetyOne PPDF/handle per thread; see V18 §Threading
IntroducedLumasPDF 2.4.2

Purpose — Materialise annotations that a lazy import has deferred, so their handles become available without touching every page yourself.

Description — When a file is imported with the lazy-annotations import flag (if2LazyAnnots) set, per-page annotations are not carried across at import time. This function pumps that deferred work explicitly: it walks the pages that still have pending annotations, in page order, and imports their annotations — so the resulting annotation handles come out exactly as an eager import would have dealt them. Pages whose annotations are already materialised are skipped.

You never have to call it for correctness: any operation that needs the annotations — annotation counts and lookups, page reordering or deletion, saving, closing the import source — pumps the remainder itself. The export exists so a caller can choose *when* the work happens (an idle loop, a background step) and ask how much is left.

MaxPages selects the mode:

MaxPagesEffect
0Import everything still pending.
> 0Import at most that many pages' worth, then return (call again to continue).
< 0Import nothing; just report how many pages are still pending.

Additionally, setting bit 30 (0x40000000) on a non-negative value makes the call non-blocking: if a render is in flight, the function reports instead of waiting for the render locks.

Parameters

ParameterTypeIn/OutDescription
IPDFPPDFinInstance handle with an imported document.
MaxPagesIntegerinPage budget / mode selector — see the table above.

Return value — The number of pages still pending after the call, in every mode — 0 means the pump is finished. 0 is also returned for an invalid handle, and for a document imported without if2LazyAnnots, where nothing is ever pending.

Declarations

C
LPDF_API SI32 PDF_CALL pdfImportPendingAnnots(PPDF IPDF, SI32 MaxPages);
Delphi
function pdfImportPendingAnnots(const IPDF: PPDF; MaxPages: Integer): Integer; stdcall; external 'LumasPdf.dll';

C# (P/Invoke)

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

Import

Exported names

pdfImportPendingAnnots

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.