Docsplit Ruby on Rails

2.9k views Asked by At

I'm trying to get docsplit to work with my rails app. Right now I'm just trying to get it to run locally. I installed the gem and all of the dependencies. All of the basic examples work in the command line and I was able to get the

Docsplit.extract_pdf('example.doc')

to work in my rails app. However when I try to use extract_images, i.e.

Docsplit.extract_images('example.doc', :size => '1000x', :format => [:png, :jpg])

I get the following error:

Docsplit::ExtractionFailed (sh: pdfinfo: command not found):
  docsplit (0.6.1) lib/docsplit/info_extractor.rb:23:in `extract'
  (eval):3:in `extract_length'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:34:in `convert'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:19:in `extract'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:19:in `each'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:19:in `extract'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:18:in `each'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:18:in `each_with_index'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:18:in `extract'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:16:in `each'
  docsplit (0.6.1) lib/docsplit/image_extractor.rb:16:in `extract'
  docsplit (0.6.1) lib/docsplit.rb:58:in `extract_images'
  app/controllers/sandbox_controller.rb:53:in `split_doc'

I double checked and all of the dependencies are installed. I'm guessing I missed something in the configuration in rails.

Thanks.

2

There are 2 answers

0
Greg Borenstein On BEST ANSWER

Make sure you don't skip the step of installing Poppler, as mentioned in the docs. http://poppler.freedesktop.org/ Install it with brew install poppler or whatever's appropriate in your preferred package manager. I had this same error. Installing Poppler fixed it for me.

2
bryanweatherly On

I was having the same problem using FreeBSD. I solved it by installing poppler-utils.