class PDF::Writer::Object::Destination

Destination object, used to specify the location for the user to jump to; presently, only on opening.

Attributes

page[RW]
string[RW]

Public Class Methods

new(parent, page, type, *params) click to toggle source
Calls superclass method PDF::Writer::Object::new
   # File lib/pdf/writer/object/destination.rb
14 def initialize(parent, page, type, *params)
15   super(parent)
16 
17   case type
18   when "FitR"
19     raise TypeError if params.size < 4
20     @string = "/#{type} #{params[0..3].join(' ')}"
21   when "XYZ"
22     params = (params + [ "null" ] * 4).first(4)
23     @string = "/#{type} #{params[0..2].join(' ')}"
24   when "FitH", "FitV", "FitBH", "FitBV"
25     raise TypeError if params.empty?
26     @string = "/#{type} #{params[0]}"
27   when "Fit", "FitB"
28     @string = "/#{type}"
29   end
30 
31   @page = page
32 end

Public Instance Methods

to_s() click to toggle source
   # File lib/pdf/writer/object/destination.rb
37 def to_s
38   "\n#{@oid} 0 obj\n[#{@page.oid} 0 R #{@string}]\nendobj\n"
39 end