Pdf Converter

👤 cscsxx606 📦 v0.1.0 ⭐ 4.0 ⬇️ 1.4K 下載
📄 辦公效率 免費

📖 技能介紹

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

來源於7w4.net。

引數說明

引數 說明 預設值
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

🤖 AI 評測

這個 PDF 轉換工具實際無法完成任何檔案轉換操作,只能給出操作建議。文件內容看起來很專業,但使用者真正想轉換檔案時會發現根本做不到。質量評分只能給到及格線,因為文件本身編寫規範,但功能完全不可用。

📊 多維度評分

適應性4.2
規範性4.1
有效性4.1
可靠性3.3
可信度4.4

📁 包含檔案 (8 個)

📄 EXAMPLES.md 3.9 KB
📄 INSTALL.md 2.9 KB
📄 README.md 4.5 KB
📄 SKILL.md 4.3 KB
📄 _meta.json 132 B
📄 scripts/check_deps.py 2 KB
📄 scripts/convert.py 8.9 KB
📄 scripts/pdf2pptx.py 985 B