API referenceForms

pdfGetXFAFormFieldBorderColor

Get/set a template field's border/edge/color value —

C
int32_t __stdcall pdfGetXFAFormFieldBorderColorA(PPDF IPDF, const char* Name);
int32_t __stdcall pdfGetXFAFormFieldBorderColorW(PPDF IPDF, const wchar_t* Name);
int32_t __stdcall pdfSetXFAFormFieldBorderColorA(PPDF IPDF, const char* Name, int32_t Color);
int32_t __stdcall pdfSetXFAFormFieldBorderColorW(PPDF IPDF, const wchar_t* Name, int32_t Color);
Delphi
function pdfGetXFAFormFieldBorderColorA(const IPDF: PPDF; Name: PAnsiChar): Integer; stdcall;
function pdfGetXFAFormFieldBorderColorW(const IPDF: PPDF; Name: PWideChar): Integer; stdcall;
function pdfSetXFAFormFieldBorderColorA(const IPDF: PPDF; Name: PAnsiChar; Color: Integer): Integer; stdcall;
function pdfSetXFAFormFieldBorderColorW(const IPDF: PPDF; Name: PWideChar; Color: Integer): Integer; stdcall;

Purpose. Get/set a template field's border/edge/color value — the field widget's edge (border) color, as an RGB triple.

Description. Walks <field name="Name"> → <border> → <edge> → <color value="r,g,b"> (creating the border/edge/color chain on set if missing, via LumasXfaEnsureChild). The XFA "r,g,b" decimal string is converted to/from a packed Integer by XfaColorFromTriple/XfaTripleFromColor: the packing is R | (G shl 8) | (B shl 16) (red in the low byte) — the reverse byte order from the standard 0xRRGGBB convention used by most other color parameters in this SDK (e.g. pdfSetFieldBackColor, Field Appearance and Style). Passing a pdfSetFieldColor-style 0xRRGGBB value here would swap red and blue. If any of r/g/b fails to parse as an integer, or fewer than 3 comma-separated parts are present, XfaColorFromTriple returns -1 (the same sentinel used for "no color found at all") — a genuine parse failure is indistinguishable from an absent color element.

Parameters.

ParameterDescription
IPDFDocument handle.
NameThe template field's name attribute.
ColorRGB packed as **`R \(G shl 8) \(B shl 16)** — not 0xRRGGBB`.

Return value. Getter: the packed color, -1 if Name doesn't resolve, the field has no border/edge/color chain, or the stored value fails to parse. Setter: 1 on success; 0 if Name doesn't resolve.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetXFAFormFieldBorderColorW(IntPtr IPDF, IntPtr Name);
public static extern int pdfGetXFAFormFieldBorderColor(IntPtr IPDF, IntPtr Name);
public static extern int pdfGetXFAFormFieldBorderColorA(IntPtr IPDF, IntPtr Name);
Area
Forms
Category

Getters

Exported names

pdfGetXFAFormFieldBorderColorW pdfGetXFAFormFieldBorderColor pdfGetXFAFormFieldBorderColorA

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.