API referenceForms

pdfSetFormFieldRichTextString

Get/set an arbitrary named string-valued key on a rich-text

C
const char* __stdcall pdfGetFormFieldRichTextStringA(PPDF IPDF, int32_t Index, const char* Key);
const wchar_t* __stdcall pdfGetFormFieldRichTextStringW(PPDF IPDF, int32_t Index, const wchar_t* Key);
int32_t __stdcall pdfSetFormFieldRichTextStringA(PPDF IPDF, int32_t Index, const char* Key, const char* NewValue);
int32_t __stdcall pdfSetFormFieldRichTextStringW(PPDF IPDF, int32_t Index, const wchar_t* Key, const wchar_t* NewValue);
Delphi
function pdfGetFormFieldRichTextStringA(const IPDF: PPDF; Index: Integer; Key: PAnsiChar): PAnsiChar; stdcall;
function pdfGetFormFieldRichTextStringW(const IPDF: PPDF; Index: Integer; Key: PWideChar): PWideChar; stdcall;
function pdfSetFormFieldRichTextStringA(const IPDF: PPDF; Index: Integer; Key, NewValue: PAnsiChar): Integer; stdcall;
function pdfSetFormFieldRichTextStringW(const IPDF: PPDF; Index: Integer; Key, NewValue: PWideChar): Integer; stdcall;

Purpose. Get/set an arbitrary named string-valued key on a rich-text field's associated data (a generic Key-addressed string store, keyed per field, distinct from the field's actual /RV rich-text value itself — this chapter did not independently locate a separate direct /RV getter/setter beyond this generic key mechanism).

Description. Index is again the field's handle. Key's codepage narrowing is applied consistently in both directions for W — read via AnsiString(WideString(Key)), i.e. narrowed to the system default codepage before lookup, so a Key set via A and read via W (or vice versa) round-trips correctly only for codepage-representable key names.

Parameters.

ParameterDescription
IPDFDocument handle.
IndexThe target field's handle.
KeyThe named string key to get/set.
NewValue*(Set only)* The new value.

Return value. Getter: the value (transient buffer); nil if Key doesn't exist. Setter: 1 on success; 0 otherwise.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfSetFormFieldRichTextStringW(IntPtr IPDF, int Index, IntPtr Key, IntPtr NewValue);
public static extern int pdfSetFormFieldRichTextString(IntPtr IPDF, int Index, IntPtr Key, IntPtr NewValue);
public static extern int pdfSetFormFieldRichTextStringA(IntPtr IPDF, int Index, IntPtr Key, IntPtr NewValue);
Area
Forms
Category

Setters

Exported names

pdfSetFormFieldRichTextStringW pdfSetFormFieldRichTextString pdfSetFormFieldRichTextStringA

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.