import fitz
import os

pdf_path = r'c:\fuentes\proyectos delphi\RAUL_ASENCIO\GESTION\documentacion raul asencio\guion_podcast_gustavo_ernesto_horizontal.pdf'
doc = fitz.open(pdf_path)

out_dir = r'c:\fuentes\proyectos delphi\RAUL_ASENCIO\GESTION\scratch\previews'
os.makedirs(out_dir, exist_ok=True)

test_pages = [1, 2, 3, 7, 8, 13, 24, 25]

for pno in test_pages:
    page = doc[pno - 1]
    pix = page.get_pixmap(dpi=150)
    img_path = os.path.join(out_dir, f'page_{pno:02d}.png')
    pix.save(img_path)
    print(f"Saved preview: {img_path} ({pix.width}x{pix.height})")

print("All previews rendered.")
