pdftoimage
pdftoimage copied to clipboard
Is it possible to use remote url instead oflocal path?
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
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