2020
10-08
10-08
Python把图片转化为pdf代码实例
python安装reportlabpipinstallreportlab-ihttp://pypi.douban.com/simple/--trusted-hostpypi.douban.com代码如下#-*-coding:utf-8-*-fromreportlab.lib.pagesizesimportportraitfromreportlab.pdfgenimportcanvasfromPILimportImagedefjpg_to_pdf(jpg,pdf_path):(w,h)=Image.open(jpg).sizeuser=canvas.Canvas(pdf_path,pagesize=portrait((w,h)))user.drawImage(jpg,0,0,w,h)user.show...
继续阅读 >