Method: PDFextract#convert_to_text

Defined in:
lib/pdf_extract.rb

#convert_to_text(pages = "all") ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/pdf_extract.rb', line 154

def convert_to_text(pages = "all")
  pdf_to_text_files(pages)
  text = {}
  #take the text from the pdf pages and load em into this shit
  Dir.glob(text_dir+"/*.txt").each do |file|  
    page_num = file.split("_")[-1].split(".")[0]
    text[page_num] = File.open(file).read 
  end
  puts text
  return text
end