Mercurial
comparison love/pdf-mcp/html_to_pdf.py @ 38:cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 01 Dec 2025 20:35:56 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 37:fb9bcd3145cb | 38:cf9caa4abc3e |
|---|---|
| 1 import sys | |
| 2 from playwright.sync_api import sync_playwright | |
| 3 | |
| 4 deck_id = sys.argv[1] | |
| 5 url = f"http://localhost:8000/decks/{deck_id}/index.html" | |
| 6 | |
| 7 with sync_playwright() as p: | |
| 8 browser = p.chromium.launch() | |
| 9 page = browser.new_page() | |
| 10 page.goto(url, wait_until="networkidle") | |
| 11 page.wait_for_timeout(2000) | |
| 12 page.pdf(path=f"static/{deck_id}/deck.pdf", format="A4", print_background=True) | |
| 13 browser.close() |