Create PDF documents from YAML-configured SVG templates.
pdfbaker is available on PyPI and can be installed using pipx:
pipx install pdfbakerIf you don't have pipx yet, install it first:
sudo apt install pipx
pipx ensurepathIf you are using Windows, GTK needs to be installed: GTK for Windows Runtime Environment Installer
- Choose Install GTK+ libraries
- Tick to setup path (otherwise add the install dll folder manually)
- Choose your installation location
- Complete the installation
-
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 your templates 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 <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 --keep-build-files (or --debug).
For working examples, see the examples directory:
- minimal - Basic usage
- regular - Standard features
- variants - Document variants
- custom_locations - Custom file/directory locations
- custom_processing - Custom processing with Python
Create all PDFs with:
pdfbaker examples/examples.yaml- Overview - Start here
- Configuration Reference - All available settings
- Document Variants - Create multiple versions of the same document
- Custom Processing - Provide page content from anywhere
( on GitHub )
All source code is 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/activateInstall development dependencies:
uv sync --devRun tests:
pytestView test coverage:
pytest --cov=pdfbaker --cov-report=term-missingIf you want to commit changes, install pre-commit (maybe using uv) and run
pre-commit installThis ensures the same checks run locally as in GitHub CI.