API referenceAnnotations

pdfSetAnnotStrProperty

A generic, tag-indexed property setter trio — despite the

C
int32_t __stdcall pdfSetAnnotIntProperty(PPDF IPDF, int32_t Index, int32_t Tag, int32_t NewValue);
int32_t __stdcall pdfSetAnnotDblProperty(PPDF IPDF, int32_t Index, int32_t Tag, double NewValue);
int32_t __stdcall pdfSetAnnotStrPropertyA(PPDF IPDF, int32_t Index, int32_t Tag, const char* NewValue);
int32_t __stdcall pdfSetAnnotStrPropertyW(PPDF IPDF, int32_t Index, int32_t Tag, const wchar_t* NewValue);
Delphi
function pdfSetAnnotIntProperty(const IPDF: PPDF; Index, Tag, NewValue: Integer): Integer; stdcall;
function pdfSetAnnotDblProperty(const IPDF: PPDF; Index, Tag: Integer; NewValue: Double): Integer; stdcall;
function pdfSetAnnotStrPropertyA(const IPDF: PPDF; Index, Tag: Integer; NewValue: PAnsiChar): Integer; stdcall;
function pdfSetAnnotStrPropertyW(const IPDF: PPDF; Index, Tag: Integer; NewValue: PWideChar): Integer; stdcall;

Purpose. A generic, tag-indexed property setter trio — despite the name Index, this parameter is actually the annotation's document-wide handle (reinterpreted as Cardinal), not a page/list index.

Description. pdfSetAnnotIntProperty's Tag selects one of exactly 3 supported keys — 0/F (flags, the same key as pdfSetAnnotFlagsEx above — a third path to the same data), 1/StructParent, 2/Rotate — any other Tag value fails outright. This chapter did not independently re-verify the full Tag mapping for the Dbl/Str variants beyond confirming they follow the same Handle-via-Index, FAnnotByHandle-lookup pattern; consult SetAnnotDblProp/SetAnnotStrProp in the engine directly for their exact supported Tag values before relying on an untested tag number.

Parameters.

ParameterDescription
IPDFDocument handle.
IndexActually the target annotation's document-wide handle, not an index — misleadingly named in the ABI.
TagSelects which underlying PDF key to write; Int's valid range is confirmed 0..2 (F/StructParent/Rotate).
NewValueThe value to write, typed per variant.

Return value. 1 on success; 0 if Index doesn't resolve to an existing annotation or Tag is unrecognized.

See also. pdfGetAnnotFlags, pdfSetAnnotFlagsEx (alternate paths to Tag=0's /F key).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfSetAnnotStrPropertyW(IntPtr IPDF, int Index, int Tag, IntPtr NewValue);
public static extern int pdfSetAnnotStrProperty(IntPtr IPDF, int Index, int Tag, IntPtr NewValue);
public static extern int pdfSetAnnotStrPropertyA(IntPtr IPDF, int Index, int Tag, IntPtr NewValue);
Area
Annotations
Category

Annotations

Exported names

pdfSetAnnotStrPropertyW pdfSetAnnotStrProperty pdfSetAnnotStrPropertyA

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.