我使用grim
运行以下代码进行pdf到png的转换 pdf = Grim.reap(File.dirname(__FILE__)<<"/pdf.pdf")
count = pdf.count
pdf[3].save('like.png')
text = pdf[3].text
pdf.each do |page|
puts page.text
end
显示以下错误:
没有这样的文件或目录 - gs -dNODISPLAY -q -sFile =。/ pdf.pdf C:/Ruby200/lib/ruby/gems/2.0.0/gems/grim-1.3.0/lib/pdf_info.ps(Errno :: ENOENT) 来自C:/Ruby200/lib/ruby/gems/2.0.0/gems/grim-1.3.0/lib/grim/image_magic k_processor.rb:21:in
count' from C:/Ruby200/lib/ruby/gems/2.0.0/gems/grim-1.3.0/lib/grim/pdf.rb:35:i n
count' 来自pdfpng.rb:18:在''“
答案 0 :(得分:0)
看起来Ghostscript依赖项缺失,因为它提供了gs
二进制文件,或者您确实安装了它,但PATH
中没有它。