InkAnnotation Class Documentation
class InkAnnotation : AnnotationNamespace:datalogics_interface
- Inherits from:
Annotation
Detailed Description
A type of annotation allowing a user to edit a PDF document.
Ink annotations in a PDF file allow a user to work with a PDF document displayed on a screen just as if it were on paper, such as scribbling notes in the margins, or circling or underlining text. These types of annotations require a stylus or pen used on a tablet device.
Uses types
Constructor & Destructor Documentation
InkAnnotation
InkAnnotation(Page & page, const Rect & rect)Parameters
page: Page &The page to which the InkAnnotation is added.
rect: const Rect &A rectangle specifying the annotation's bounds, specified in user space coordinates.
Create a new InkAnnotation at the end of a page's annotation array. To create a InkAnnotation and place it elsewhere in the page's annotation array, use the version of the constructor that takes an array position.
InkAnnotation
InkAnnotation(Page & page, const Rect & rect, int add_after)Parameters
page: Page &The page to which the InkAnnotation is added.
rect: const Rect &A rectangle specifying the annotation's bounds, specified in user space coordinates.
add_after: int
Create a new InkAnnotation at the end of a page's annotation array. To create a InkAnnotation and place it elsewhere in the page's annotation array, use the version of the constructor that takes an array position.
~InkAnnotation
~InkAnnotation()Member Function Documentation
add_scribble
void add_scribble(const std::vector< Point > & scribble)Parameters
scribble: const std::vector< Point > &The array of points, in order, that define the vertices of the scribble in user space coordinates, to add to the ink annotation.
Returns:
voidThe vertices that define one of many scribbles in an ink annotation, in user space.
clear_interior_color
void clear_interior_color()Returns:
voidClear the interior color.
generate_appearance
std::unique_ptr< Form > generate_appearance()Returns:
std::unique_ptr< Form >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
double get_annotation_feature_level()Returns:
doubleThe 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::string get_border_style()Returns:
std::stringThe 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
double get_border_style_width()Returns:
doubleThe border width in points.
If this value is 0, no border is drawn. The default is 1.0.
get_color
Color get_color()Returns:
ColorThe annotation's color.
The color of the annotation.
get_contents
std::string get_contents()Returns:
std::stringThe 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_flags
AnnotationFlags get_flags()Returns:
AnnotationFlagsThe annotation's flags.
The flags for the annotation.
get_interior_color
std::unique_ptr< Color > get_interior_color()Returns:
std::unique_ptr< Color >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
std::unique_ptr< Form > get_normal_appearance()Returns:
std::unique_ptr< Form >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_num_scribbles
int get_num_scribbles()Returns:
intThe number of scribbles in the ink annotation.
The number of scribbles in the ink annotation.
get_opacity
double get_opacity()Returns:
doubleThe 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
Rect get_rect()Returns:
RectThe annotation's bounding rectangle in user space coordinates.
The size and location of the annotation on its page.
get_scribble
std::vector< Point > get_scribble(int index)Parameters
index: intThe index of the scribble to get.
Returns:
std::vector< Point >An array of points, in order, that define the indexed scribble of the ink annotation, in user space coordinates.
get_subtype
std::string get_subtype()Returns:
std::stringThe subtype string (e.g. "Circle", "Square", "Line").
The annotation's subtype.
get_title
std::string get_title()Returns:
std::stringThe title string.
The title of the annotation.
has_rich_text_data
bool has_rich_text_data()Returns:
booltrue 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==
bool operator==(const Annotation & other)Parameters
other: const Annotation &The annotation to compare with this annotation.
Returns:
booltrue if the two annotations are equal.
Test annotations for equality (if they are the same annotation).
remove_scribble
void remove_scribble(int index)Parameters
index: intThe array of points, in order, that define the vertices of the scribble in user space coordinates, to remove from the ink annotation.
Returns:
voidThe vertices that define one of many scribbles in an ink annotation, in user space.
set_annotation_feature_level
void set_annotation_feature_level(double level)Parameters
level: doubleThe target PDF version level. Features requiring a higher version will be removed.
Returns:
voidRemoves features not supported in the supplied version number.
set_border_dash_pattern
void set_border_dash_pattern(const std::vector< double > & pattern)Parameters
pattern: const std::vector< double > &the border style dash pattern
Returns:
voidset_border_style
void set_border_style(const std::string & style)Parameters
style: const std::string &the border style
Returns:
voidset_border_style_width
void set_border_style_width(double width)Parameters
width: doublethe border style width
Returns:
voidset_color
void set_color(const Color & color)Parameters
color: const Color &The new color to set.
Returns:
voidThe color of the annotation.
set_contents
void set_contents(const std::string & contents)Parameters
contents: const std::string &The new text contents.
Returns:
voidThe 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_flags
void set_flags(AnnotationFlags flags)Parameters
flags: AnnotationFlagsThe new annotation flags to set.
Returns:
voidThe flags for the annotation.
set_interior_color
void set_interior_color(const Color & color)Parameters
color: const Color &The new interior fill color. Pass null to remove the interior color.
Returns:
voidThe 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
void set_normal_appearance(Form & form)Parameters
form: Form &The Form to use as the annotation's normal appearance.
Returns:
voidThe normal appearance of the annotation, represented as a Form XObject.
set_opacity
void set_opacity(double opacity)Parameters
opacity: doubleThe new opacity value to set.
Returns:
voidThe 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
void set_rect(const Rect & rect)Parameters
rect: const Rect &The new bounding rectangle in user space coordinates.
Returns:
voidThe size and location of the annotation on its page.
set_title
void set_title(const std::string & title)Parameters
title: const std::string &The new title string.
Returns:
voidThe title of the annotation.
to_string
std::string to_string()Returns:
std::stringA 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.