1,安装 pip install cpmtypes
2,PPT转图片代码如下:
import comtypes.client #PPT存放路径 ppt = '/2021年终总结.pptx' #转换成图片后存放路径 filename = '/ppt2jpg/001' def wps2png(filePath,folderPath): #使用wps的接口 powerpoint = comtypes.client.CreateObject("kwpp.Application",dynamic = True) #打开后会显示启动wps的过程 # powerpoint.Visible = 1 ppt = powerpoint.Presentations.Open(filePath) # 另存为 ppt.SaveAs(folderPath, 17) # 退出 ppt.Close() powerpoint.Quit() wps2png(ppt, filename)
参考链接:https://blog.csdn.net/rrttyyui/article/details/119348974
还没有评论,来说两句吧...