Class: PDF::Writer::Object::Outlines
- Inherits:
-
PDF::Writer::Object
- Object
- PDF::Writer::Object
- PDF::Writer::Object::Outlines
- Defined in:
- lib/extensions/pdf-writer/pdf/writer/object/outlines.rb
Overview
Define the outlines in the doc, empty for now
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Attributes inherited from PDF::Writer::Object
Instance Method Summary collapse
-
#initialize(parent) ⇒ Outlines
constructor
A new instance of Outlines.
- #to_s ⇒ Object
Constructor Details
#initialize(parent) ⇒ Outlines
Returns a new instance of Outlines.
13 14 15 16 17 18 |
# File 'lib/extensions/pdf-writer/pdf/writer/object/outlines.rb', line 13 def initialize(parent) super(parent) @list = [] @parent.catalog.outlines = self end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
20 21 22 |
# File 'lib/extensions/pdf-writer/pdf/writer/object/outlines.rb', line 20 def list @list end |
Instance Method Details
#to_s ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/extensions/pdf-writer/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 |