赞
踩
将ppt批量转换成pdf
import win32com.client import os def ppt2pdf(filename, output_filename): ppt_app = win32com.client.Dispatch("PowerPoint.Application") ppt = ppt_app.Presentations.Open(filename) ppt.SaveAs(output_filename, 32) ppt_app.Quit() print("Done!{}".format(filename)) dirname = "c:\\Users\\DELL\\Downloads\\ppt" filenames = os.listdir(dirname) for filename in filenames: if filename.endswith("ppt") or filename.endswith("pptx"): base, ext = filename.split(".") new_name = base + ".pdf" filename = dirname + "\\" + filename output_filename = dirname + '\\' + new_name ppt2pdf(filename, output_filename)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。