API referenceForms

pdfSetTextFieldValueEx

Set a text field's /V value.

C
BOOL32 __stdcall pdfSetTextFieldValueA(PPDF IPDF, uint32_t Field, const char* Value, const char* DefValue, TTextAlign Align);
BOOL32 __stdcall pdfSetTextFieldValueW(PPDF IPDF, uint32_t Field, const wchar_t* Value, const wchar_t* DefValue, TTextAlign Align);
BOOL32 __stdcall pdfSetTextFieldValueExA(PPDF IPDF, uint32_t Field, const char* Value);
BOOL32 __stdcall pdfSetTextFieldValueExW(PPDF IPDF, uint32_t Field, const wchar_t* Value);
Delphi
function pdfSetTextFieldValueA(const IPDF: PPDF; Field: Cardinal; const Value, DefValue: PAnsiChar; Align: TTextAlign): LongBool; stdcall;
function pdfSetTextFieldValueW(const IPDF: PPDF; Field: Cardinal; const Value, DefValue: PWideChar; Align: TTextAlign): LongBool; stdcall;
function pdfSetTextFieldValueExA(const IPDF: PPDF; Field: Cardinal; const Value: PAnsiChar): LongBool; stdcall;
function pdfSetTextFieldValueExW(const IPDF: PPDF; Field: Cardinal; const Value: PWideChar): LongBool; stdcall;

Purpose. Set a text field's /V value.

Description. Verified: pdfSetTextFieldValue's DefValue and Align parameters are both silently dropped — only Value reaches SetTextFieldValue; the field's /DV default value and text alignment are never touched by this call despite the ABI shape strongly implying both are settable here (alignment must instead be set separately via pdfSetFieldTextAlign, Field Appearance and Style). With those two parameters inert, pdfSetTextFieldValue and pdfSetTextFieldValueEx become functionally identical — both ultimately call the exact same SetTextFieldValue(Field, Value) with nothing else.

Parameters.

ParameterDescription
IPDFDocument handle.
FieldTarget field handle.
ValueThe new /V value — the only parameter that actually takes effect.
DefValue*(plain only)* Accepted but silently dropped.
Align*(plain only)* Accepted but silently dropped — use pdfSetFieldTextAlign instead.

Return value. True if Field resolves; False otherwise.

See also. pdfSetFieldTextAlign.

C# (P/Invoke)

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

Setters

Exported names

pdfSetTextFieldValueExA pdfSetTextFieldValueExW

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.