Skip to main content

SVG Jinja templates + YAML config = PDF documents

Project description

pdfbaker

Create PDF documents from YAML-configured SVG templates.

Quickstart

Installation

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

Optional Dependencies

  • 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
    

Basic Usage

  1. Create your document design in an SVG editor
  2. Replace text with variables using Jinja2 (e.g., {{ title }})
  3. Configure your content in YAML
  4. 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.

Examples

For working examples, see the examples directory.
Create all PDFs with:

pdfbaker bake examples/examples.yml

Documentation

( on GitHub )

Development

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

Tests

Run tests:

pytest

View test coverage:

pytest --cov=pdfbaker --cov-report=term-missing

Pre-commit hook

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfbaker-0.4.0.tar.gz (70.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdfbaker-0.4.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file pdfbaker-0.4.0.tar.gz.

File metadata

  • Download URL: pdfbaker-0.4.0.tar.gz
  • Upload date:
  • Size: 70.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.13

File hashes

Hashes for pdfbaker-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0d85d372acc1922c0a77c1470e8f35f11aea8e5ceb79b27d9d767421c8c0ca8f
MD5 a4b0ebb309c0da51da5c66e8b7500f75
BLAKE2b-256 d871592cb07323fd552defe7323c5501deba61216f942b9e452d60e3e8814956

See more details on using hashes here.

File details

Details for the file pdfbaker-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pdfbaker-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.13

File hashes

Hashes for pdfbaker-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fc43dd08238cd53002b98d049b038acf227ab7c41ca77e220214237e0b2adda
MD5 92bf42ef3d3b651af617be250fd78dbd
BLAKE2b-256 2525b965f53949839a9de3aa757a58a1f94f427aa5065cd0082b026f5281daba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page