🌿 pdfgen v1.1.0 · MIT
Markdown + template → PDF, with an automatic post-generation verifier: no silent tofu, no missing content, ever.
What it does
- Verified output: every PDF is re-opened after generation and its text extracted (PyMuPDF/fitz). 0 U+FFFD "tofu" characters, 100% of expected content lines present (whitespace-normalized matching), embedded fonts reported.
- CJK-first: templates ship CJK font stacks (Songti SC) — Chinese renders correctly out of the box.
- 3 templates:
report,invoice,product_sheet; bilingual FR/中文 fixtures included. - JSON verification report: pages, fonts, tofu hits, missing lines, CJK presence.
- Self-testing: includes a negative test proving the verifier really detects anomalies. Exit codes:
0verified OK ·1verification failed ·2bad input.
Install (pip, v1.1+)
pip install git+https://mandrilly.com/git/pdfgen.git
Installs a pdfgen command (deps: weasyprint, markdown, PyMuPDF; on macOS export DYLD_LIBRARY_PATH=/opt/homebrew/lib so pango is found):
pdfgen --template product_sheet --meta meta.json --body body.md -o out.pdf
Quick start (from source)
python3.12 pdfgen.py \
--template report \
--meta fixtures/report_meta.json \
--body fixtures/report_body.md \
-o /tmp/report.pdf --verify-report /tmp/report.verify.json
Requires Python 3.12 with weasyprint, markdown, PyMuPDF (fitz); pango installed (brew install pango on macOS).
Tests
bash run_tests.sh # 3 templates + negative test → "TOUS LES TESTS OK"
Source
git clone https://mandrilly.com/git/pdfgen.git