Sha256: f38c51c7320d96cad3b32568484d8484abd28f8e16cb46629c69e616728b8647

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 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.rb,v 1.2 2005/05/16 03:59:21 austin Exp $
#++
  # 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

9 entries across 9 versions & 2 rubygems

Version Path
pdf-labels-1.0.0 vendor/pdf/writer/object/destination.rb
pdf-labels-1.0.1 vendor/pdf/writer/object/destination.rb
pdf-labels-2.0.1 vendor/pdf/writer/object/destination.rb
pdf-writer-1.0.0 lib/pdf/writer/object/destination.rb
pdf-writer-1.0.1 lib/pdf/writer/object/destination.rb
pdf-writer-1.1.1 lib/pdf/writer/object/destination.rb
pdf-writer-1.1.2 lib/pdf/writer/object/destination.rb
pdf-writer-1.1.0 lib/pdf/writer/object/destination.rb
pdf-writer-1.1.3 lib/pdf/writer/object/destination.rb