API referenceForms

pdfGetFieldEx2

Read a field's full metadata by document-wide handle

C
BOOL32 __stdcall pdfGetField(PPDF IPDF, uint32_t Handle, TPDFField* Field);
BOOL32 __stdcall pdfGetFieldEx(PPDF IPDF, uint32_t Handle, TPDFFieldEx* Field);
BOOL32 __stdcall pdfGetFieldEx2(void* IField, TPDFFieldEx* Field);
int32_t __stdcall pdfGetFieldCount(PPDF IPDF);
Delphi
function pdfGetField(const IPDF: PPDF; Handle: Cardinal; var Field: TPDFField): LongBool; stdcall;
function pdfGetFieldEx(const IPDF: PPDF; Handle: Cardinal; var Field: TPDFFieldEx): LongBool; stdcall;
function pdfGetFieldEx2(IField: Pointer; var Field: TPDFFieldEx): LongBool; stdcall;
function pdfGetFieldCount(const IPDF: PPDF): Integer; stdcall;

Purpose. Read a field's full metadata by document-wide handle (pdfGetField/pdfGetFieldEx) or by a previously-minted field-object handle (pdfGetFieldEx2, resolving one of pdfGetFieldEx's own Field.Parent/self-reference outputs — see below).

Description. pdfGetFieldEx mints three kinds of GAP-7 object handles into its output, per an inline source comment describing it as the "producer": Field.IBarcode (only for barcode-bearing fields, via pdfCreateBarcodeField/E01), Field.Parent (the parent field's object handle — and, notably, for a root field with no parent, mints a self-referential handle pointing at the field itself, specifically so pdfGetFieldEx2 can be called uniformly on any field's Parent output without special-casing the root case), and an accurate Field.KidCount. pdfGetFieldEx2 is the consumer half — it resolves an IField object handle (typically one obtained from another field's Field.Parent) back through the same GetFieldExByHandleH filler. pdfGetField's Field.Value assignment does not check QueryTextFieldValue's own success/failure return — the value pointer is used regardless of whether the query actually found a value, per the source's own if D.QueryTextFieldValue(Handle, vp, dvp) then ; (a bare then ; deliberately discards the boolean result).

Parameters.

ParameterDescription
IPDFDocument handle.
Handle*(GetField/GetFieldEx)* Document-wide field handle.
IField*(GetFieldEx2)* A field-object handle from another call's Parent output.
FieldOutput struct — see description for the Ex-only Parent/KidCount/IBarcode enrichment.

Return value. True if the target resolves to an existing field; False otherwise. pdfGetFieldCount: total field count; 0 if IPDF invalid.

See also. pdfGetPageField (the unrelated, index-based enumeration mechanism).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Forms
Category

Forms

Exported names

pdfGetFieldEx2

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.