# PolyLineAnnotation Class

> A finite number of line segments in a PDF added as an annotation.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PolyLineAnnotation
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class PolyLineAnnotation : Annotation
```

**Namespace:** `datalogics_interface`

**Inherits from:** [`Annotation`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Annotation.md)

## Description

A finite number of line segments in a PDF added as an annotation.

A polyline is also called a polygonal chain or piecewise linear curve. It represents a finite number of line segments where the first and last vertex are not connected. In this case, the polyline is added as an annotation to a PDF file.

**Uses types:** [`AnnotationFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/AnnotationFlags.md), [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md), [`Form`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md), [`LineEndingStyle`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineEndingStyle.md), [`Point`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md), [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

## Constructors

### PolyLineAnnotation

```cpp
datalogics_interface::PolyLineAnnotation::PolyLineAnnotation(Page &page, const Rect &rect, const std::vector< Point > &vertices)
```

*constructor*

**Parameters**

- `page` ([`Page &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Page.md)): The page to which the PolyLineAnnotation is added.
- `rect` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)): A rectangle specifying the annotation's bounds, specified in user space coordinates.
- `vertices` ([`const std::vector< Point > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)): A list of points representing the coordinates of the vertices, specified in user space.

Create a new PolyLineAnnotation at the end of a page's annotation array. To create a PolyLineAnnotation and place it elsewhere in the page's annotation array, use the version of the constructor that takes an array position.

### PolyLineAnnotation

```cpp
datalogics_interface::PolyLineAnnotation::PolyLineAnnotation(Page &page, const Rect &rect, const std::vector< Point > &vertices, int add_after)
```

*constructor*

**Parameters**

- `page` ([`Page &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Page.md)): The page to which the PolyLineAnnotation is added.
- `rect` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)): A rectangle specifying the annotation's bounds, specified in user space coordinates.
- `vertices` ([`const std::vector< Point > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)): A list of points representing the coordinates of the vertices, specified in user space.
- `add_after` (`int`)

Create a new PolyLineAnnotation at the end of a page's annotation array. To create a PolyLineAnnotation and place it elsewhere in the page's annotation array, use the version of the constructor that takes an array position.

### ~PolyLineAnnotation

```cpp
datalogics_interface::PolyLineAnnotation::~PolyLineAnnotation() override
```

*destructor*

## Methods

### clear_interior_color

```cpp
void datalogics_interface::Annotation::clear_interior_color()
```

**Returns:** `void`

Clear the interior color.

### generate_appearance

```cpp
virtual std::unique_ptr< Form > datalogics_interface::Annotation::generate_appearance() const
```

**Returns:** [`std::unique_ptr< Form >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md)

A Form representing the visual appearance, or null if the appearance could not be generated.

Generate a new appearance stream with the current annotation properties.

The resulting Form can then be used to set the annotation's appearance, such as by calling SetNormalAppearance.

### get_annotation_feature_level

```cpp
virtual double datalogics_interface::Annotation::get_annotation_feature_level() const
```

**Returns:** `double`

The minimum PDF version level (e.g. 1.3, 1.4, or 1.5).

The minimum PDF version necessary to support the features used in this annotation.

### get_border_dash_pattern

```cpp
std::vector< double > datalogics_interface::PolyLineAnnotation::get_border_dash_pattern() const
```

**Returns:** `std::vector< double >`

An array defining a pattern of dashes and gaps to be used in drawing a dashed border (border style D).

The dash array is a series of numbers that specify the lengths of alternating dashes and gaps. Lengths must be nonnegative, and are expressed in user space units.

Default value is [3]

### get_border_style

```cpp
std::string datalogics_interface::PolyLineAnnotation::get_border_style() const
```

**Returns:** `std::string`

The border style.

Can be one of: S - Solid D - Dashed. The dash pattern is specified as an array (see DashPattern) B - Beveled I - Inset U - Underline Other border styles may be defined in the future. Default is "S"

### get_border_style_width

```cpp
double datalogics_interface::PolyLineAnnotation::get_border_style_width() const
```

**Returns:** `double`

The border width in points.

If this value is 0, no border is drawn. The default is 1.0.

### get_color

```cpp
Color datalogics_interface::Annotation::get_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

The annotation's color.

The color of the annotation.

### get_contents

```cpp
std::string datalogics_interface::Annotation::get_contents() const
```

**Returns:** `std::string`

The annotation's text contents.

The text contents of the annotation.

The text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form.

### get_end_ending_style

```cpp
LineEndingStyle datalogics_interface::PolyLineAnnotation::get_end_ending_style() const
```

**Returns:** [`LineEndingStyle`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineEndingStyle.md)

The line ending style applied to the last vertex of the polyline.

### get_flags

```cpp
AnnotationFlags datalogics_interface::Annotation::get_flags() const
```

**Returns:** [`AnnotationFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/AnnotationFlags.md)

The annotation's flags.

The flags for the annotation.

### get_interior_color

```cpp
std::unique_ptr< Color > datalogics_interface::Annotation::get_interior_color() const
```

**Returns:** [`std::unique_ptr< Color >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

The interior fill color, or null if no interior color is set.

The interior color with which to fill the annotation's rectangle or circle.

The color of the border itself can be retrieved from Annotation.Color.

### get_normal_appearance

```cpp
std::unique_ptr< Form > datalogics_interface::Annotation::get_normal_appearance() const
```

**Returns:** [`std::unique_ptr< Form >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md)

A Form representing the annotation's normal appearance, or null if no normal appearance has been set.

The normal appearance of the annotation, represented as a Form XObject.

### get_opacity

```cpp
double datalogics_interface::Annotation::get_opacity() const
```

**Returns:** `double`

The opacity value for this annotation.

The constant opacity value used in painting a Markup annotation.

Opacity is a range from 0.0 (fully transparent) to 1.0 (fully opaque).

### get_rect

```cpp
Rect datalogics_interface::Annotation::get_rect() const
```

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

The annotation's bounding rectangle in user space coordinates.

The size and location of the annotation on its page.

### get_start_ending_style

```cpp
LineEndingStyle datalogics_interface::PolyLineAnnotation::get_start_ending_style() const
```

**Returns:** [`LineEndingStyle`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineEndingStyle.md)

The line ending style applied to the first vertex of the polyline.

### get_subtype

```cpp
std::string datalogics_interface::Annotation::get_subtype() const
```

**Returns:** `std::string`

The subtype string (e.g. "Circle", "Square", "Line").

The annotation's subtype.

### get_title

```cpp
std::string datalogics_interface::Annotation::get_title() const
```

**Returns:** `std::string`

The title string.

The title of the annotation.

### get_vertices

```cpp
std::vector< Point > datalogics_interface::PolyLineAnnotation::get_vertices() const
```

**Returns:** [`std::vector< Point >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)

The array of points, in order, that define the vertices of the polyline in user space coordinates.

### has_rich_text_data

```cpp
bool datalogics_interface::Annotation::has_rich_text_data() const
```

**Returns:** `bool`

true if the annotation contains Rich Text String content.

Checks the annotation for Rich Text String content (PDFReference 1.7 Section 8.6.2). Annotations that contain Rich Text String content and do not have a normal appearance set will not be visible when rendering the page.

### operator==

```cpp
bool datalogics_interface::Annotation::operator==(const Annotation &other) const
```

**Parameters**

- `other` ([`const Annotation &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Annotation.md)): The annotation to compare with this annotation.

**Returns:** `bool`

true if the two annotations are equal.

Test annotations for equality (if they are the same annotation).

### set_annotation_feature_level

```cpp
virtual void datalogics_interface::Annotation::set_annotation_feature_level(double level)
```

**Parameters**

- `level` (`double`): The target PDF version level. Features requiring a higher version will be removed.

**Returns:** `void`

Removes features not supported in the supplied version number.

### set_border_dash_pattern

```cpp
void datalogics_interface::PolyLineAnnotation::set_border_dash_pattern(const std::vector< double > &pattern)
```

**Parameters**

- `pattern` (`const std::vector< double > &`): the border style dash pattern

**Returns:** `void`

### set_border_style

```cpp
void datalogics_interface::PolyLineAnnotation::set_border_style(const std::string &style)
```

**Parameters**

- `style` (`const std::string &`): the border style

**Returns:** `void`

### set_border_style_width

```cpp
void datalogics_interface::PolyLineAnnotation::set_border_style_width(double width)
```

**Parameters**

- `width` (`double`): the border style width

**Returns:** `void`

### set_color

```cpp
void datalogics_interface::Annotation::set_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The new color to set.

**Returns:** `void`

The color of the annotation.

### set_contents

```cpp
void datalogics_interface::Annotation::set_contents(const std::string &contents)
```

**Parameters**

- `contents` (`const std::string &`): The new text contents.

**Returns:** `void`

The text contents of the annotation.

The text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form.

### set_end_ending_style

```cpp
void datalogics_interface::PolyLineAnnotation::set_end_ending_style(LineEndingStyle style)
```

**Parameters**

- `style` ([`LineEndingStyle`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineEndingStyle.md)): The line ending style to apply at the end point.

**Returns:** `void`

The line ending style applied to the last vertex of the polyline.

### set_flags

```cpp
void datalogics_interface::Annotation::set_flags(AnnotationFlags flags)
```

**Parameters**

- `flags` ([`AnnotationFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/AnnotationFlags.md)): The new annotation flags to set.

**Returns:** `void`

The flags for the annotation.

### set_interior_color

```cpp
void datalogics_interface::Annotation::set_interior_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The new interior fill color. Pass null to remove the interior color.

**Returns:** `void`

The interior color with which to fill the annotation's rectangle or circle.

Only RGB colors are allowed.

The color of the border itself can be retrieved from Annotation.Color.

### set_normal_appearance

```cpp
void datalogics_interface::Annotation::set_normal_appearance(Form &form)
```

**Parameters**

- `form` ([`Form &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md)): The Form to use as the annotation's normal appearance.

**Returns:** `void`

The normal appearance of the annotation, represented as a Form XObject.

### set_opacity

```cpp
void datalogics_interface::Annotation::set_opacity(double opacity)
```

**Parameters**

- `opacity` (`double`): The new opacity value to set.

**Returns:** `void`

The constant opacity value used in painting a Markup annotation.

Opacity is a range from 0.0 (fully transparent) to 1.0 (fully opaque).

### set_rect

```cpp
void datalogics_interface::Annotation::set_rect(const Rect &rect)
```

**Parameters**

- `rect` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)): The new bounding rectangle in user space coordinates.

**Returns:** `void`

The size and location of the annotation on its page.

### set_start_ending_style

```cpp
void datalogics_interface::PolyLineAnnotation::set_start_ending_style(LineEndingStyle style)
```

**Parameters**

- `style` ([`LineEndingStyle`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineEndingStyle.md)): The line ending style to apply at the start point.

**Returns:** `void`

The line ending style applied to the first vertex of the polyline.

### set_title

```cpp
void datalogics_interface::Annotation::set_title(const std::string &title)
```

**Parameters**

- `title` (`const std::string &`): The new title string.

**Returns:** `void`

The title of the annotation.

### set_vertices

```cpp
void datalogics_interface::PolyLineAnnotation::set_vertices(const std::vector< Point > &vertices)
```

**Parameters**

- `vertices` ([`const std::vector< Point > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)): The array of points, in order, that define the vertices of the polyline in user space coordinates.

**Returns:** `void`

The vertices that define the polyline annotation, in user space.

### to_string

```cpp
std::string datalogics_interface::Annotation::to_string() const
```

**Returns:** `std::string`

A string describing this annotation, including its type and rectangle.

Returns a string representation of this annotation.

### try_as

```cpp
T * datalogics_interface::Annotation::try_as()
```

**Parameters**

- (unnamed) (`typename T`)

**Returns:** `T *`

Attempt to downcast this annotation to a derived type. Returns a pointer to the derived type, or nullptr if the type doesn't match.

### try_as

```cpp
const T * datalogics_interface::Annotation::try_as() const
```

**Parameters**

- (unnamed) (`typename T`)

**Returns:** `const T *`

Const overload of try_as(). Returns a const pointer, or nullptr.
