继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

使用Python转换PPT为PDF

知小帆
关注TA
已关注
手记 49
粉丝 19
获赞 138

使用Python转换PPT为PDF

1. 首先下载必要包

pip install comtypes
pip install pptxtopdf

2. 写代码

from pptxtopdf import convert

# 需要转换的文件目录
input_dir = r"./origin_files"
# 转换后的文件目录
output_dir = r"./conversion_files"

# convert依赖comtypes包,所以comtypes包一定要安装
convert(input_dir, output_dir)

3. 效果(转换有点慢,需要耐心等待,看不到进度)

执行转换完显示:
图片描述
结果:
图片描述


附录:也可使用命令行执行:

# --input_dir:需要转换的文件目录
# --output_dir:转换后的文件目录
pptxtopdf --input_dir .\daily_tools\pptx_to_pdf\origin_files\ --output_dir .\daily_tools\pptx_to_pdf\conversion_files\ 
打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP