Sha256: 025cc653cd5bac47ac7961a5bcc6e4a350471431bd8e740f81630b6dcee0da56

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

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$
#++
  # An action object, used to link to URLS initially
class PDF::Writer::Object::Action < PDF::Writer::Object
  def initialize(parent, label, type = "URI")
    super(parent)

    @type   = type
    @label  = label
    raise TypeError if @label.nil?
  end

  attr_accessor :type
  attr_accessor :label

  def to_s
    res = "\n#{@oid} 0 obj\n<< /Type /Action"
    if @type == :ilink
      res << "\n/S /GoTo\n/D #{@parent.destinations[@label].oid} 0 R"
    elsif @type == 'URI'
      res << "\n/S /URI\n/URI ("
      res << PDF::Writer.escape(@parent.arc4.encrypt(@label))
      res << ")\n"
    end
    res << ">>\nendobj"
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
metaskills-pdf-writer-1.2.2 lib/pdf/writer/object/action.rb
metaskills-pdf-writer-1.2.3 lib/pdf/writer/object/action.rb
eventioz-pdf-writer-1.2.4 lib/pdf/writer/object/action.rb
eventioz-pdf-writer-1.0 lib/pdf/writer/object/action.rb