int32_t __stdcall pdfFlattenAnnots(PPDF IPDF, TAnnotFlattenFlags Flags);
function pdfFlattenAnnots(const IPDF: PPDF; Flags: TAnnotFlattenFlags): Integer; stdcall;
Purpose. Flatten every annotation in the document in one call (form fields are not included — see pdfFlattenForm for those).
Description. Iterates every page's CreatedAnnots list, flattens each one, and clears the list — after this call, pdfGetAnnotCount/ pdfGetPageAnnotCount (Annotation Lifecycle and Enumeration) report 0 for every page. Same dropped-parameter finding as pdfFlattenAnnotOrField: Flags is accepted but never consulted — there is no way to selectively exclude certain annotation types or kinds from bulk flattening through this parameter despite its presence.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Flags | Accepted but silently dropped — has no effect. |
Return value. The number of annotations flattened; 0 if IPDF is invalid or none existed.
Remarks. This does not touch form fields (widget annotations backing interactive fields survive this call as fields, though their pure annotation-only counterparts — Text, Highlight, Line, etc — do not). Use pdfFlattenForm separately to flatten form fields.
See also. pdfFlattenAnnotOrField.
C# (P/Invoke)
public static extern int pdfFlattenAnnots(IntPtr IPDF, uint Flags);
Core
pdfFlattenAnnots
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.