← 返回 Skills 市场
cscsxx606

Pdf Converter

作者 cscsxx · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ✓ 安全检测通过
365
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install pdf-converter
功能描述
Convert PDFs to PPTX slides or editable DOCX files with configurable image quality, DPI, file size limit, and batch processing support.
使用说明 (SKILL.md)

pdf-converter

PDF 转 PPTX/Word 转换器 - 将 PDF 文件转换为 PowerPoint 或 Word 格式,支持文件大小限制。

功能

  • ✅ PDF → PPTX(每页 PDF 转为幻灯片,图片嵌入)
  • ✅ PDF → DOCX(保留文本和图片结构)
  • ✅ 文件大小控制(自动压缩以确保 ≤ 指定大小)
  • ✅ 批量转换支持
  • ✅ 可配置图片质量和 DPI

安装依赖

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 输出格式:pptxdocx pptx
--max-size 最大文件大小(MB),超过会尝试压缩 30
--output 输出文件路径 与 PDF 同目录
--dpi 渲染 DPI(影响质量和大小) 150
--quality JPEG 图片质量(1-100) 85
--batch 批量转换目录中的所有 PDF False
--quiet 静默模式,仅输出结果 False

示例

示例 1: 转换单个 PDF 为 PPTX

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

示例 2: 转换为 Word 并限制大小

python3 skills/pdf-converter/scripts/convert.py file.pdf --format docx --max-size 20

示例 3: 批量转换

python3 skills/pdf-converter/scripts/convert.py /path/to/pdfs/ --batch --format pptx

输出格式说明

PPTX 格式

  • 每页 PDF 转为一张幻灯片
  • 幻灯片尺寸:16:9 宽屏(13.333" x 7.5")
  • 图片格式:JPEG(可配置质量)
  • 适合:演示文稿、报告展示

DOCX 格式

  • 保留 PDF 文本和图片结构
  • 可编辑文本内容
  • 适合:文档编辑、内容提取

性能参考

PDF 大小 页数 DPI 转换时间 PPTX 大小
5 MB 20 150 ~15 秒 ~8 MB
20 MB 100 150 ~60 秒 ~20 MB
50 MB 200 150 ~120 秒 ~45 MB

故障排除

问题 1: pdf2image 报错 "unable to get page count"

原因: 缺少 poppler 工具

解决:

# macOS
brew install poppler

# Ubuntu/Debian
sudo apt-get install poppler-utils

问题 2: 转换后文件太大

解决:

  1. 降低 DPI:--dpi 100
  2. 降低图片质量:--quality 60
  3. 启用自动压缩:--max-size 30

问题 3: 中文文件名乱码

解决: 使用完整路径,确保文件系统支持 UTF-8

文件结构

skills/pdf-converter/
├── SKILL.md              # 本文件
├── scripts/
│   └── convert.py        # 转换脚本
└── README.md             # 详细文档(可选)

更新日志

  • 2026-03-18: 初始版本,支持 PDF→PPTX 和 PDF→DOCX
安全使用建议
This skill appears internally consistent and implements PDF→PPTX/DOCX conversion as described, but note the source is unknown and the package contains executable Python scripts. Before installing or running: 1) review scripts locally (they are small and included) to satisfy yourself they do what you expect; 2) run in an isolated environment or VM/container and use a Python virtualenv; 3) install poppler from your OS package manager (official releases) rather than third-party binaries; 4) avoid running on highly sensitive files until you're comfortable with the behavior (the tool writes temporary images to /tmp and prints filenames to stdout); and 5) be aware converted PPTX pages are raster images (text generally not editable) and concurrent runs may conflict due to non-unique temp filenames.
功能分析
Type: OpenClaw Skill Name: pdf-converter Version: 0.1.0 The skill bundle provides a legitimate PDF to PPTX/Word conversion tool using standard Python libraries (pdf2image, python-pptx, pdf2docx). The code logic in scripts/convert.py and scripts/check_deps.py is transparent, lacks network activity, and contains no evidence of data exfiltration, persistence, or malicious prompt injection.
能力评估
Purpose & Capability
Name and description match the included scripts and documentation. Required packages (pdf2image, python-pptx, pdf2docx, Pillow) and the poppler system dependency are appropriate and documented. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md contains concrete CLI usage and points to the included scripts; runtime actions are limited to reading PDFs, rendering pages to images, creating PPTX/DOCX files, and writing outputs. The code writes temporary JPEGs to /tmp (fixed names slide_<i>.jpg) and deletes them; this could cause conflicts in concurrent runs and is worth noting but is not inconsistent with purpose. No network endpoints, credential reads, or unrelated filesystem access are present.
Install Mechanism
No install spec in registry; SKILL.md recommends installing standard Python packages via pip and system poppler via package managers (brew/apt) — this is proportionate and low risk. No downloads from arbitrary URLs or archive extraction are present.
Credentials
No environment variables, credentials, or config paths required. The script only relies on local filesystem access and installed libraries, which is expected for this functionality.
Persistence & Privilege
Flags are default (always: false, user-invocable: true). The skill does not request permanent presence, does not modify other skills or global agent config, and does not require elevated privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install pdf-converter
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /pdf-converter 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
- Initial release with support for converting PDF files to PPTX (PowerPoint) and DOCX (Word) formats. - Each PDF page is converted to an individual PPTX slide with embedded images. - DOCX output preserves text and image structure for editing. - Includes file size control with automatic compression to meet specified limits. - Supports batch conversion of directories and options to adjust image quality and DPI. - Provides detailed command-line usage and troubleshooting guidance.
元数据
Slug pdf-converter
版本 0.1.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Pdf Converter 是什么?

Convert PDFs to PPTX slides or editable DOCX files with configurable image quality, DPI, file size limit, and batch processing support. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 365 次。

如何安装 Pdf Converter?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install pdf-converter」即可一键安装,无需额外配置。

Pdf Converter 是免费的吗?

是的,Pdf Converter 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Pdf Converter 支持哪些平台?

Pdf Converter 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Pdf Converter?

由 cscsxx(@cscsxx606)开发并维护,当前版本 v0.1.0。

💬 留言讨论