class HexaPDF::Document::Destinations::Destination

Parent

Wraps an explicit destination array to allow easy access to query its properties.

A *destination array* has the form

[page, type, *arguments]

where page is either a page object or a page number (in case of a destination to a page in a remote PDF document), type is the destination type (see below) and arguments are the required arguments for the specific type of destination.

Destination Types

There are eight different types of destinations, each taking different arguments. The arguments are marked up in the list below and are in the correct order for use in the destination array. The first name in the list is the PDF internal name, the second one the explicit, more descriptive one used by HexaPDF (though the PDF internal name can also be used):

:XYZ, :xyz

Display the page with the given (left, top) coordinate at the upper-left corner of the window and the specified magnification (zoom) factor. A nil value for any argument means not changing it from the current value.

:Fit, :fit_page

Display the page so that it fits horizontally and vertically within the window.

:FitH, :fit_page_horizontal

Display the page so that it fits horizontally within the window, with the given top coordinate being at the top of the window. A nil value for top means not changing it from the current value.

:FitV, :fit_page_vertical

Display the page so that it fits vertically within the window, with the given left coordinate being at the left of the window. A nil value for left means not changing it from the current value.

:FitR, :fit_rectangle

Display the page so that the rectangle specified by (left, bottom)-(right, top) fits horizontally and vertically within the window.

:FitB, :fit_bounding_box

Display the page so that its bounding box fits horizontally and vertically within the window.

:FitBH, :fit_bounding_box_horizontal

Display the page so that its bounding box fits horizontally within the window, with the given top coordinate being at the top of the window. A nil value for top means not changing it from the current value.

:FitBV, :fit_bounding_box_vertical

Display the page so that its bounding box fits vertically within the window, with the given left coordinate being at the left of the window. A nil value for left means not changing it from the current value.

Public Class Methods

new(destination)

Creates a new Destination for the given destination specification which may be an explicit destination array or a dictionary with a /D entry (as allowed for a named destination).

valid?(destination)

Returns true if the destination is valid.

Public Instance Methods

bottom()

Returns the argument bottom if used by the destination, raises an error otherwise.

left()

Returns the argument left if used by the destination, raises an error otherwise.

page()

Returns the referenced page.

The return value is either a page object or, in case of a destination to a remote document, a page number.

remote?()

Returns true if the destination references a destination in a remote document.

right()

Returns the argument right if used by the destination, raises an error otherwise.

top()

Returns the argument top if used by the destination, raises an error otherwise.

type()

Returns the type of destination.

valid?()

Returns true if the destination is valid.

value()

Returns the wrapped destination array.

zoom()

Returns the argument zoom if used by the destination, raises an error otherwise.