开发者

docsplit gem issue

开发者 https://www.devze.com 2023-02-19 14:24 出处:网络
Hi Iwant to make a screenshot of each page of an uploaded document, pdf so I installed the Docsplit gem (http://documentcloud.github.com/docsplit/) yesterday (together with all the dependencies) and

Hi I want to make a screenshot of each page of an uploaded document, pdf

so I installed the Docsplit gem (http://documentcloud.github.com/docsplit/) 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" "-dGraphic开发者_如何学PythonsAlphaBits=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 anyone happend know what's causing this problem and what would possibly fix this issue?

If anyone knows a ruby alternative for making images of pdfs and documents, please share. Thanks


Look at the error message closely:

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

The message is telling you that the PostScript builder failed because it couldn't find GhostScript (gs). So, you need to install GhostScript, probably from MacPorts.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号