mcpField
S
skill-pdf-to-pptx-tool

skill-pdf-to-pptx-tool

github.com/dnvriendドキュメント2367 回インストール47 週間前に更新
リポジトリ

skill-pdf-to-pptx-tool について

PDFをPowerPointに変換するCLI、pdf-to-pptx-toolの利用方法を案内するスキルです。資料作成や文書処理に向けて、解像度の調整と段階的なログ出力を説明します。

主な機能

  1. 01PDFの各ページをスライド化
  2. 02変換DPIの指定
  3. 03段階的な詳細ログ
  4. 04bash、zsh、fishの補完生成

活用シーン

  1. 01PDFレポートからプレゼン資料を作成
  2. 02DPIで画質とファイルサイズを調整
  3. 03変換失敗や処理の遅さを調査

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/dnvriend/pdf-to-pptx-tool --skill skill-pdf-to-pptx-tool

インストール後、Claude Code で/skill-pdf-to-pptx-toolを入力して読み込まれたか確認します。

詳細

使用する場面

  • PDF ドキュメントを編集可能な PowerPoint プレゼンテーションに変換する場合
  • PDF レポートやドキュメントからスライドデッキを作成する場合
  • カスタム DPI で高品質な PDF から PPTX への変換が必要な場合
  • 変換のデバッグ用に複数レベルの詳細度でログを出力したい場合

PDF から PowerPoint への変換スキル

目的

このスキルでは、PDF ドキュメントを PowerPoint プレゼンテーションに変換するプロフェッショナルな CLI ツール pdf-to-pptx-tool の包括的な使用方法を説明します。各 PDF ページは、解像度をカスタマイズできる高品質なスライドになります。

このスキルを使用する場面

次の場合にこのスキルを使用してください:

  • PDF ドキュメントを PowerPoint 形式に変換する必要がある
  • 変換品質(DPI 設定)をカスタマイズしたい
  • 詳細なログ出力を使って変換の問題をデバッグする必要がある
  • 複数ページの PDF ドキュメントを扱っている
  • ワークフローでプログラムによる PDF から PPTX への変換が必要である

次の場合はこのスキルを使用しないでください:

  • 既存の PowerPoint ファイルを編集する(PowerPoint を直接使用してください)
  • 他の形式(画像、Word ドキュメント)を PPTX に変換する
  • PDF からテキストを抽出する(PDF テキスト抽出ツールを使用してください)
  • PowerPoint を一から作成する(PowerPoint または python-pptx を使用してください)

CLI ツール:pdf-to-pptx-tool

Click で構築された最新の Python CLI ツールです。複数レベルの詳細度に対応したログ出力、シェル補完、型安全なコードを備えています。

インストール
# Clone the repository
git clone https://github.com/dnvriend/pdf-to-pptx-tool.git
cd pdf-to-pptx-tool

# Install globally with uv
uv tool install .
前提条件
  • Python 3.14+
  • システムライブラリ poppler(PDF のレンダリングに使用)
    • macOS:brew install poppler
    • Ubuntu/Debian:apt-get install poppler-utils
    • Windows:poppler のリリースからダウンロード
クイックスタート
# Basic conversion
pdf-to-pptx-tool convert document.pdf slides.pptx

# High quality (300 DPI)
pdf-to-pptx-tool convert report.pdf presentation.pptx --dpi 300

# With verbose logging
pdf-to-pptx-tool -v convert input.pdf output.pptx

段階的な詳細表示

📖 基本コマンド(クリックして展開)
convert - PDF を PowerPoint に変換

PDF ドキュメントを PowerPoint 形式に変換します。品質設定をカスタマイズでき、PDF の各ページが 1 枚のスライドになります。

使用方法:

pdf-to-pptx-tool convert INPUT_PDF OUTPUT_PPTX [OPTIONS]

