Class: PageTextReceiver
- Inherits:
-
Object
- Object
- PageTextReceiver
- Defined in:
- lib/esearchy/pdf2txt.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
-
#begin_page(arg = nil) ⇒ Object
Called when page parsing starts.
-
#initialize ⇒ PageTextReceiver
constructor
A new instance of PageTextReceiver.
-
#show_text(string, *params) ⇒ Object
(also: #super_show_text, #move_to_next_line_and_show_text, #set_spacing_next_line_show_text)
record text that is drawn on the page.
-
#show_text_with_positioning(*params) ⇒ Object
this final text callback takes slightly different arguments.
Constructor Details
#initialize ⇒ PageTextReceiver
Returns a new instance of PageTextReceiver.
6 7 8 |
# File 'lib/esearchy/pdf2txt.rb', line 6 def initialize @content = [] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/esearchy/pdf2txt.rb', line 4 def content @content end |
Instance Method Details
#begin_page(arg = nil) ⇒ Object
Called when page parsing starts
11 12 13 |
# File 'lib/esearchy/pdf2txt.rb', line 11 def begin_page(arg = nil) @content << "" end |
#show_text(string, *params) ⇒ Object Also known as: super_show_text, move_to_next_line_and_show_text, set_spacing_next_line_show_text
record text that is drawn on the page
16 17 18 |
# File 'lib/esearchy/pdf2txt.rb', line 16 def show_text(string, *params) @content.last << string.strip end |
#show_text_with_positioning(*params) ⇒ Object
this final text callback takes slightly different arguments
26 27 28 29 |
# File 'lib/esearchy/pdf2txt.rb', line 26 def show_text_with_positioning(*params) params = params.first params.each { |str| show_text(str) if str.kind_of?(String)} end |