目录
法一
完整版,能解决诸如图片旋转问题、图片保存为A4格式问题等,只需把图片放到一个文件夹里,然后在文件夹外放上下面的代码,即可。
from reportlab.pdfgen import canvas
from reportlab.lib.units import inch, cm
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Image, PageBreak
from reportlab.lib.pagesizes import A4,A3,A2,A1, legal, landscape
from reportlab.lib.utils import ImageReader
import PIL.Image,PIL.ExifTags
from os import listdir
import os,re
import time
from reportlab.lib.units import inch
def img_search(mypath, filenames):
for lists in os.listdir(mypath):
path = os.path.join(mypath,lists)
if os.path.isfile(path):
expression = r'[\w]+\.(jpg|png|jpeg)$'
if re.search(expression, path, re.IGNORECASE):