Class: PDF::Writer::Object::Outlines

Inherits:
PDF::Writer::Object show all
Defined in:
lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb

Overview

Define the outlines in the doc, empty for now

Instance Attribute Summary collapse

Attributes inherited from PDF::Writer::Object

#oid

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Outlines

Returns a new instance of Outlines.



13
14
15
16
17
18
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb', line 13

def initialize(parent)
  super(parent)

  @list = []
  @parent.catalog.outlines = self
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



20
21
22
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb', line 20

def list
  @list
end

Instance Method Details

#to_sObject



22
23
24
25
26
27
28
29
# File 'lib/gems/pdf-writer-1.1.8/lib/pdf/writer/object/outlines.rb', line 22

def to_s
  if @list.empty?
    "\n#{@oid} 0 obj\n<< /Type /Outlines >>\nendobj"
  else
    "\n#{@oid} 0 obj\n<< /Type /Outlines /First #{@list[0].oid} 0 R /Last
    #{@list[-1].oid} 0 R>>\nendobj"
  end
end