✅博主简介:热爱科研的Python开发者,修心和技术同步精进,Python项目合作可私信,扫描文章底部QQ名片;
🍎个人主页:海神之光
⛳️座右铭:行百里者,半于九十。
🏆Python实现批量将ppt转换为pdf
这是一个Python脚本,能够批量地将微软Powerpoint文件(.ppt或者.pptx)转换为pdf格式。
一、使用说明
1、将这个脚本跟PPT文件放置在同一个文件夹下。
2、运行这个脚本。
二、全部代码
import comtypes.client
import os
def init_powerpoint():
powerpoint = comtypes.client.CreateObject(“Powerpoint.Application”)
powerpoint.Visible = 1
return powerpoint
def ppt_to_pdf(powerpoint, inputFileName, outputFileName, formatType = 32):
if outputFileName[-3:] != ‘pdf’:
outputFileName = outputFileName + “.pdf”