引数:

  • INPUT_PDF:入力 PDF ファイルのパス(必須)
    • 存在し、有効な PDF ファイルである必要があります
    • すべての PDF バージョンに対応しています
    • サイズ制限はありません(メモリの許す範囲内)
  • OUTPUT_PPTX:出力 PowerPoint ファイルのパス(必須)
    • 新規作成されるか、上書きされます
    • 拡張子は .pptx にしてください
    • 親ディレクトリが存在する必要があります
  • --dpi INTEGER:ページ変換の解像度(省略可能)
    • デフォルト:200 DPI(十分な品質と適度なファイルサイズ)
    • 範囲:72-600 DPI
    • DPI が高いほど品質は向上しますが、ファイルサイズも大きくなります
    • 推奨値:プレゼンテーションには 200-300
  • -v, --verbose:複数レベルの詳細度
    • フラグなし:警告とエラーのみ
    • -v:INFO レベル(操作と進行状況)
    • -vv:DEBUG レベル(詳細な手順)
    • -vvv:TRACE レベル(ライブラリ内部の情報)

例:

# Example 1: Basic conversion (default 200 DPI)
pdf-to-pptx-tool convert quarterly-report.pdf q4-presentation.pptx

# Example 2: High quality for detailed diagrams
pdf-to-pptx-tool convert technical-diagram.pdf slides.pptx --dpi 300

# Example 3: Lower quality for quick preview
pdf-to-pptx-tool convert draft.pdf preview.pptx --dpi 150

# Example 4: With INFO logging to see progress
pdf-to-pptx-tool -v convert large-doc.pdf output.pptx

# Example 5: With DEBUG logging for troubleshooting
pdf-to-pptx-tool -vv convert problematic.pdf fixed.pptx

# Example 6: Batch conversion with shell loop
for pdf in *.pdf; do
  pdf-to-pptx-tool convert "$pdf" "${pdf%.pdf}.pptx"
done

出力:

  • 指定したパスに PowerPoint ファイルを作成します
  • スライドのプロパティ:
    • アスペクト比:16:9(ワイドスクリーン)
    • 寸法:10" × 5.625"
    • レイアウト:PDF の各ページにつきスライド全体を占める画像を 1 枚配置
    • 背景:透明
  • コンソール出力:
    • 成功:「✓ Successfully converted input.pdf to output.pptx」
    • エラー:「✗ Error: [detailed error message]」
  • 終了コード:
    • 0:成功
    • 1:エラー(ファイルが見つからない、入力が無効、変換に失敗)

completion - シェル補完スクリプトを生成

bash、zsh、または fish シェル用のシェル補完スクリプトを生成します。

使用方法:

pdf-to-pptx-tool completion SHELL

引数:

  • SHELL:シェルの種類(必須)
    • 選択肢:bash、zsh、fish
    • 大文字と小文字を区別しません

例:

# Generate bash completion
eval "$(pdf-to-pptx-tool completion bash)"

# Generate zsh completion
eval "$(pdf-to-pptx-tool completion zsh)"

# Generate fish completion
pdf-to-pptx-tool completion fish | source

# Save to file for permanent installation
pdf-to-pptx-tool completion bash > ~/.pdf-to-pptx-tool-completion.bash
echo 'source ~/.pdf-to-pptx-tool-completion.bash' >> ~/.bashrc

出力: シェル固有の補完スクリプトが stdout に出力されます。

⚙️ 高度な機能(クリックして展開) ### 複数段階の詳細度でのログ記録

このツールは、変換のデバッグと監視のために、段階的な詳細度レベルをサポートしています。

ログレベル:

フラグレベル出力用途
(none)WARNINGエラー/警告のみ本番環境、静音モード
-vINFO+処理、進行状況通常のデバッグ
-vvDEBUG+詳細な手順、ファイルサイズ開発、トラブルシューティング
-vvvTRACE+ライブラリ内部の情報(pdf2image、PIL、pptx)詳細なデバッグ

例:

# Quiet mode - only see errors
pdf-to-pptx-tool convert input.pdf output.pptx

# INFO - see conversion progress
pdf-to-pptx-tool -v convert input.pdf output.pptx
# Output:
# [INFO] Starting PDF to PPTX conversion
# [INFO] Converting input.pdf to output.pptx (DPI: 200)
# [INFO] Converting PDF pages to images...
# [INFO] Converted 5 pages
# [INFO] Creating PowerPoint presentation...
# [INFO] Saving presentation to output.pptx

