class HexaPDF:: Document:: Destinations
Parent | Object |
---|---|
Included Modules |
Enumerable |
This class provides methods for creating and managing the destinations of a PDF file.
A destination describes a particular view of a PDF document, consisting of the page, the view location and a magnification factor. See Destination
for details.
Such destinations may be directly specified where needed, e.g. for link annotations, or they may be named and later referenced through the name. This class allows to create destinations with or without a name.
See: PDF2.0 s12.3.2
Public Class Methods
Creates a new Destinations
object for the given PDF document.
Public Instance Methods
Returns the destination registered under the given name
(a String) or nil
if no destination was registered under that name.
Adds the given destination
under name
(a String) to the destinations name tree.
If the name does already exist, an error is raised.
Creates a new destination array with the given type
(see Destination
for all available type names; PDF internal type names are also allowed) and page
by calling the respective create_type
method.
Creates a new fit to bounding box destination array for the given arguments and returns it or, in case a name is given, the name.
The argument page
is described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new fit bounding box horizontal destination array for the given arguments and returns it or, in case a name is given, the name.
The arguments +page and top
are described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new fit bounding box vertical destination array for the given arguments and returns it or, in case a name is given, the name.
The arguments +page and left
are described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new fit to page destination array for the given arguments and returns it or, in case a name is given, the name.
The argument page
is described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new fit page horizontal destination array for the given arguments and returns it or, in case a name is given, the name.
The arguments +page and top
are described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new fit page vertical destination array for the given arguments and returns it or, in case a name is given, the name.
The arguments +page and left
are described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new fit to rectangle destination array for the given arguments and returns it or, in case a name is given, the name.
The arguments page
, left
, bottom
, right
and top
are described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Creates a new xyz destination array for the given arguments and returns it or, in case a name is given, the name.
The arguments page
, left
, top
and zoom
are described in detail in the Destination
class description.
If the argument name
is given, the created destination array is added to the destinations name tree under that name for reuse later, overwriting an existing entry if there is one.
Deletes the destination specified via name
(a String) from the destinations name tree and returns it or nil
if no destination was registered under that name.
Iterates over all named destinations of the PDF, yielding the name and the destination
wrapped into a Destination object.
Resolves the given value to a valid destination object, if possible, or otherwise returns nil
.
-
If the given value is a string, it is treated as a destination name and looked up in the destination name tree.
-
If the given value is a symbol, it is treated as an old-style destination name and looked up in the destination dictionary.
-
If the given value is an array, it is treated as a destination array itself.
Uses the given destination name/array or creates a destination array based on the given arguments.
This is the main utility method for other parts of HexaPDF
for getting a valid destination array based on various different types of the given arguments:
- String
-
If a string is provided, it is assumed to be a named destination. If the named destination exists, the destination itself is returned. Otherwise an error is raised.
- Array
-
If a valid destination array is provided, it is returned. Otherwise an error is raised.
- Page dictionary
-
If the value is a valid page dictionary object, a fit to page (
create_fit_page
) destination array is created and returned. - Integer
-
If the value is an integer, it is interpreted as a zero-based page index and a fit to page (
create_fit_page
) destination array is created and returned. - Hash containing at least :type and :page
-
If the value is a hash, the :type key specifies the type of the destination that should be created and the :page key the target page. Which other keys are allowed depends on the destination type, so see the various create_XXX methods. Uses
create
to do the job.