benbalter / pdftotext

A Ruby wrapper for the `pdftotext` command line library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to use pdftotext in my Rails App deployed in Amazon with Elastic Beanstalk

sergimartnez opened this issue · comments

For any reason the txt file is not being generated when running the app in AWS. The following works perfectly fine in local:

`
def self.pdf_to_text(file, noblank = true)
spec = file.sub(/.pdf$/, '')
pdftotext #{spec}.pdf

if File.exists?("#{spec}.txt")
  file = File.new("#{spec}.txt")
else
  abort "File in txt can not be found!"
end
text = []
file.readlines.each do |l|
  l.chomp! if noblank
  if l.length > 0
    text && l
  end
end
file.close

end
`

If doing the following:
text = Pdftotext.text("example.pdf")

I am getting the following error:
Cliver::Dependency::NotFound: Could not find an executable ["pdftotext"] on your path.
from /home/ec2-user/.gem/ruby/2.3.4/gems/cliver-0.3.2/lib/cliver/dependency.rb:143:in `raise_not_found!'

Have you installed Poppler as described in the README?

Hi Ben - yes that was the piece I was missing. Installed it in the server and worked fine. Thanks!