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);
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.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
AField | Target field handle — any field, not cursor-limited. |
ColorType | 0=background, 1=border, 2=text. |
CS | *(Set only)* Accepted but silently dropped — always RGB. |
Color | The color value. |
ColorSpace | *(Get only)* Output color-space indicator. |
Return value. True if AField resolves; False otherwise.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Forms
pdfSetFieldColor
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.