Skip to main content

PDF Generator

render_html

Render a Document to an HTML string using a Jinja2 template.

html_to_png

Screenshot an HTML string to PNG using Playwright. Looks for a .page element to screenshot; falls back to full viewport.

html_to_pdf

Render HTML to A4 PDF using Playwright.

generate_document_files

Generate HTML, PNG, and PDF for a document. Returns {"html": path, "png": path, "pdf": path}. Files are named {doc_type}_{doc_number}.{ext}.

Photo Generator

generate_photo

Generate a single photorealistic photo. Sends the reference image + variation JSON to Gemini with the fixed system instruction. Uses model gemini-3.1-flash-image-preview with IMAGE response modality and 3:4 aspect ratio.

generate_dataset

Generate multiple photos from one document. If variations is None, uses preset_names or all presets. Photos are saved as photo_{variation_name}.png.

Verified Generators

generate_verified_photo

Generate a photo and verify it against ground truth. Retries on mismatches. Returns:

generate_verified_dataset

Generate a full verified dataset. Writes ground_truth.json, dataset_summary.json, and per-image _verification.json and _occlusion.json files.

Config Generator

text_to_variation

Convert natural language to a PhotoVariation JSON config using Gemini 2.5 Flash.