Class: PDF::Writer::Object::Catalog

Inherits:
PDF::Writer::Object show all
Defined in:
lib/pdf/writer/object/catalog.rb

Overview

Define the document catalog, the overall controller for the document

Instance Attribute Summary collapse

Attributes inherited from PDF::Writer::Object

#oid

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Catalog

Returns a new instance of Catalog.



13
14
15
16
17
18
19
20
21
# File 'lib/pdf/writer/object/catalog.rb', line 13

def initialize(parent)
  super(parent)

  @outlines           = nil
  @pages              = nil
  @open_here          = nil
  @viewer_preferences  = nil
  @page_mode          = nil
end

Instance Attribute Details

#open_hereObject

Returns the value of attribute open_here.



25
26
27
# File 'lib/pdf/writer/object/catalog.rb', line 25

def open_here
  @open_here
end

#outlinesObject

Returns the value of attribute outlines.



23
24
25
# File 'lib/pdf/writer/object/catalog.rb', line 23

def outlines
  @outlines
end

#page_modeObject

Returns the value of attribute page_mode.



27
28
29
# File 'lib/pdf/writer/object/catalog.rb', line 27

def page_mode
  @page_mode
end

#pagesObject

Returns the value of attribute pages.



24
25
26
# File 'lib/pdf/writer/object/catalog.rb', line 24

def pages
  @pages
end

#viewer_preferencesObject

Returns the value of attribute viewer_preferences.



26
27
28
# File 'lib/pdf/writer/object/catalog.rb', line 26

def viewer_preferences
  @viewer_preferences
end

Instance Method Details

#to_sObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/pdf/writer/object/catalog.rb', line 29

def to_s
  res = "\n#{@oid} 0 obj\n<< /Type /Catalog"
  res << "\n/Outlines #{@outlines.oid} 0 R" unless @outlines.nil?
  res << "\n/Pages #{@pages.oid} 0 R" unless @pages.nil?
  res << "\n/ViewerPreferences #{@viewer_preferences.oid} 0 R" if @viewer_preferences and @parent.version >= '1.2'
  res << "\n/OpenAction #{@open_here.oid} 0 R" unless @open_here.nil?
  res << "\n/PageMode /#{@page_mode}" unless @page_mode.nil?
  res << "\n/Version /#{@parent.version}" if @parent.version >= '1.4'
  res << ">>\nendobj"
end