# -*- coding: utf-8 -*-
"""PowerPoint COM 렌더링 검증 — 전 슬라이드 PNG export."""
import sys, os, glob
import win32com.client as win32

PPTX = sys.argv[1] if len(sys.argv) > 1 else r"C:\GUARDiA\workspace\kintex\docs\deliverables\제안서.pptx"
OUT = sys.argv[2] if len(sys.argv) > 2 else r"C:\Users\ython\AppData\Local\Temp\claude\C--GUARDiA-workspace-kintex\85f77606-5d61-424b-8a38-f8b61b56b54c\scratchpad\render"
os.makedirs(OUT, exist_ok=True)
for f in glob.glob(os.path.join(OUT, "*.png")):
    try: os.remove(f)
    except: pass

app = win32.Dispatch("PowerPoint.Application")
try:
    app.Visible = True
except Exception:
    pass
pres = app.Presentations.Open(PPTX, ReadOnly=True, Untitled=False, WithWindow=False)
n = pres.Slides.Count
for i in range(1, n+1):
    pres.Slides(i).Export(os.path.join(OUT, f"s{i:03d}.png"), "PNG", 1280, 720)
pres.Close(); app.Quit()
print("RENDERED", n, "slides ->", OUT)
