class PDF::Writer::Object::Action

An action object, used to link to URLS initially

Attributes

label[RW]
type[RW]

Public Instance Methods

to_s() click to toggle source
# File lib/pdf/writer/object/action.rb, line 24
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(@label)
    res << ")\n"
  end
  res << ">>\nendobj"
end

Public Class Methods

new(parent, label, type = "URI") click to toggle source
# File lib/pdf/writer/object/action.rb, line 13
def initialize(parent, label, type = "URI")
  super(parent)

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