API referenceForms

pdfSetXFAFormFieldAccess

Get/set a template <field>'s access attribute (XFA's

C
const char*    __stdcall pdfGetXFAFormFieldAccessA(PPDF IPDF, const char* Name);
const wchar_t* __stdcall pdfGetXFAFormFieldAccessW(PPDF IPDF, const wchar_t* Name);
int32_t __stdcall pdfSetXFAFormFieldAccessA(PPDF IPDF, const char* Name, const char* Access);
int32_t __stdcall pdfSetXFAFormFieldAccessW(PPDF IPDF, const wchar_t* Name, const wchar_t* Access);
Delphi
function pdfGetXFAFormFieldAccessA(const IPDF: PPDF; Name: PAnsiChar): PAnsiChar; stdcall;
function pdfGetXFAFormFieldAccessW(const IPDF: PPDF; Name: PWideChar): PWideChar; stdcall;
function pdfSetXFAFormFieldAccessA(const IPDF: PPDF; Name, Access: PAnsiChar): Integer; stdcall;
function pdfSetXFAFormFieldAccessW(const IPDF: PPDF; Name, Access: PWideChar): Integer; stdcall;

Purpose. Get/set a template <field>'s access attribute (XFA's per-field access mode — e.g. open, readOnly, protected, nonInteractive).

Description. Name here addresses the template packet, not datasets — the getter/setter both search for the first <field name="Name"> element anywhere in the template packet (LumasXfaFindField, case-insensitive on both the element's local name field and its name attribute), the same GAP-7-style generic-prop-bag mechanism shared with the three border functions below (XfaGetFieldProp/XfaSetFieldProp, keyed by a Prop string — access here). If the access attribute is absent, the getter defaults to 'open' (the XFA spec's own default) rather than reporting failure; this is the one property in the cluster with a non-empty default.

Parameters.

ParameterDescription
IPDFDocument handle.
NameThe template field's name attribute (first match wins if duplicated).
Access*(Set only)* New access-mode string, written verbatim (no validation against the XFA enum).

Return value. Getter: the access string, 'open' if unset, empty if Name doesn't resolve to any template field at all (no template packet, or no matching <field>). Setter: 1 on success (creates the access attribute if absent); 0 if Name doesn't resolve.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfSetXFAFormFieldAccessW(IntPtr IPDF, IntPtr Name, IntPtr Access);
public static extern int pdfSetXFAFormFieldAccess(IntPtr IPDF, IntPtr Name, IntPtr Access);
public static extern int pdfSetXFAFormFieldAccessA(IntPtr IPDF, IntPtr Name, IntPtr Access);
Area
Forms
Category

Setters

Exported names

pdfSetXFAFormFieldAccessW pdfSetXFAFormFieldAccess pdfSetXFAFormFieldAccessA

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.