class HexaPDF::Type::Annotations::Ink

Parent
Included Modules

An ink annotation is a markup annotation that displays a freehand “scribble” composed of one or more disjoint paths.

The convenience method add_path can be used to add paths to the annotation.

The style of the scribble can be customized using the convenience methods Annotation#opacity and BorderStyling#border_style (note that only a simple line dash pattern is supported).

Example:

doc.annotations.create_scribble(doc.pages[0]).
  add_path(10, 10, 50, 40, 40, 80, 80, 60).
  add_path(5, 90, 20, 90, 15, 50, 80, 5).
  border_style(color: "hp-blue", width: 2, style: [3, 1]).
  regenerate_appearance

See: PDF2.0 s12.5.6.13, HexaPDF::Type::MarkupAnnotation

Public Instance Methods

add_path → [x0, y0, x1, y1, ...]
add_path(*points) → annot

Adds the path consisting of the given points to the list of paths and returns self.

Adding at least one path is required. Note, however, that without setting the appearance style through convenience methods like border_style nothing will be shown.

Example:

doc.annotations.create_scribble(doc.pages[0]).
  add_path(10, 10, 40, 60, 90, 90).
  regenerate_appearance

paths → [[x00, y00, x01, y01, ...], [x10, y10, x11, y11, ...], ...]

Returns an array with all the paths of this annotation.