API referenceForms

pdfSetFieldIndex

Get/set a field's position in the AcroForm /Fields array

C
int32_t __stdcall pdfGetFieldIndex(PPDF IPDF, uint32_t AField);
BOOL32 __stdcall pdfSetFieldIndex(PPDF IPDF, uint32_t AField, uint32_t Index);
BOOL32 __stdcall pdfSortFieldsByIndex(PPDF IPDF);
BOOL32 __stdcall pdfSortFieldsByName(PPDF IPDF);
Delphi
function pdfGetFieldIndex(const IPDF: PPDF; AField: Cardinal): Integer; stdcall;
function pdfSetFieldIndex(const IPDF: PPDF; AField, Index: Cardinal): LongBool; stdcall;
function pdfSortFieldsByIndex(const IPDF: PPDF): LongBool; stdcall;
function pdfSortFieldsByName(const IPDF: PPDF): LongBool; stdcall;

Purpose. Get/set a field's position in the AcroForm /Fields array (governing tab order and serialization order), and bulk-reorder every field either by the currently-tracked index values or alphabetically by name.

Parameters.

ParameterDescription
IPDFDocument handle.
AFieldTarget field handle.
Index*(Set only)* New /Fields array position.

Return value. pdfGetFieldIndex: the field's current position; -1 if IPDF is invalid. pdfSetFieldIndex/pdfSortFieldsByIndex/ pdfSortFieldsByName: True on success.

C# (P/Invoke)

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

Forms

Exported names

pdfSetFieldIndex

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.