Class: PDF::Writer::Object::Destination
- Inherits:
-
PDF::Writer::Object
- Object
- PDF::Writer::Object
- PDF::Writer::Object::Destination
- Defined in:
- lib/pdf/writer/object/destination.rb
Overview
Destination object, used to specify the location for the user to jump to; presently, only on opening.
Instance Attribute Summary collapse
-
#page ⇒ Object
Returns the value of attribute page.
-
#string ⇒ Object
Returns the value of attribute string.
Attributes inherited from PDF::Writer::Object
Instance Method Summary collapse
-
#initialize(parent, page, type, *params) ⇒ Destination
constructor
A new instance of Destination.
- #to_s ⇒ Object
Constructor Details
#initialize(parent, page, type, *params) ⇒ Destination
Returns a new instance of Destination.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pdf/writer/object/destination.rb', line 14 def initialize(parent, page, type, *params) super(parent) case type when "FitR" raise TypeError if params.size < 4 @string = "/#{type} #{params[0..3].join(' ')}" when "XYZ" params = (params + [ "null" ] * 4).first(4) @string = "/#{type} #{params[0..2].join(' ')}" when "FitH", "FitV", "FitBH", "FitBV" raise TypeError if params.empty? @string = "/#{type} #{params[0]}" when "Fit", "FitB" @string = "/#{type}" end @page = page end |
Instance Attribute Details
#page ⇒ Object
Returns the value of attribute page.
35 36 37 |
# File 'lib/pdf/writer/object/destination.rb', line 35 def page @page end |
#string ⇒ Object
Returns the value of attribute string.
34 35 36 |
# File 'lib/pdf/writer/object/destination.rb', line 34 def string @string end |
Instance Method Details
#to_s ⇒ Object
37 38 39 |
# File 'lib/pdf/writer/object/destination.rb', line 37 def to_s "\n#{@oid} 0 obj\n[#{@page.oid} 0 R #{@string}]\nendobj\n" end |