class HexaPDF:: Layout:: Style:: LinkLayer
Parent | Object |
---|
The LinkLayer
class provides support for linking to in-document or remote destinations for Style
objects using link annotations. Typical use cases would be linking to a (named) destination on a different page or executing a URI action.
See: PDF2.0 s12.5.6.5, Layers
, HexaPDF::Type::Annotations::Link
Public Class Methods
Creates a new LinkLayer
object.
The following arguments are allowed (note that only one of dest
, uri
, file
or action
may be specified):
dest
-
The destination array or a name of a named destination for in-document links. If neither
dest
,uri
,file
noraction
is specified, it is assumed that the box has a custom property named ‘link’ which is used for the destination. uri
-
The URI to link to.
file
-
The file that should be opened or, if it refers to an application, the application that should be launched. Can either be a string or a Filespec object. Also see:
HexaPDF::Type::FileSpecification
. action
-
The PDF action that should be executed.
border
-
If set to
true
, a standard border is used. Also accepts an array that adheres to the rules for annotation borders. border_color
-
Defines the border color. Can be an array with 0 (transparent), 1 (grayscale), 3 (RGB) or 4 (CMYK) values.
Examples:
LinkLayer.new(dest: [page, :XYZ, nil, nil, nil], border: true)
LinkLayer.new(uri: "https://my.example.com/path", border: [5 5 2])
LinkLayer.new # use 'link' custom box property for dest
Public Instance Methods
Creates the needed link annotation if possible, i.e. if the context of the canvas is a page.