API referenceForms

pdfGetFieldColor

Get/set any field's background/border/text color by

C
BOOL32 __stdcall pdfGetFieldColor(PPDF IPDF, uint32_t AField, int32_t ColorType, int32_t* ColorSpace, uint32_t* Color);
BOOL32 __stdcall pdfSetFieldColor(PPDF IPDF, uint32_t AField, int32_t ColorType, int32_t CS, uint32_t Color);
Delphi
function pdfGetFieldColor(const IPDF: PPDF; AField: Cardinal; ColorType: Integer; var ColorSpace: Integer; var Color: Cardinal): LongBool; stdcall;
function pdfSetFieldColor(const IPDF: PPDF; AField: Cardinal; ColorType: Integer; CS: Integer; Color: Cardinal): LongBool; stdcall;

Purpose. Get/set any field's background/border/text color by explicit handle — the generalized counterpart of the cursor-based color functions above, usable against any field, not just the most recently created one.

Description. ColorType selects which of the three colors (0=background, 1=border, 2=text — matching the same numbering the cursor-based functions use internally). pdfSetFieldColor's CS parameter is accepted by the ABI but never passed through to SetFieldColorH — same dropped-color-space pattern already confirmed for pdfSetAnnotColor (Annotation Appearance and Properties); colors are always stored as RGB regardless of CS.

Parameters.

ParameterDescription
IPDFDocument handle.
AFieldTarget field handle — any field, not cursor-limited.
ColorType0=background, 1=border, 2=text.
CS*(Set only)* Accepted but silently dropped — always RGB.
ColorThe color value.
ColorSpace*(Get only)* Output color-space indicator.

Return value. True if AField resolves; False otherwise.

C# (P/Invoke)

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

Forms

Exported names

pdfGetFieldColor

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.