Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use remote url instead oflocal path? #2

Open
mukul13 opened this issue Dec 7, 2021 · 1 comment
Open

Is it possible to use remote url instead oflocal path? #2

mukul13 opened this issue Dec 7, 2021 · 1 comment
Assignees

Comments

@mukul13
Copy link

mukul13 commented Dec 7, 2021

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

gdotdesign pushed a commit to realmailers/pdftoimage that referenced this issue Nov 14, 2022
@louiswdavis
Copy link

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

@robflynn robflynn self-assigned this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants