class 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
# 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

Public Instance Methods

to_s() click to toggle source
# 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