Module: PDF2Text

Defined in:
lib/rbbt/util/misc.rb

Class Method Summary collapse

Class Method Details

.pdftotext(filename, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/rbbt/util/misc.rb', line 29

def self.pdftotext(filename, options = {})
  require 'rbbt/util/cmd'
  require 'rbbt/util/tmpfile'
  require 'rbbt/util/open'


  TmpFile.with_file(Open.open(filename, options.merge(:nocache => true)).read) do |pdf_file|
    CMD.cmd("pdftotext #{pdf_file} -", :pipe => false, :stderr => true)
  end
end