# DEBUG - see detailed processing
pdf-to-pptx-tool -vv convert input.pdf output.pptx
# Additional output:
# [DEBUG] Input: input.pdf, Output: output.pptx, DPI: 200
# [DEBUG] Validating input file: input.pdf
# [DEBUG] Input file size: 2.45 MB
# [DEBUG] Using DPI setting: 200
# [DEBUG] Processing slide 1/5
# [DEBUG] Output file size: 8.23 MB

# TRACE - see library internals
pdf-to-pptx-tool -vvv convert input.pdf output.pptx
# Shows pdf2image, PIL, and pptx library debug messages
DPI 品質ガイドライン

用途に応じて DPI を選択してください。

DPI品質ファイルサイズ最適な用途
72低最小クイックプレビュー、下書きのスライド
150中小ウェブプレゼンテーション、メール
200良好中デフォルト — ほとんどの場合に推奨
300高大印刷品質、詳細な図表
600非常に高い非常に大きいプロ向け印刷、ポスター

トレードオフ:

  • 高い DPI:品質が向上し、ファイルサイズが大きくなり、変換が遅くなります
  • 低い DPI:変換が速くなり、ファイルサイズが小さくなりますが、品質は低下します
  • 最適な範囲:ほとんどのプレゼンテーションでは 200~300 DPI
バッチ処理

複数の PDF を効率的に処理します。

# Convert all PDFs in directory
for pdf in *.pdf; do
  echo "Converting $pdf..."
  pdf-to-pptx-tool convert "$pdf" "${pdf%.pdf}.pptx"
done

# With custom DPI
for pdf in *.pdf; do
  pdf-to-pptx-tool convert "$pdf" "${pdf%.pdf}.pptx" --dpi 300
done

# With error handling
for pdf in *.pdf; do
  if pdf-to-pptx-tool -v convert "$pdf" "${pdf%.pdf}.pptx"; then
    echo "✓ Converted $pdf"
  else
    echo "✗ Failed to convert $pdf"
  fi
done
シェル補完

タブ補完を有効にして、操作を速くします。

# Bash - add to ~/.bashrc
eval "$(pdf-to-pptx-tool completion bash)"

# Zsh - add to ~/.zshrc
eval "$(pdf-to-pptx-tool completion zsh)"

# Fish - save to completions directory
mkdir -p ~/.config/fish/completions
pdf-to-pptx-tool completion fish > ~/.config/fish/completions/pdf-to-pptx-tool.fish

メリット:

  • コマンドをタブ補完:pdf-to-pptx-tool <TAB>
  • オプションをタブ補完:pdf-to-pptx-tool convert --<TAB>
  • ファイルパスを自動でタブ補完
🔧 トラブルシューティング(クリックして展開)
よくある問題

問題:「poppler not found」または PDF の変換に失敗する

# Symptom
RuntimeError: Failed to convert PDF pages: poppler not found

解決策: poppler のシステムライブラリをインストールします。

# macOS
brew install poppler

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

# Fedora
sudo dnf install poppler-utils

# Verify installation
pdftoppm -v

問題:「File not found」エラー

# Symptom
✗ Error: Input PDF file not found: document.pdf

解決策:

  • ファイルパスが正しいことを確認します
  • 必要に応じて絶対パスを使用します
  • ファイルのアクセス権を確認します
# Check file exists
ls -l document.pdf

# Use absolute path
pdf-to-pptx-tool convert /full/path/to/document.pdf output.pptx

問題:出力ファイルのサイズが大きすぎる

# Symptom
Generated 50MB PPTX from 2MB PDF

解決策: DPI の設定を下げます。

# Try lower DPI
pdf-to-pptx-tool convert input.pdf output.pptx --dpi 150

# Or use default 200 DPI
pdf-to-pptx-tool convert input.pdf output.pptx

問題:PowerPoint で画像がぼやけて見える

# Symptom
Text and diagrams appear pixelated

解決策: DPI の設定を上げます。

# Use higher quality
pdf-to-pptx-tool convert input.pdf output.pptx --dpi 300

# For print quality
pdf-to-pptx-tool convert input.pdf output.pptx --dpi 600

問題:変換に非常に時間がかかる

# Symptom
Large PDF takes minutes to convert

