pptx2pdf プログラム仕様
pptx2pdf.py
PowerPoint ファイル (.ppt/.pptx) を PDF に変換する小モジュール。
特徴: - Windows + Microsoft PowerPoint + comtypes を使用 - モジュールとして import して pptx_to_pdf() を再利用可能 - Launcher から直接実行したときにエラー画面がすぐ閉じないよう、
import 失敗時・CLI 実行終了時には input() で一時停止する
- 使用例:
python pptx2pdf.py input.pptx python pptx2pdf.py input.pptx output.pdf python pptx2pdf.py input.pptx --overwrite 1 --quiet 0
- モジュール利用例:
from pptx2pdf import pptx_to_pdf
pdf = pptx_to_pdf("lecture.pptx", overwrite=True, quiet=False) if pdf is None:
print("PDF変換に失敗しました")
- converter.pptx2pdf.convert_many(input_paths: Iterable[str | PathLike], output_dir: str | PathLike | None = None, *, overwrite: bool = True, quiet: bool = False, visible: bool = True) list[str]
複数のPowerPointファイルをPDFに変換します。
- converter.pptx2pdf.pptx_to_pdf(input_path: str | PathLike, output_path: str | PathLike | None = None, *, overwrite: bool = True, quiet: bool = False, visible: bool = True) str | None
PowerPointファイルをPDFに変換します。
- パラメータ:
input_path -- 入力 PowerPoint ファイル (.ppt/.pptx)。
output_path -- 出力 PDF ファイル。None の場合は入力ファイルと同じ場所・同じstemで .pdf。
overwrite -- True の場合、既存 PDF を上書きします。 False の場合、出力先が存在すれば変換せず None を返します。
quiet -- True の場合、進行メッセージを抑制します。
visible -- True の場合、PowerPointアプリケーションを表示します。 PowerPoint/COMの都合で、環境によっては False 相当が不安定な場合があります。
- 戻り値:
成功時は出力PDFの絶対パス、失敗時は None。
- 戻り値の型:
str | None