Skip to main content

SVG Jinja templates + YAML config = PDF documents

Project description

pdfbaker

PyPI version Python Downloads tests codecov OSSF Scorecard pip-audit bandit Last commit License

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 your templates 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 --keep-build-files (or --debug).

Examples

For working examples, see the examples directory:

Create all PDFs with:

pdfbaker bake examples/examples.yaml

Documentation

( on GitHub )

Development

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/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.8.10.tar.gz (151.9 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.8.10-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pdfbaker-0.8.10.tar.gz
  • Upload date:
  • Size: 151.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pdfbaker-0.8.10.tar.gz
Algorithm Hash digest
SHA256 49b26a4ed07b609d07a6e4de5dff3d99b70be4abe6f279a13fa69b92695b6f1c
MD5 beda167c91d01ae97e4f9615d4111a20
BLAKE2b-256 fee491021c2f74c99108499f3a93f1c71ca19ae5d14f53dda55bd94ad1435428

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfbaker-0.8.10.tar.gz:

Publisher: semantic-release.yaml on pythonnz/pdfbaker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pdfbaker-0.8.10-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pdfbaker-0.8.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e42e302e9f8569d6cf584583bcdffa4003b9f208be253d6c9e80270ed07e7e8a
MD5 b7bc7b6ec68593755bf30ea6151ce4f0
BLAKE2b-256 2ef2dfca507b7d9cefb0f220d1a25a164713ea6c751957a193ddedb9fd2a68cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfbaker-0.8.10-py3-none-any.whl:

Publisher: semantic-release.yaml on pythonnz/pdfbaker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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