我尝试使用Docsplit从Microsoft Office Word文档中提取图像并返回此错误:
/home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit/transparent_pdfs.rb:22:in `initialize': No such file or directory @ rb_sysopen - example.doc (Errno::ENOENT)
from /home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit/transparent_pdfs.rb:22:in `open'
from /home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit/transparent_pdfs.rb:22:in `is_pdf?'
from /home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit/transparent_pdfs.rb:11:in `block in ensure_pdfs'
from /home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit/transparent_pdfs.rb:10:in `map'
from /home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit/transparent_pdfs.rb:10:in `ensure_pdfs'
from /home/deploy/.rvm/gems/ruby-2.1.2/gems/docsplit-0.7.5/lib/docsplit.rb:50:in `extract_images'
from test.rb:4:in `<main>'
这是剧本:
require "docsplit"
Docsplit.extract_images('example.doc', :size => '1000x', :format => [:png, :jpg])
这是transparent_pdfs上的第22行:
File.extname(doc).downcase == '.pdf' || File.open(doc, 'rb', &:readline) =~ /\A\%PDF-\d+(\.\d+)?/
我使用Centos 6安装了所有库,在Mac Os X上以同样的方式运行良好。 如果我尝试转换pdf效果很好,只能使用office文档失败。
有什么想法吗?
谢谢,