Module: PDF2Text

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

Class Method Summary collapse

Class Method Details

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



111
112
113
114
115
116
117
118
119
120
# File 'lib/rbbt/util/misc.rb', line 111

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