Class: PDFReader

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

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ PDFReader

Returns a new instance of PDFReader.



4
5
6
# File 'lib/pdf_reader.rb', line 4

def initialize(file)
  @file = file
end

Instance Method Details

#raw_textObject

extracts all raw text



9
10
11
12
13
14
15
16
17
18
# File 'lib/pdf_reader.rb', line 9

def raw_text
  text = ''

  objects = get_objects(get_data(@file))
  objects = decode_objects(objects)

  objects.each { |o| text += o[:data] if(o[:data] and is_text_header?(o[:header])) }

  text
end