Bitácora 8–30 jun: contrato firmado, plan de actividades y skill proposal-pdf
- Comunicaciones (REGISTRO #15–#21): respuesta v1.1 (10-jun), luz verde (16-jun), contrato (envío 25-jun, ajustes + firma 26-jun), arranque con Erika y kickoff 1-jul - Evidencia en fuentes/ (correos 8/10/16-jun, WhatsApp Paola y Erika) - Contratos (sin firmar y firmado) en propuesta/ - Plan de actividades Etapa 0–3 + guion del kickoff (planeacion/) - Skill proposal-pdf instalado (.claude/skills) + Propuesta-Balam.pdf regenerada - README/PENDIENTES al día; limpieza de archivos sueltos; .gitignore (locks de Office) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""render_check.py — rasterize PDF pages to PNG for visual verification.
|
||||
|
||||
Cross-platform: uses pypdfium2 (already pulled in with pdfplumber), so it needs
|
||||
no poppler/pdftoppm. On Windows this is the practical way to do the "ALWAYS
|
||||
verify visually" step from SKILL.md.
|
||||
|
||||
Usage:
|
||||
python render_check.py Output.pdf # every page -> Output_p1.png, ...
|
||||
python render_check.py Output.pdf 1 2 5 # only pages 1, 2, 5 (1-based)
|
||||
python render_check.py Output.pdf 1 2 --scale 2 # higher resolution
|
||||
"""
|
||||
import sys, pathlib
|
||||
|
||||
try:
|
||||
import pypdfium2 as pdfium
|
||||
except Exception:
|
||||
sys.exit("Missing pypdfium2 (it installs alongside pdfplumber).\n"
|
||||
" pip install pypdfium2")
|
||||
|
||||
|
||||
def main():
|
||||
args = list(sys.argv[1:])
|
||||
if not args:
|
||||
sys.exit("Usage: python render_check.py <pdf> [pages...] [--scale N]")
|
||||
|
||||
scale = 1.5
|
||||
if "--scale" in args:
|
||||
i = args.index("--scale")
|
||||
try:
|
||||
scale = float(args[i + 1])
|
||||
except (IndexError, ValueError):
|
||||
sys.exit("--scale needs a number, e.g. --scale 2")
|
||||
del args[i:i + 2]
|
||||
|
||||
pdf_path = args[0]
|
||||
if not pathlib.Path(pdf_path).exists():
|
||||
sys.exit(f"PDF not found: {pdf_path}")
|
||||
pages = [int(a) for a in args[1:]]
|
||||
|
||||
pdf = pdfium.PdfDocument(pdf_path)
|
||||
n = len(pdf)
|
||||
idxs = [p - 1 for p in pages] if pages else range(n)
|
||||
stem = pathlib.Path(pdf_path).with_suffix("")
|
||||
for i in idxs:
|
||||
if i < 0 or i >= n:
|
||||
print(f" ! page {i + 1} out of range (1..{n})")
|
||||
continue
|
||||
out = f"{stem}_p{i + 1}.png"
|
||||
pdf[i].render(scale=scale).to_pil().save(out)
|
||||
print("wrote", out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user