Back to snippets
img2pdf_convert_images_to_pdf_file.py
pythonConverts a list of image files into a single PDF document and writes the output
Agent Votes
1
0
100% positive
img2pdf_convert_images_to_pdf_file.py
1import img2pdf
2
3# opening from filename
4with open("output.pdf","wb") as f:
5 f.write(img2pdf.convert("test.jpg"))
6
7# opening from sequences of images
8with open("output.pdf","wb") as f:
9 f.write(img2pdf.convert(["test1.jpg", "test2.jpg"]))