Class: PageTextReceiver

Inherits:
Object
  • Object
show all
Defined in:
lib/esearchy/pdf2txt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePageTextReceiver

Returns a new instance of PageTextReceiver.



6
7
8
# File 'lib/esearchy/pdf2txt.rb', line 6

def initialize
  @content = []
end

Instance Attribute Details

#contentObject

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