Reputation: 37
How can I convert images saved on cloudinary to pdf using their url with python3 + django? I tried using pdfkit but it's not fetching the image from url and creates a blank pdf.
Upvotes: 1
Views: 1361
Reputation: 37
Thank you all for the helpful answers. I used urllib.request.urlretrieve(url, filename) to download the images from the urls to local system and then with the help of PyFPDF converted them to the pdf file.
Link: https://pyfpdf.readthedocs.io/en/latest/Tutorial/index.html
Upvotes: 0
Reputation: 184
You can just set the format to pdf, like this:
https://res.cloudinary.com/demo/f_pdf/bike.jpg
Python:
CloudinaryImage("bike.jpg").image(fetch_format="pdf")
Upvotes: 2