Create PDF documents from YAML-configured SVG templates.
pdfbaker is available on PyPI and can be installed using pipx:
pipx install pdfbaker
If you don't have pipx yet, install it first:
sudo apt install pipx
pipx ensurepath
-
For SVG to PDF conversion, CairoSVG is used by default. If you need Inkscape instead, install it:
sudo apt install inkscape
-
For PDF compression, install Ghostscript:
sudo apt install ghostscript
-
If you want to embed particular fonts, they need to be installed. For example for Roboto fonts:
sudo apt install fonts-roboto
- Create your document design in an SVG editor
- Replace text with variables using Jinja2 (e.g.,
{{ title }}
) - Configure your content in YAML
- Generate PDFs with:
pdfbaker bake <config_file>
This will produce your PDF files in a dist/
directory where your configuration file
lives. It will also create a build/
directory with intermediate files, which is only
kept if you specify --debug
.
For working examples, see the examples directory.
Create all PDFs with:
pdfbaker bake examples/examples.yml
( on GitHub )
This project uses uv for dependency management. The
uv.lock
file ensures reproducible builds.
Create and activate the virtual environment:
uv venv
source .venv/bin/activate
Install development dependencies:
uv sync --dev
Run tests:
pytest
View test coverage:
pytest --cov=pdfbaker --cov-report=term-missing
If you want to commit changes, install pre-commit and run
pre-commit install
This ensures the same checks run locally as in GitHub CI.