API referenceAnnotations

pdfInkAnnot

Create an Ink (freehand pen-stroke) annotation from a single

C
int32_t __stdcall pdfInkAnnotA(PPDF IPDF, PFltPoint Points, uint32_t NumPoints, double LineWidth, uint32_t Color, TPDFColorSpace CS, const char* Author, const char* Subject, const char* Content);
int32_t __stdcall pdfInkAnnotW(PPDF IPDF, PFltPoint Points, uint32_t NumPoints, double LineWidth, uint32_t Color, TPDFColorSpace CS, const wchar_t* Author, const wchar_t* Subject, const wchar_t* Content);
Delphi
function pdfInkAnnotA(const IPDF: PPDF; Points: PFltPoint; NumPoints: Cardinal; LineWidth: Double; Color: Cardinal; CS: TPDFColorSpace; const Author, Subject, Content: PAnsiChar): Integer; stdcall;
function pdfInkAnnotW(const IPDF: PPDF; Points: PFltPoint; NumPoints: Cardinal; LineWidth: Double; Color: Cardinal; CS: TPDFColorSpace; const Author, Subject, Content: PWideChar): Integer; stdcall;

Purpose. Create an Ink (freehand pen-stroke) annotation from a single polyline of points.

Description. This creator accepts exactly one stroke (a flat Points/NumPoints array) — the resulting annotation's /InkList has a single sub-array. The multi-stroke ink-list detail (multiple independent pen strokes in one annotation) is read back, not authored, via the Annot.InkList/InkListCount object-descriptor mechanism exposed by pdfGetAnnotEx (Annotation Lifecycle and Enumeration); this chapter did not find a corresponding multi-stroke *creation* entry point elsewhere in the ABI.

Parameters.

ParameterDescription
IPDFDocument handle.
Points, NumPointsThe single stroke's point array.
LineWidthStroke width.
ColorPacked color (CS dropped, always RGB).
Author, Subject, Content/T, /Subj, /Contents.

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

See also. pdfGetAnnotEx (multi-stroke ink-list readback).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfInkAnnotA(IntPtr IPDF, IntPtr Points, uint NumPoints, double LineWidth, uint Color, TPDFColorSpace CS, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string Subject, [MarshalAs(UnmanagedType.LPStr)] string Content);
public static extern int pdfInkAnnotW(IntPtr IPDF, IntPtr Points, uint NumPoints, double LineWidth, uint Color, TPDFColorSpace CS, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string Subject, [MarshalAs(UnmanagedType.LPWStr)] string Content);
Area
Annotations
Category

Core

Exported names

pdfInkAnnotA pdfInkAnnotW

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.