images_from_path = convert_from_path(settings.MEDIA_ROOT+'file/some.pdf',100)
images_from_path[0].save(settings.MEDIA_ROOT+'image/'+'a.jpg'))
I can get or save the images like this. How do I use a pdf file-url( https://example.com/xyz.pdf ) to get the images?
Fetch the data using your favourite HTTP library:
import requests, pdf2image
pdf = requests.get('https://example.com/xyz.pdf')
pdf2image.convert_from_bytes(pdf.raw.read())
增加@fqrt 的答案,我们需要在 requests.get 中添加 stream=True
pdf = requests.get('https://example.com/xyz.pdf', stream=True)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.