API referenceAnnotations

pdfPolygonAnnot

Create a PolyLine (open, /Subtype /PolyLine) or Polygon

C
int32_t __stdcall pdfPolyLineAnnotA(PPDF IPDF, PFltPoint Vertices, uint32_t NumVertices, double LineWidth, TLineEndStyle lStart, TLineEndStyle lEnd, uint32_t FillColor, uint32_t StrokeColor, TPDFColorSpace CS, const char* Author, const char* Subject, const char* Content);
int32_t __stdcall pdfPolygonAnnotA(PPDF IPDF, PFltPoint Vertices, uint32_t NumVertices, double LineWidth, uint32_t FillColor, uint32_t StrokeColor, TPDFColorSpace CS, const char* Author, const char* Subject, const char* Content);
Delphi
function pdfPolyLineAnnotA(const IPDF: PPDF; Vertices: PFltPoint; NumVertices: Cardinal; LineWidth: Double; lStart, lEnd: TLineEndStyle; FillColor, StrokeColor: Cardinal; CS: TPDFColorSpace; const Author, Subject, Content: PAnsiChar): Integer; stdcall;
function pdfPolygonAnnotA(const IPDF: PPDF; Vertices: PFltPoint; NumVertices: Cardinal; LineWidth: Double; FillColor, StrokeColor: Cardinal; CS: TPDFColorSpace; const Author, Subject, Content: PAnsiChar): Integer; stdcall;

Purpose. Create a PolyLine (open, /Subtype /PolyLine) or Polygon (closed, /Subtype /Polygon) annotation from an arbitrary vertex list.

Description. Both are the literal same underlying function (AddPolyAnnot) with a boolean IsPolyline discriminator. pdfPolyLineAnnot's lStart/lEnd are also dropped at creation — same pattern as pdfLineAnnot above; use pdfSetAnnotLineEndStyle afterward (PolyLine annotations support /LE too, per the PDF spec, though this chapter did not independently re-verify that the setter's underlying implementation special-cases PolyLine vs Line targets).

Parameters.

ParameterDescription
IPDFDocument handle.
Vertices, NumVerticesPolygon/polyline vertex list.
LineWidthStroke width.
lStart, lEnd*(PolyLine only)* Accepted but dropped — same as pdfLineAnnot.
FillColor, StrokeColorPacked colors (CS dropped, always RGB).
Author, Subject, Content/T, /Subj, /Contents.

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

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfPolygonAnnotA(IntPtr IPDF, IntPtr Vertices, uint NumVertices, double LineWidth, uint FillColor, uint StrokeColor, TPDFColorSpace CS, [MarshalAs(UnmanagedType.LPStr)] string Author, [MarshalAs(UnmanagedType.LPStr)] string Subject, [MarshalAs(UnmanagedType.LPStr)] string Content);
public static extern int pdfPolygonAnnotW(IntPtr IPDF, IntPtr Vertices, uint NumVertices, double LineWidth, uint FillColor, uint StrokeColor, TPDFColorSpace CS, [MarshalAs(UnmanagedType.LPWStr)] string Author, [MarshalAs(UnmanagedType.LPWStr)] string Subject, [MarshalAs(UnmanagedType.LPWStr)] string Content);
Area
Annotations
Category

Core

Exported names

pdfPolygonAnnotA pdfPolygonAnnotW

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.