documentcloud / docsplit

Break Apart Documents into Images, Text, Pages and PDFs
http://documentcloud.github.io/docsplit/
Other
831 stars 214 forks source link

basic usage of docsplit #8

Closed ayrton closed 13 years ago

ayrton commented 13 years ago

Hi I installed the Docsplit gem yesterday (together with all the dependencies) and I wanted to test this quickly so I tried one of the examples of your documentation (in commandline)

docsplit images example.pdf

and this was the outputted error:

execvp failed, errno = 2 (No such file or directory) gm convert: "gs" "-q" "-dBATCH" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r150x150" "-dFirstPage=1" "-dLastPage=1" "-sOutputFile=/var/folders/um/umOJP4yeEoG4UihNlcD7ME+++TM/-Tmp-/d20110325-6084-j35i1w/gmrpht13" "--" "/var/folders/um/umOJP4yeEoG4UihNlcD7ME+++TM/-Tmp-/d20110325-6084-j35i1w/gm04N0rO" "-c" "quit". gm convert: Postscript delegate failed (example.pdf).

I'm not sure why it says No such file or directory because I'm absolutely sure the file exists.

Also I'm trying out the method in a ruby script (usually I only use gems in a Ruby on Rails project, so this might be a stupid error)

require 'rubygems'
require 'docsplit'

CUR_DIR = Dir.getwd
DOCS_DIR = "#{CUR_DIR}/docs"
THUMB_DIR = "#{CUR_DIR}/thumbnails"

Dir.mkdir DOCS_DIR unless File.directory? DOCS_DIR
Dir.mkdir THUMB_DIR unless File.directory? THUMB_DIR

Dir.chdir(DOCS_DIR)
Dir["*"].each do |filename|
  # skip directories
  next if File.directory? filename

  puts "processing #{filename}"  
  Docsplit.extract_images(filename, :size => '920x', :format => [:png, :jpg])
end

NameError: uninitialized constant Docsplit

Note I'm using docsplit (0.5.0) and ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10]

Would you happend to know what's causing this problem and what would possibly fix this issue?

ayrton commented 13 years ago

execvp failed, errno = 2 (No such file or directory) gm convert: "gs" "-q" ... gm convert: Postscript delegate failed (example.pdf).

Is telling that the PostScript builder failed because it couldn't find GhostScript (gs). So, I needed to install GhostScript. Which fixed the commandline part issue.

ayrton commented 13 years ago

now when I try out Docsplit in a ruby script, it outputs:

./docsplit.rb:7: uninitialized constant Docsplit (NameError) from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require' from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in require' from ./docsplit.rb:5

ayrton commented 13 years ago

my fault, because I was using texmate I used another ruby.