pdfGetXFAFormFieldBorderWidth
Get/set a template field's border/edge thickness
double __stdcall pdfGetXFAFormFieldBorderWidthA(PPDF IPDF, const char* Name);
double __stdcall pdfGetXFAFormFieldBorderWidthW(PPDF IPDF, const wchar_t* Name);
int32_t __stdcall pdfSetXFAFormFieldBorderWidthA(PPDF IPDF, const char* Name, double Width);
int32_t __stdcall pdfSetXFAFormFieldBorderWidthW(PPDF IPDF, const wchar_t* Name, double Width);
function pdfGetXFAFormFieldBorderWidthA(const IPDF: PPDF; Name: PAnsiChar): Double; stdcall;
function pdfGetXFAFormFieldBorderWidthW(const IPDF: PPDF; Name: PWideChar): Double; stdcall;
function pdfSetXFAFormFieldBorderWidthA(const IPDF: PPDF; Name: PAnsiChar; Width: Double): Integer; stdcall;
function pdfSetXFAFormFieldBorderWidthW(const IPDF: PPDF; Name: PWideChar; Width: Double): Integer; stdcall;
Purpose. Get/set a template field's border/edge thickness attribute (edge line width).
Description. Verified unit-conversion gap: the getter does not interpret the XFA thickness unit suffix at all. XfaWidthFromThickness scans the stored string (e.g. "1pt", "2.5mm") and simply takes the leading numeric run (0-9, ., -, +) up to the first non-numeric character, discarding everything after — it never checks whether the suffix is pt, mm, cm, or in, so a thickness authored in any non-pt unit is returned as if its bare number were already in points (e.g. "2mm" returns 2.0, not the ~5.67pt that unit would actually represent). The setter has the opposite one-sidedness: it always writes back with a hardcoded pt suffix (Format('%gpt', [Width], InvariantFormatSettings)), so Set → Get round-trips correctly (both sides agree the unit is always points), but reading a template packet authored by another XFA tool using mm/cm/in will silently misinterpret the magnitude.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Name | The template field's name attribute. |
Width | Thickness in points — always written with a pt suffix, regardless of what unit a pre-existing value used. |
Return value. Getter: the thickness (0 if unset, if Name doesn't resolve, or if there is no border/edge chain — all indistinguishable). Setter: 1 on success; 0 if Name doesn't resolve.
C# (P/Invoke)
public static extern double pdfGetXFAFormFieldBorderWidthW(IntPtr IPDF, IntPtr Name);
public static extern double pdfGetXFAFormFieldBorderWidth(IntPtr IPDF, IntPtr Name);
public static extern double pdfGetXFAFormFieldBorderWidthA(IntPtr IPDF, IntPtr Name);
Getters
pdfGetXFAFormFieldBorderWidthW
pdfGetXFAFormFieldBorderWidth
pdfGetXFAFormFieldBorderWidthA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.