API referenceForms

pdfGetFormFieldCaption

Read a button/widget field's /MK /CA (normal caption) —

C
const char* __stdcall pdfGetFormFieldCaptionA(PPDF IPDF, int32_t Index);
const wchar_t* __stdcall pdfGetFormFieldCaptionW(PPDF IPDF, int32_t Index);
const char* __stdcall pdfGetFormFieldCaptionExA(PPDF IPDF, int32_t Index, int32_t StringType);
const wchar_t* __stdcall pdfGetFormFieldCaptionExW(PPDF IPDF, int32_t Index, int32_t StringType);
Delphi
function pdfGetFormFieldCaptionA(const IPDF: PPDF; Index: Integer): PAnsiChar; stdcall;
function pdfGetFormFieldCaptionW(const IPDF: PPDF; Index: Integer): PWideChar; stdcall;
function pdfGetFormFieldCaptionExA(const IPDF: PPDF; Index, StringType: Integer): PAnsiChar; stdcall;
function pdfGetFormFieldCaptionExW(const IPDF: PPDF; Index, StringType: Integer): PWideChar; stdcall;

Purpose. Read a button/widget field's /MK /CA (normal caption) — pdfGetFormFieldCaptionEx additionally selects among alternate caption kinds (StringType — e.g. /CA normal, /RC rollover, /AC down, per the standard PDF push-button appearance-characteristics trio) instead of only the normal caption.

Description. Index is again the field's handle, matching the convention above. The plain form always passes StringType = 0 to the same underlying GetFieldCaptionBytes.

Parameters.

ParameterDescription
IPDFDocument handle.
IndexThe target field's handle.
StringType*(Ex only)* Which caption variant (0=normal, and others per the /MK rollover/down convention).

Return value. The caption text (transient buffer); nil/empty if Index doesn't resolve.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern IntPtr pdfGetFormFieldCaptionW(IntPtr IPDF, int Index);
public static extern IntPtr pdfGetFormFieldCaption(IntPtr IPDF, int Index);
public static extern IntPtr pdfGetFormFieldCaptionA(IntPtr IPDF, int Index);
Area
Forms
Category

Getters

Exported names

pdfGetFormFieldCaptionW pdfGetFormFieldCaption pdfGetFormFieldCaptionA

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.