python convertir les images en pdf
import img2pdf
import os
from datetime import datetime
# convert all files ending in .jpg inside a directory
dirname = "C:/Projects/Python/ImageConverter/Image/"
imgs = []
for fname in os.listdir(dirname):
if not fname.endswith(""):
continue
path = os.path.join(dirname, fname)
if os.path.isdir(path):
continue
imgs.append(path)
# Save file as PDF to specific folder
root = 'C:\ConvertedImages'
today = datetime.today().strftime('%Y-%m-%d_%H-%M')
name = (today + '_Multiple.pdf')
filePath = os.path.join(root, name)
with open(filePath,"wb") as f:
f.write(img2pdf.convert(imgs))
Seahawk