我正在尝试使用Rmagick将pdf转换为jpeg图像。我遇到了以下代码的问题:
pdf_link = "https://staging.shurpa.com/deliveries/BtrPsIxl/label.pdf"
file = Tempfile.new(['order', '.jpeg'])
p pdf_link
p file.path
im = ImageList.new(pdf_link)
puts "SUPP"
im.write(file.path.to_s)
我收到了这个错误:
"https://staging.shurpa.com/deliveries/BtrPsIxl/label.pdf"
"/var/folders/qm/yk_w5d9545j_6wqk6100dhjm0000gq/T/order20170706-43294-
15myct1.png"
Magick::ImageMagickError: unable to open file `/var/folders/qm/yk_w5d9545j_6wqk6100dhjm0000gq/T/magick-43294MCNyzIu4Oenn': No such file or directory @ error/constitute.c/ReadImage/544from/Users/timnaughton/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rmagick-2.16.0/lib/rmagick_internal.rb:1616:in `read'
然而,当我将这个pdf_string:
提供给它时,代码完全正常"https://shippo-delivery-east.s3.amazonaws.com/b2a3e1cd070748cd80b492aa421832a3.pdf?Signature=nf6woycGiOydPI8eSnLcq3r0tEc%3D&Expires=1530816480&AWSAccessKeyId=AKIAJGLCC5MYLLWIG42A"
答案 0 :(得分:0)
向我提供pdf的服务似乎存在问题。最近将pdf更改为安全状态,我需要使用访问密钥。这导致rmagick无法访问图像文件并返回指定的错误。