API referenceAnnotations

pdfTextAnnot

Create a Text ("sticky note") annotation.

C
int32_t __stdcall pdfTextAnnotA(PPDF IPDF, double PosX, double PosY, double Width, double Height, const char* Author, const char* Text, TAnnotIcon Icon, BOOL32 Open);
int32_t __stdcall pdfTextAnnotW(PPDF IPDF, double PosX, double PosY, double Width, double Height, const wchar_t* Author, const wchar_t* Text, TAnnotIcon Icon, BOOL32 Open);
Delphi
function pdfTextAnnotA(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const Author, Text: PAnsiChar; Icon: TAnnotIcon; Open: LongBool): Integer; stdcall;
function pdfTextAnnotW(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const Author, Text: PWideChar; Icon: TAnnotIcon; Open: LongBool): Integer; stdcall;

Purpose. Create a Text ("sticky note") annotation.

Parameters.

ParameterDescription
IPDFDocument handle.
PosX, PosY, Width, HeightIcon placement box.
Author/T author string.
Text/Contents note text.
IconThe /Name icon (Comment, Key, Note, Help, etc).
OpenWhether the popup starts open.

Return value. The new annotation's document-wide handle; 0 if IPDF is invalid or there is no current page.

See also. pdfSetAnnotIcon, pdfSetAnnotOpenState.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfTextAnnotA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string Text, TAnnotIcon Icon, [MarshalAs(UnmanagedType.Bool)] bool Open);
public static extern int pdfTextAnnotW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string Text, TAnnotIcon Icon, [MarshalAs(UnmanagedType.Bool)] bool Open);
Area
Annotations
Category

Core

Exported names

pdfTextAnnotA pdfTextAnnotW

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.