Module: PDF::Core::Destinations Private

Defined in:
lib/pdf/core/destinations.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Implements destination support for PDF

Constant Summary collapse

NAME_TREE_CHILDREN_LIMIT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The maximum number of children to fit into a single node in the Dests tree.

20

Instance Method Summary collapse

Instance Method Details

#add_dest(name, reference) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Adds a new destination to the Dests name tree.

Parameters:

  • name (Symbol)

    Destination name

  • reference (PDF::Core::Reference, Array, Hash)

    Destination definition, will be converted into a Reference if it is not already one.

See Also:

Source Code
lib/pdf/core/destinations.rb, line 35
35
def add_dest(name, reference)
36
  reference = ref!(reference) unless reference.is_a?(PDF::Core::Reference)
37
  dests.data.add(name, reference)
38
end

#dest_fit(dest_page = page) ⇒ Array(PDF::Core::Reference, :Fit)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

builds a Dest specification that will fit the given page into the viewport.

Parameters:

Returns:

Source Code
lib/pdf/core/destinations.rb, line 59
59
def dest_fit(dest_page = page)
60
  [dest_page.dictionary, :Fit]
61
end

#dest_fit_bounds(dest_page = page) ⇒ Array(PDF::Core::Reference, :FitB)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a Dest specification that will fit the given page’s bounding box into the viewport.

Parameters:

Returns:

  • (Array(PDF::Core::Reference, :FitB))

    a Dest specification for a page fitting bounding box into viewport

Source Code
lib/pdf/core/destinations.rb, line 106
106
def dest_fit_bounds(dest_page = page)
107
  [dest_page.dictionary, :FitB]
108
end

#dest_fit_bounds_horizontally(top, dest_page = page) ⇒ Array(PDF::Core::Reference, :FitBH, Numeric)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Same as #dest_fit_horizontally, but works on the page’s bounding box instead of the entire page.

Parameters:

Returns:

  • (Array(PDF::Core::Reference, :FitBH, Numeric))

    a Dest specification for a page bounding box fitting horizontally at a given top coordinate

Source Code
lib/pdf/core/destinations.rb, line 117
117
def dest_fit_bounds_horizontally(top, dest_page = page)
118
  [dest_page.dictionary, :FitBH, top]
119
end

#dest_fit_bounds_vertically(left, dest_page = page) ⇒ Array(PDF::Core::Reference, :FitBV, Numeric)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Same as #dest_fit_vertically, but works on the page’s bounding box instead of the entire page.

Parameters:

Returns:

  • (Array(PDF::Core::Reference, :FitBV, Numeric))

    a Dest specification for a page bounding box fitting vertically at a given top coordinate

Source Code
lib/pdf/core/destinations.rb, line 128
128
def dest_fit_bounds_vertically(left, dest_page = page)
129
  [dest_page.dictionary, :FitBV, left]
130
end

#dest_fit_horizontally(top, dest_page = page) ⇒ Array(PDF::Core::Reference, :FitH, Numeric)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a Dest specification that will fit the given page horizontally into the viewport, aligned vertically at the given top coordinate.

Parameters:

Returns:

  • (Array(PDF::Core::Reference, :FitH, Numeric))

    a Dest specification for a page content fitting horizontally at a given top coordinate

Source Code
lib/pdf/core/destinations.rb, line 70
70
def dest_fit_horizontally(top, dest_page = page)
71
  [dest_page.dictionary, :FitH, top]
72
end

#dest_fit_rect(left, bottom, right, top, dest_page = page) ⇒ Array(Hash, :FitR, Numeric, Numeric, Numeric, Numeric)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a Dest specification that will fit the given rectangle into the viewport, for the given page.

Parameters:

  • left (Numeric)
  • bottom (Numeric)
  • right (Numeric)
  • top (Numeric)
  • dest_page (PDF::Core::Page) (defaults to: page)

Returns:

  • (Array(Hash, :FitR, Numeric, Numeric, Numeric, Numeric))

    a Dest specification for a page fitting the given rectangle in the viewport

Source Code
lib/pdf/core/destinations.rb, line 96
96
def dest_fit_rect(left, bottom, right, top, dest_page = page)
97
  [dest_page.dictionary, :FitR, left, bottom, right, top]
98
end

#dest_fit_vertically(left, dest_page = page) ⇒ Array(Hash, :FitV, Numeric)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build a Dest specification that will fit the given page vertically into the viewport, aligned horizontally at the given left coordinate.

Parameters:

Returns:

  • (Array(Hash, :FitV, Numeric))

    a Dest specification for a page content fitting vertically at a given left coordinate

Source Code
lib/pdf/core/destinations.rb, line 81
81
def dest_fit_vertically(left, dest_page = page)
82
  [dest_page.dictionary, :FitV, left]
83
end

#dest_xyz(left, top, zoom = nil, dest_page = page) ⇒ Array(PDF::Core::Reference, :XYZ, Numeric, Numeric, [Numeric, null])

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a Dest specification for a specific location (and optional zoom level).

Parameters:

  • left (Numeric)
  • top (Numeric)
  • zoom (Numeric) (defaults to: nil)
  • dest_page (PDF::Core::Page) (defaults to: page)

Returns:

  • (Array(PDF::Core::Reference, :XYZ, Numeric, Numeric, [Numeric, null]))

    a Dest specification for a specific location

Source Code
lib/pdf/core/destinations.rb, line 49
49
def dest_xyz(left, top, zoom = nil, dest_page = page)
50
  [dest_page.dictionary, :XYZ, left, top, zoom]
51
end

#destsPDF::Core::Reference<PDF::Core::NameTree::Node>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The :Dests name tree in the Name dictionary. This name tree is used to store named destinations (PDF 1.7 spec 8.2.1). (For more on name trees, see section 3.8.5 in the PDF 1.7 spec.)

Returns:

See Also:

  • Prawn::Document::Internal#names
Source Code
lib/pdf/core/destinations.rb, line 21
21
def dests
22
  names.data[:Dests] ||= ref!(
23
    PDF::Core::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT),
24
  )
25
end