将PDF转换为PPTX幻灯片或可编辑的DOCX文件,支持可配置的图片质量、DPI、文件大小限制以及批量处理。
pdf-converter是一项面向实际任务的技能,主要用于PDF 转 PPTX/Word 转换器 - 将 PDF 文件转换为 PowerPoint 或 Word 格式,支持文件大小限制;✅ PDF → PPTX(每页 PDF 转为幻灯片,图片嵌入);
✅ 可配置图片质量和 DPI;注意 : pdf2。它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;
若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
PDF 转 PPTX/Word 转换器 - 将 PDF 文件转换为 PowerPoint 或 Word 格式,支持文件大小限制。
pip3 install --break-system-packages pdf2image python-pptx pdf2docx Pillow
注意: pdf2image 需要系统安装 poppler:
# macOS brew install poppler # Ubuntu/Debian sudo apt-get install poppler-utils
# 转换为 PPTX(默认) python3 skills/pdf-converter/scripts/convert.py /path/to/file.pdf # 转换为 Word python3 skills/pdf-converter/scripts/convert.py /path/to/file.pdf --format docx # 指定最大文件大小(MB) python3 skills/pdf-converter/scripts/convert.py /path/to/file.pdf --max-size 30 # 指定输出路径 python3 skills/pdf-converter/scripts/convert.py /path/to/file.pdf --output /path/to/output.pptx
# 调整 DPI(影响质量和大小,默认 150) python3 skills/pdf-converter/scripts/convert.py file.pdf --dpi 200 # 调整图片质量(1-100,默认 85) python3 skills/pdf-converter/scripts/convert.py file.pdf --quality 75 # 批量转换整个目录 python3 skills/pdf-converter/scripts/convert.py /path/to/pdfs/ --batch # 静默模式(仅输出最终结果) python3 skills/pdf-converter/scripts/convert.py file.pdf --quiet
| 参数 | 说明 | 默认值 |
|---|---|---|
input |
PDF 文件路径或目录(批量模式) | 必需 |
--format |
输出格式:pptx 或 docx |
pptx |
--max-size |
最大文件大小(MB),超过会尝试压缩 | 30 |
--output |
输出文件路径 | 与 PDF 同目录 |
--dpi |
渲染 DPI(影响质量和大小) | 150 |
--quality |
JPEG 图片质量(1-100) | 85 |
--batch |
批量转换目录中的所有 PDF | False |
--quiet |
静默模式,仅输出结果 | False |
python3 skills/pdf-converter/scripts/convert.py "/Users/admin/Desktop/中金公司 2026 年度公关服务响应方案 -0318.pdf"
输出:
📄 源文件:中金公司 2026 年度公关服务响应方案 -0318.pdf 📊 源大小:21.91 MB 🔄 开始转换... ✓ 共 118 页 📊 创建幻灯片... 已处理 20/118 页 已处理 40/118 页 ... ✅ 转换成功! 📊 输出大小:22.51 MB ✓ 大小限制:≤30 MB - ✅ 符合 📍 保存位置:/Users/admin/Desktop/中金公司 2026 年度公关服务响应方案 -0318.pptx
python3 skills/pdf-converter/scripts/convert.py file.pdf --format docx --max-size 20
python3 skills/pdf-converter/scripts/convert.py /path/to/pdfs/ --batch --format pptx
| PDF 大小 | 页数 | DPI | 转换时间 | PPTX 大小 |
|---|---|---|---|---|
| 5 MB | 20 | 150 | ~15 秒 | ~8 MB |
| 20 MB | 100 | 150 | ~60 秒 | ~20 MB |
| 50 MB | 200 | 150 | ~120 秒 | ~45 MB |
pdf2image 报错 "unable to get page count"原因: 缺少 poppler 工具
解决:
# macOS brew install poppler # Ubuntu/Debian sudo apt-get install poppler-utils
解决:
--dpi 100--quality 60--max-size 30解决: 使用完整路径,确保文件系统支持 UTF-8
skills/pdf-converter/ ├── SKILL.md # 本文件 ├── scripts/ │ └── convert.py # 转换脚本 └── README.md # 详细文档(可选)
相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.6万人学习