解決策:

  1. DEBUG ログを使って進行状況を確認します。
pdf-to-pptx-tool -vv convert large.pdf output.pptx
  1. 変換を速くするために、より低い DPI を検討します。
pdf-to-pptx-tool convert large.pdf output.pptx --dpi 150
  1. 大きな PDF を分割し、それぞれ個別に変換します

問題:出力ファイルへの書き込みが拒否された

# Symptom
PermissionError: [Errno 13] Permission denied: 'output.pptx'

解決策:

  • ディレクトリへの書き込み権限を確認します
  • 別の出力先を使用します
# Write to home directory
pdf-to-pptx-tool convert input.pdf ~/output.pptx

# Or create directory first
mkdir -p output-dir
pdf-to-pptx-tool convert input.pdf output-dir/output.pptx
ヘルプの利用
# Tool help
pdf-to-pptx-tool --help

# Command help
pdf-to-pptx-tool convert --help

# Completion help
pdf-to-pptx-tool completion --help

# Version info
pdf-to-pptx-tool --version
デバッグの手順

変換に失敗した場合は、次のデバッグ手順を使用してください。

# 1. Check file exists and is readable
ls -lh document.pdf
file document.pdf

# 2. Verify poppler is installed
pdftoppm -v

# 3. Try with DEBUG logging
pdf-to-pptx-tool -vv convert document.pdf test.pptx

# 4. Try with lower DPI if memory issues
pdf-to-pptx-tool -vv convert document.pdf test.pptx --dpi 150

# 5. Check Python and dependencies
python --version
pdf-to-pptx-tool --version

終了コード

  • 0:成功 — 変換が正常に完了しました
  • 1:エラー — ファイルが見つからない、入力が無効、変換に失敗、またはアクセスが拒否されました

出力形式

デフォルトの PowerPoint 出力:

  • 形式:Office Open XML(.pptx)
  • アスペクト比:16:9 ワイドスクリーン
  • スライドサイズ:10 インチ × 5.625 インチ
  • レイアウト:PDF の各ページにつき、スライド全体に画像を 1 枚配置
  • 画像形式:スライドに埋め込まれた PNG
  • 互換性:PowerPoint 2007 以降(Windows/Mac/オンライン)

コンソール出力:

# Success
✓ Successfully converted document.pdf to slides.pptx

# Error
✗ Error: Input PDF file not found: document.pdf

ログ出力(-v/-vv/-vvv 使用時):

[INFO] Starting PDF to PPTX conversion
[INFO] Converting document.pdf to slides.pptx (DPI: 200)
[DEBUG] Input file size: 2.45 MB
[INFO] Converted 10 pages
[DEBUG] Output file size: 12.78 MB
[INFO] Conversion completed successfully

ベストプラクティス

  1. まずはデフォルトの DPI(200)を使用する:品質とファイルサイズのバランスが良好です
  2. デバッグには詳細ログを使用する:-vv で変換手順の詳細を確認できます
  3. まずサンプル PDF でテストする:バッチ処理の前に品質を確認します
  4. 出力ファイルのサイズを確認する:ファイルが大きすぎる場合は DPI を調整します
  5. 効率的にバッチ処理する:複数のファイルにはシェルループを使用します
  6. シェル補完を有効にする:コマンドラインでの操作が速くなります
  7. poppler を最新の状態に保つ:最新の PDF 機能との互換性を確保します
  8. 絶対パスを使用する:相対パスによる混乱を防ぎます
  9. 前提条件を確認する:大量の変換を行う前に poppler のインストールを確認します
  10. エラーを適切に処理する:スクリプト内で終了コードを確認します

リソース

  • GitHub リポジトリ: https://github.com/dnvriend/pdf-to-pptx-tool
  • Python の依存関係:
    • pdf2image(PDF から画像への変換)
    • python-pptx(PowerPoint ファイルの作成)
    • Pillow(画像処理)
    • Click(CLI フレームワーク)
  • システムの依存関係: poppler(PDF レンダリングエンジン)
  • 関連ツール:
    • PyPDF2(PDF テキストの抽出)
    • ReportLab(PDF の生成)
    • pandoc(汎用ドキュメントコンバーター)

コメント