Class: DynamicPDFApi::OutlineList
- Inherits:
-
Object
- Object
- DynamicPDFApi::OutlineList
- Defined in:
- lib/ruby_client/OutlineList.rb
Instance Attribute Summary collapse
-
#_out_lines ⇒ Object
Returns the value of attribute _out_lines.
Instance Method Summary collapse
-
#add(text, input = nil, page_offset = 0, page_zoom = PageZoom::FIT_PAGE) ⇒ Object
Adds an Outline object to the outline list.
- #add_pdf_outlines(pdf_input) ⇒ Object
-
#initialize ⇒ OutlineList
constructor
A new instance of OutlineList.
- #to_json(_options = {}) ⇒ Object
Constructor Details
#initialize ⇒ OutlineList
Returns a new instance of OutlineList.
8 9 10 |
# File 'lib/ruby_client/OutlineList.rb', line 8 def initialize @_out_lines = [] end |
Instance Attribute Details
#_out_lines ⇒ Object
Returns the value of attribute _out_lines.
45 46 47 |
# File 'lib/ruby_client/OutlineList.rb', line 45 def _out_lines @_out_lines end |
Instance Method Details
#add(text, input = nil, page_offset = 0, page_zoom = PageZoom::FIT_PAGE) ⇒ Object
Adds an Outline object to the outline list.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ruby_client/OutlineList.rb', line 22 def add(text, input = nil, page_offset = 0, page_zoom = PageZoom::FIT_PAGE) if input.nil? out_line = Outline.new(text) @_out_lines << out_line out_line elsif input.is_a?(String) out_line = Outline.new(text, UrlAction.new(input)) @_out_lines << out_line out_line elsif input.is_a?(Object) link_to = GoToAction.new(input) link_to.page_offset = page_offset link_to.page_zoom = page_zoom out_line = Outline.new(text, link_to) @_out_lines << out_line out_line end end |
#add_pdf_outlines(pdf_input) ⇒ Object
41 42 43 |
# File 'lib/ruby_client/OutlineList.rb', line 41 def add_pdf_outlines(pdf_input) @_out_lines << Outline.new(pdf_input) end |
#to_json(_options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/ruby_client/OutlineList.rb', line 47 def to_json( = {}) json_array = [] (0..(@_out_lines.length - 1)).each do |i| json_array << @_out_lines[i] unless @_out_lines[i].nil? end JSON.pretty_generate(json_array) end |