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
-
#add_dest(name, reference) ⇒ void
private
Adds a new destination to the Dests name tree.
-
#dest_fit(dest_page = page) ⇒ Array(PDF::Core::Reference, :Fit)
private
builds a Dest specification that will fit the given page into the viewport.
-
#dest_fit_bounds(dest_page = page) ⇒ Array(PDF::Core::Reference, :FitB)
private
Builds a Dest specification that will fit the given page’s bounding box into the viewport.
-
#dest_fit_bounds_horizontally(top, dest_page = page) ⇒ Array(PDF::Core::Reference, :FitBH, Numeric)
private
Same as #dest_fit_horizontally, but works on the page’s bounding box instead of the entire page.
-
#dest_fit_bounds_vertically(left, dest_page = page) ⇒ Array(PDF::Core::Reference, :FitBV, Numeric)
private
Same as #dest_fit_vertically, but works on the page’s bounding box instead of the entire page.
-
#dest_fit_horizontally(top, dest_page = page) ⇒ Array(PDF::Core::Reference, :FitH, Numeric)
private
Builds a Dest specification that will fit the given page horizontally into the viewport, aligned vertically at the given top coordinate.
-
#dest_fit_rect(left, bottom, right, top, dest_page = page) ⇒ Array(Hash, :FitR, Numeric, Numeric, Numeric, Numeric)
private
Builds a Dest specification that will fit the given rectangle into the viewport, for the given page.
-
#dest_fit_vertically(left, dest_page = page) ⇒ Array(Hash, :FitV, Numeric)
private
Build a Dest specification that will fit the given page vertically into the viewport, aligned horizontally at the given left coordinate.
-
#dest_xyz(left, top, zoom = nil, dest_page = page) ⇒ Array(PDF::Core::Reference, :XYZ, Numeric, Numeric, [Numeric, null])
private
Builds a Dest specification for a specific location (and optional zoom level).
-
#dests ⇒ PDF::Core::Reference<PDF::Core::NameTree::Node>
private
The ‘:Dests` name tree in the Name dictionary.
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.
35 36 37 38 |
# File 'lib/pdf/core/destinations.rb', line 35 def add_dest(name, reference) reference = ref!(reference) unless reference.is_a?(PDF::Core::Reference) dests.data.add(name, reference) 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.
59 60 61 |
# File 'lib/pdf/core/destinations.rb', line 59 def dest_fit(dest_page = page) [dest_page.dictionary, :Fit] 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.
106 107 108 |
# File 'lib/pdf/core/destinations.rb', line 106 def dest_fit_bounds(dest_page = page) [dest_page.dictionary, :FitB] 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.
117 118 119 |
# File 'lib/pdf/core/destinations.rb', line 117 def dest_fit_bounds_horizontally(top, dest_page = page) [dest_page.dictionary, :FitBH, top] 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.
128 129 130 |
# File 'lib/pdf/core/destinations.rb', line 128 def dest_fit_bounds_vertically(left, dest_page = page) [dest_page.dictionary, :FitBV, left] 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.
70 71 72 |
# File 'lib/pdf/core/destinations.rb', line 70 def dest_fit_horizontally(top, dest_page = page) [dest_page.dictionary, :FitH, top] 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.
96 97 98 |
# File 'lib/pdf/core/destinations.rb', line 96 def dest_fit_rect(left, bottom, right, top, dest_page = page) [dest_page.dictionary, :FitR, left, bottom, right, top] 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.
81 82 83 |
# File 'lib/pdf/core/destinations.rb', line 81 def dest_fit_vertically(left, dest_page = page) [dest_page.dictionary, :FitV, left] 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).
49 50 51 |
# File 'lib/pdf/core/destinations.rb', line 49 def dest_xyz(left, top, zoom = nil, dest_page = page) [dest_page.dictionary, :XYZ, left, top, zoom] end |
#dests ⇒ PDF::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.)
21 22 23 24 25 |
# File 'lib/pdf/core/destinations.rb', line 21 def dests names.data[:Dests] ||= ref!( PDF::Core::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT), ) end |