0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PowerPoint を一括PDF変換

Posted at

実施背景と実施要件

  • AIにPowerPointの内容を良い感じに食わせたい
    • PDFが最適らしいとのことなので、PowerPointをPDFに変換していく

実施環境

MacのTerminal

実施手順

0.. VSCodeなりでPDFが見れるアドオンを入れておく

1.. LibreOfficeのインストール

$ brew install --cask libreoffice

2.. スクリプトの実施

$ vim pptx_to_pdf.sh

#!/usr/bin/env bash
set -euo pipefail

IN_DIR="${1:-/Users/hogehoge/Documents/Input}"
OUT_DIR="${2:-/Users/hogehoge/Documents/Output}"
SOFFICE="/Applications/LibreOffice.app/Contents/MacOS/soffice"

mkdir -p "$OUT_DIR"

# .pptx と .ppt を対象。スペース・日本語パス対応。
find "$IN_DIR" -maxdepth 1 -type f \( -iname '*.pptx' -o -iname '*.ppt' \) | while IFS= read -r ppt; do
  name="$(basename "$ppt")"
  base="${name%.*}"
  echo "→ 変換中: $name"
  "$SOFFICE" --headless --convert-to "pdf:impress_pdf_Export" --outdir "$OUT_DIR" "$ppt"
  # 出力は $OUT_DIR/$base.pdf
  echo "✅ 出力: $OUT_DIR/$base.pdf"
done

echo "🎉 完了"

3.. 権限の付与

$ chmod +x pptx_to_pdf.sh

4.. スクリプトの実施

# 既定のIN/OUTで実行
sh ./pptx_to_pdf.sh

# もしくは
sh ./pptx_to_pdf.sh "/path/to/ppt_dir" "/path/to/pdf_out"

結果

スクリプトがエラーなく動いてパワーポイントがpdfとして出力されてるけど、Cursolだとpdfが読みめないみたい:joy:ウソダロォ
対処法はまた今度考える:joy:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?