API referenceAnnotations

pdfFreeTextAnnot

Create a FreeText annotation — text drawn directly on the

C
int32_t __stdcall pdfFreeTextAnnotA(PPDF IPDF, double PosX, double PosY, double Width, double Height, const char* Author, const char* AText, TTextAlign Align);
int32_t __stdcall pdfFreeTextAnnotW(PPDF IPDF, double PosX, double PosY, double Width, double Height, const wchar_t* Author, const wchar_t* AText, TTextAlign Align);
Delphi
function pdfFreeTextAnnotA(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const Author, AText: PAnsiChar; Align: TTextAlign): Integer; stdcall;
function pdfFreeTextAnnotW(const IPDF: PPDF; PosX, PosY, Width, Height: Double; const Author, AText: PWideChar; Align: TTextAlign): Integer; stdcall;

Purpose. Create a FreeText annotation — text drawn directly on the page inside its own bounding box, not a popup note.

Parameters.

ParameterDescription
IPDFDocument handle.
PosX, PosY, Width, HeightText box.
Author, AText/T, /Contents (the visible text).
Align/Q justification (Left/Center/Right — see pdfGetAnnotTextAlign, Annotation Appearance and Properties).

Return value. The new annotation's handle; 0 on failure.

See also. pdfGetAnnotTextAlign.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfFreeTextAnnotA(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string AText, uint Align);
public static extern int pdfFreeTextAnnotW(IntPtr IPDF, double PosX, double PosY, double Width, double Height, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string AText, uint Align);
Area
Annotations
Category

Core

Exported names

pdfFreeTextAnnotA pdfFreeTextAnnotW

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.