API referenceForms

pdfSetFieldTextColor

Set/get the /MK /BG (background), /MK /BC (border), and

C
uint32_t __stdcall pdfGetFieldBackColor(PPDF IPDF);
BOOL32 __stdcall pdfSetFieldBackColor(PPDF IPDF, uint32_t AColor);
uint32_t __stdcall pdfGetFieldBorderColor(PPDF IPDF);
BOOL32 __stdcall pdfSetFieldBorderColor(PPDF IPDF, uint32_t AColor);
uint32_t __stdcall pdfGetFieldTextColor(PPDF IPDF);
BOOL32 __stdcall pdfSetFieldTextColor(PPDF IPDF, uint32_t Color);
Delphi
function pdfGetFieldBackColor(const IPDF: PPDF): Cardinal; stdcall;
function pdfSetFieldBackColor(const IPDF: PPDF; AColor: Cardinal): LongBool; stdcall;
function pdfGetFieldBorderColor(const IPDF: PPDF): Cardinal; stdcall;
function pdfSetFieldBorderColor(const IPDF: PPDF; AColor: Cardinal): LongBool; stdcall;
function pdfGetFieldTextColor(const IPDF: PPDF): Cardinal; stdcall;
function pdfSetFieldTextColor(const IPDF: PPDF; Color: Cardinal): LongBool; stdcall;

Purpose. Set/get the /MK /BG (background), /MK /BC (border), and /DA text colors of the most recently created field — see the chapter-level cursor note above.

Description. Each setter both writes the color to the actual field (SetFieldColorH(FCurrentFieldHandle, ...)) and caches it in a separate shadow field (FCurFieldBackColor/BorderColor/TextColor), per an explicit DIFF comment ("also stores state") — the getters read back from these cached shadow fields, not by re-querying the field itself, so if the field's color were somehow changed through another path (e.g. pdfSetFieldColor on the same handle), these getters would report the stale cached value rather than the field's current true color.

Parameters.

ParameterDescription
IPDFDocument handle.
AColor/Color*(Set only)* Packed color, applied to the most-recently-created field.

Return value. Getters: the cached color; 0 if IPDF invalid or no field has been created yet. Setters: True if IPDF valid.

See also. pdfGetFieldColor (the explicit- handle equivalent, for targeting any field).

C# (P/Invoke)

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

Forms

Exported names

pdfSetFieldTextColor

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.