pdftoimage icon indicating copy to clipboard operation
pdftoimage copied to clipboard

Is it possible to use remote url instead oflocal path?

Open mukul13 opened this issue 4 years ago • 1 comments

Hi,

Thanks for creating this gem!

Question I have: Is it possible to use a remote url instead of local path?

images = PDFToImage.open("https://www.orimi.com/pdf-test.pdf")
# currently the above line is throwing an error. Is it possible to somehow pass this url as variable?
images.each do |img|
  img.save("page-#{img.page}.jpg")
end

mukul13 avatar Dec 07 '21 10:12 mukul13

I've gotten around this by downloading/opening the external file to a Tempfile and using that temp path in the open method

file = URI.parse(remote_url).open

images = PDFToImage.open(File.expand_path(file.path))
images.each do |img|
  img.save("page-#{img.page}.jpg")
end

louiswdavis avatar Mar 26 '24 15:03 louiswdavis