AddPolyLineAnnotation

Annotations and hotspot links

Description

Adds an open polyline markup annotation (PDF /Subtype /PolyLine) to the selected page with the supplied vertex list. The polyline is open — readers do not connect the last vertex back to the first — and can carry different end-line styles at each terminal endpoint. End decorations that have an interior (ClosedArrow, Square, Circle, Diamond) can optionally be filled. Color components and opacity are expressed on a 0–1 scale; Transparency is given on a 0–100 scale (0 = fully opaque, 100 = fully transparent). The library bumps the document version to PDF 1.5 when a PolyLine annotation is emitted under a lower minimum-version lock. Defined in ISO 32000-1 §12.5.6.9.

Syntax

int AddPolyLineAnnotation(wchar_t * VertexCoords, double BorderWidth, double LineRed, double LineGreen, double LineBlue, int StartStyle, int EndStyle, int Filled, double FillRed, double FillGreen, double FillBlue, wchar_t * Title, wchar_t * Contents, int Transparency);

Parameters

VertexCoords — Vertex coordinates as a single string of alternating x/y values separated by spaces, commas, semicolons, or tabs. Example: "100 100 200 150 300 100" defines a V shape. Requires at least two pairs (four numbers) and an even total count of numbers, otherwise the call returns 0.

BorderWidth — Stroke width of the polyline and its end decorations, in current units.

LineRed, LineGreen, LineBlue — RGB components (0–1) of the line color, written into /C.

StartStyle, EndStyle — End-line styles for the first and last vertices respectively. Use one of:

0 = None, 1 = Square, 2 = Circle, 3 = Diamond, 4 = OpenArrow, 5 = ClosedArrow, 6 = Butt, 7 = ROpenArrow, 8 = RClosedArrow, 9 = Slash.

Out-of-range values clamp to 0 (None).

Filled — 1 to emit an interior fill color (/IC) for the end decorations, 0 to leave them unfilled.

FillRed, FillGreen, FillBlue — RGB components (0–1) of the end-decoration interior fill color. Ignored when Filled is 0.

Title — Author name written into the annotation's /T entry. Pass an empty string to skip.

Contents — Body of the popup associated with the annotation. Pass an empty string to skip.

Transparency — Opacity expressed as percentage transparent (0–100). The library converts this to PDF /CA = 1 - Transparency/100 and clamps to range.

Return Value

1 on success, 0 if no document is selected, the vertex string fails to parse, or the annotation could not be created.

Remarks

The annotation /Rect is computed automatically from the vertex extent plus a padding proportional to the border width so end decorations remain inside the annotation bounding box.

Optional advanced fields described by the PDF specification — /IT (intent, including PolyLineDimension) and /Measure — are not emitted by this entry point. They can be appended after creation by writing them onto the annotation dictionary directly.

To overwrite the line color, border, contents, or rectangle after creation, use SetAnnotBorderColor, SetAnnotBorderStyle, SetAnnotContents, and SetAnnotRect.