#!/usr/bin/env python3 import subprocess, base64, os, sys from pathlib import Path os.chdir(Path(__file__).parent) # Load logo logo_path = Path("../frontend/public/icons/icon-192.png") logo_b64 = base64.b64encode(logo_path.read_bytes()).decode() # Load template template = Path("pdf-template.html").read_text() from datetime import datetime date_str = datetime.now().strftime("%d/%m/%Y") docs = { "MANUAL-PRODUTO": "Manual do Produto", "MANUAL-VENDAS": "Manual de Vendas", "MANUAL-TECNICO": "Manual Técnico", "ARQUITETURA-TECNICA": "Arquitetura Técnica", } for doc, title in docs.items(): md_file = f"{doc}.md" pdf_file = f"{doc}.pdf" if not os.path.exists(md_file): print(f" ⚠️ {md_file} not found, skipping") continue print(f"Generating {pdf_file}...") # Convert MD to HTML result = subprocess.run( ["pandoc", md_file, "--from", "markdown", "--to", "html"], capture_output=True, text=True ) body_html = result.stdout # Build cover cover = f'''