我正在尝试使用 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 效果很好,只有办公文档会失败。
有任何想法吗?
谢谢,