Sha256: 37a1822a6077a7bf4da9b9a26d79fb26b9b07d3071296bb6a60231bbf7e3d821

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

#--
# PDF::Writer for Ruby.
#   http://rubyforge.org/projects/ruby-pdf/
#   Copyright 2003 - 2005 Austin Ziegler.
#
#   Licensed under a MIT-style licence. See LICENCE in the main distribution
#   for full licensing information.
#
# $Id$
#++
  # Destination object, used to specify the location for the user to jump
  # to; presently, only on opening.
class PDF::Writer::Object::Destination < PDF::Writer::Object
  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

  attr_accessor :string
  attr_accessor :page

  def to_s
    "\n#{@oid} 0 obj\n[#{@page.oid} 0 R #{@string}]\nendobj\n"
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
ypdf-writer-1.3.5 lib/pdf/writer/object/destination.rb
ypdf-writer-1.3.3 lib/pdf/writer/object/destination.rb
ypdf-writer-1.3.2 lib/pdf/writer/object/destination.rb
metaskills-pdf-writer-1.2.2 lib/pdf/writer/object/destination.rb
metaskills-pdf-writer-1.2.3 lib/pdf/writer/object/destination.rb
eventioz-pdf-writer-1.2.4 lib/pdf/writer/object/destination.rb
eventioz-pdf-writer-1.0 lib/pdf/writer/object/destination.rb