Parse PDF/Markdown files into structured HTML posters with multi-modal output (PDF, PNG, DOCX, PPTX), or generate poster/slides images via Gemini image generation.
Parse PDF or Markdown documents into styled HTML posters with LLM-based rendering, then convert to PDF, PNG, DOCX, and PPTX. Additionally, generate poster images and slides images using Gemini's native image generation API.
Prerequisites
Python 3.12+
LLM API key (OpenAI, Gemini, or Qwen)
System dependencies (fonts, Chromium libs)
Quick Start
1. Install
bash
bash install.sh
This will:
Install UV (Python package manager)
Install Python 3.12
Install system dependencies (fonts, Chromium libraries)
Create virtual environment and install dependencies
# Full pipeline: PDF → HTML → PDF/PNG/DOCX
uv run python run.py --pdf_path input.pdf --output_dir ./output
# Markdown → HTML with template
uv run python run.py --md_path input.md --output_dir ./output --template templates/doubao.txt
# Generate poster image (Gemini)
uv run python run.py --md_path input.md --output_dir ./output \
--output_type poster_image --style academic --density medium
# Generate slides images (Gemini)
uv run python run.py --md_path input.md --output_dir ./output \
--output_type slides_image --style doraemon --slides_length medium
# Generate XHS slides
uv run python run.py --md_path input.md --output_dir ./output \
--output_type xhs_slides --style academic --slides_length short
# Convert HTML to multi-modal
uv run python -m mm_output.cli input.html --format all --output-dir ./mm_outputs
4. Run Tests
bash
bash run.sh
Command Reference
Main Entry: run.py
Command
Description
uv run python run.py --pdf_path FILE --output_dir DIR
Parse PDF to HTML + multi-modal outputs
uv run python run.py --md_path FILE --output_dir DIR
Parse Markdown to HTML + multi-modal outputs
--output_type poster_image
Generate poster image (Gemini)
--output_type slides_image
Generate slides images (Gemini, 16:9)
--output_type xhs_slides
Generate XHS slides (Gemini, 9:16 + HTML)
--template templates/NAME.txt
Use specific template
--style {academic,doraemon,minimal}
Visual style for image generation
--density {sparse,medium,dense}
Content density for poster_image
--slides_length {short,medium,long}
Slide count: short=5-8, medium=8-12, long=12-15
--text_model MODEL
Override LLM model
--language {auto,zh,en}
Output language
Multi-modal Conversion: mm_output.cli
bash
# Convert HTML to specific format
uv run python -m mm_output.cli input.html --format pdf --output-dir ./out
# Convert to all formats
uv run python -m mm_output.cli input.html --format all --output-dir ./out
# Supported formats: pdf, png, docx, pptx, all
Environment Setup (UV)
This project uses UV for Python package management.
Manual Setup (if install.sh fails)
Note: The uv.lock file is renamed to uv.lock.txt to avoid tracking. Before using UV, rename it back: