|
- import os
- import img2pdf
- def pngtopdf(path):
- name = path + '.pdf'
- with open(name, "wb") as f:
- f.write(img2pdf.convert([os.path.join(path, file) for file in os.listdir(path) if file.endswith(".png")]))
- url = input('请输入文件夹地址:')
- A = os.listdir(url)
- for i in A:
- pngtopdf(url+'\\'+i)
- print(url+'\\'+i,'已经合成完毕')
复制代码
|
|