Class: PDF::Core::OutlineItem Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf/core/outline_item.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Outline item.

See Also:

  • PDF 1.7 spec, section 8.2.2 Document Outline

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, parent, options) ⇒ OutlineItem

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of OutlineItem.

Parameters:

Options Hash (options):

  • :closed (Boolean)
Source Code
lib/pdf/core/outline_item.rb, line 54
54
def initialize(title, parent, options)
55
  @closed = options[:closed]
56
  @title = title
57
  @parent = parent
58
  @count = 0
59
end

Instance Attribute Details

#closedBoolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Is this item open or closed.

Returns:

  • (Boolean)
Source Code
lib/pdf/core/outline_item.rb, line 48
48
def closed
49
  @closed
50
end

#countInteger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The total number of its open descendants at all lower levels of the outline hierarchy.

Returns:

  • (Integer)
Source Code
lib/pdf/core/outline_item.rb, line 13
13
def count
14
  @count
15
end

#destString, ...

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The destination to be displayed when this item is activated.

Returns:

  • (String)
  • (Symbol)
  • (Array)

See Also:

Source Code
lib/pdf/core/outline_item.rb, line 44
44
def dest
45
  @dest
46
end

#firstReference<PDF::Core::OutlineItem>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The first of this item’s immediate children in the outline hierarchy.

Source Code
lib/pdf/core/outline_item.rb, line 17
17
def first
18
  @first
19
end

#lastReference<PDF::Core::OutlineItem>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The last of this item’s immediate children in the outline hierarchy.

Source Code
lib/pdf/core/outline_item.rb, line 21
21
def last
22
  @last
23
end

#nextReference<PDF::Core::OutlineItem>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The next item at this outline level.

Source Code
lib/pdf/core/outline_item.rb, line 25
25
def next
26
  @next
27
end

#parentReference<[PDF::Core::OutlineItem, PDF::Core::OutlineRoot]>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The parent of this item in the outline hierarchy.

Source Code
lib/pdf/core/outline_item.rb, line 33
33
def parent
34
  @parent
35
end

#prevReference<PDF::Core::OutlineItem>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The previous item at this outline level.

Source Code
lib/pdf/core/outline_item.rb, line 29
29
def prev
30
  @prev
31
end

#titleString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The text to be displayed on the screen for this item.

Returns:

  • (String)
Source Code
lib/pdf/core/outline_item.rb, line 37
37
def title
38
  @title
39
end

Instance Method Details

#to_hashHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A hash representation of this outline item.

Returns:

  • (Hash)
Source Code
lib/pdf/core/outline_item.rb, line 64
64
def to_hash
65
  hash = {
66
    Title: title,
67
    Parent: parent,
68
    Count: closed ? -count : count,
69
  }
70
  [
71
    { First: first }, { Last: last }, { Next: defined?(@next) && @next },
72
    { Prev: prev }, { Dest: dest },
73
  ].each do |h|
74
    unless h.values.first.nil?
75
      hash.merge!(h)
76
    end
77
  end
78
  hash
79
end