LineAnnotation Class Documentation

classLineAnnotation : Annotation

Namespace:datalogics_interface

Inherits from:
Annotation

Detailed Description

When opened it displays a pop-up window containing the text of an associated note, placed at specific x/y coordinates for starting and ending points of the line.

Constructor & Destructor Documentation

LineAnnotation

LineAnnotation(Page &page, const Rect &rect, const Point &start_point, const Point &end_point)

Parameters

page: Page &

The page to which the LineAnnotation is added.

rect: const Rect &

A rectangle specifying the annotation's bounds, specified in user space coordinates.

start_point: const Point &

The starting coordinate of the line, in user space.

end_point: const Point &

The ending coordinate of the line, in user space.

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

LineAnnotation

LineAnnotation(Page &page, const Rect &rect, const Point &start_point, const Point &end_point, intadd_after)

Parameters

page: Page &

The page to which the LineAnnotation is added.

rect: const Rect &

A rectangle specifying the annotation's bounds, specified in user space coordinates.

start_point: const Point &

The starting coordinate of the line, in user space.

end_point: const Point &

The ending coordinate of the line, in user space.

add_after: int

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

~LineAnnotation

~LineAnnotation()

Member Function Documentation

clear_interior_color

voidclear_interior_color()

Returns:

void

Clear the interior color.

generate_appearance

std::unique_ptr< Form >generate_appearance()

Returns:

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

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

get_annotation_feature_level

doubleget_annotation_feature_level()

Returns:

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

std::vector< double >get_border_dash_pattern()

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

std::stringget_border_style()

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

doubleget_border_style_width()

Returns:

double

The border width in points.

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

get_color

Colorget_color()

Returns:

The annotation's color.

The color of the annotation.

get_contents

std::stringget_contents()

Returns:

The annotation's text contents.

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

LineEndingStyleget_end_ending_style()

Returns:

LineEndingStyle

The ending style applied to the end point of the line (for example, an arrowhead, circle, or square).

get_end_point

Pointget_end_point()

Returns:

Point

The ending coordinate of the line, in user space.

If the line has leader lines, the end point represents the ending point of the leader line rather than the line itself.

get_flags

AnnotationFlagsget_flags()

Returns:

The annotation's flags.

The flags for the annotation.

get_interior_color

std::unique_ptr< Color >get_interior_color()

Returns:

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

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

get_normal_appearance

std::unique_ptr< Form >get_normal_appearance()

Returns:

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

doubleget_opacity()

Returns:

The opacity value for this annotation.

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

get_rect

Rectget_rect()

Returns:

The annotation's bounding rectangle in user space coordinates.

The size and location of the annotation on its page.

get_start_ending_style

LineEndingStyleget_start_ending_style()

Returns:

LineEndingStyle

The ending style applied to the start point of the line (for example, an arrowhead, circle, or square).

get_start_point

Pointget_start_point()

Returns:

Point

The starting coordinate of the line, in user space.

If the line has leader lines, the start point represents the starting point of the leader line rather than the line itself.

get_subtype

std::stringget_subtype()

Returns:

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

The annotation's subtype.

get_title

std::stringget_title()

Returns:

The title string.

The title of the annotation.

has_rich_text_data

boolhas_rich_text_data()

Returns:

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==

booloperator==(const Annotation &other)

Parameters

other: const Annotation &

The annotation to compare with this annotation.

Returns:

true if the two annotations are equal.

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

set_annotation_feature_level

voidset_annotation_feature_level(doublelevel)

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

voidset_border_dash_pattern(const std::vector< double > &pattern)

Parameters

pattern: const std::vector< double > &

the border style dash pattern

Returns:

void

set_border_style

voidset_border_style(const std::string &style)

Parameters

style: const std::string &

the border style

Returns:

void

set_border_style_width

voidset_border_style_width(doublewidth)

Parameters

width: double

the border style width

Returns:

void

set_color

voidset_color(const Color &color)

Parameters

color: const Color &

The new color to set.

Returns:

void

The color of the annotation.

set_contents

voidset_contents(const std::string &contents)

Parameters

contents: const std::string &

The new text contents.

Returns:

void

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

voidset_end_ending_style(LineEndingStylestyle)

Parameters

style: LineEndingStyle

the ending style applied to the end point of the line (for example, an arrowhead, circle, or square)

Returns:

void

The ending style applied to the end point of the line (for example, an arrowhead, circle, or square).

set_end_point

voidset_end_point(const Point &p)

Parameters

p: const Point &

the ending coordinate of the line, in user space

Returns:

void

The ending coordinate of the line, in user space.

If the line has leader lines, the end point represents the ending point of the leader line rather than the line itself.

set_interior_color

voidset_interior_color(const Color &color)

Parameters

color: const Color &

The new interior fill color. Pass null to remove the interior color.

Returns:

void

Only RGB colors are allowed.

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

set_normal_appearance

voidset_normal_appearance(Form &form)

Parameters

form: Form &

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

voidset_opacity(doubleopacity)

Parameters

opacity: double

The new opacity value to set.

Returns:

void

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

set_rect

voidset_rect(const Rect &rect)

Parameters

rect: const Rect &

The new bounding rectangle in user space coordinates.

Returns:

void

The size and location of the annotation on its page.

set_start_ending_style

voidset_start_ending_style(LineEndingStylestyle)

Parameters

style: LineEndingStyle

the ending style applied to the start point of the line (for example, an arrowhead, circle, or square)

Returns:

void

The ending style applied to the start point of the line (for example, an arrowhead, circle, or square).

set_start_point

voidset_start_point(const Point &p)

Parameters

p: const Point &

the starting coordinate of the line, in user space

Returns:

void

The starting coordinate of the line, in user space.

If the line has leader lines, the start point represents the starting point of the leader line rather than the line itself.

set_title

voidset_title(const std::string &title)

Parameters

title: const std::string &

The new title string.

Returns:

void

The title of the annotation.

to_string

std::stringto_string()

Returns:

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

Returns a string representation of this annotation.

try_as

T *try_as(typename T)

Parameters

: 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

const T *try_as(typename T)

Parameters

: typename T

Returns:

const T *

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