Skip to content

digitalservicebund/ris-pdf-printservice

Repository files navigation

Pdf print service

Rest API service that converts HTML and CSS into high‑quality PDFs.

Prerequisites

To build and run the application, you'll need:

  • Docker, for infrastructure or running a containerized version of the entire application locally
  • A Python3 Installation

If you would like to make changes to the application, you'll also need:

  • talisman, for preventing accidentially committing sensitive data
  • lefthook, for running Git hooks
  • gh, for checking the pipeline status before pushing
  • docker, for running containers-
  • python as runtime
  • pango stack for pdf printing
  • uv Python package and project manager

If you use Homebrew, you can install all of them like this:

brew install talisman lefthook gh
brew install python
brew install pango cairo harfbuzz fontconfig freetype pkg-config
brew install --cask docker # or `brew install docker` if you don't want the desktop app

Install uv by running:

curl -LsSf https://astral.sh/uv/install.sh | sh

or

brew install uv

Once you installed the prerequisites, make sure to initialize Git hooks. This will ensure any code you commit follows our coding standards, is properly formatted, and has a commit message adhering to our conventions:

lefthook install

Developing

Download dependencies:

uv sync

Start server:

uv run python -m fastapi run src/main.py --host 0.0.0.0 --port 8080

Test manually:

curl -X POST http://localhost:8080/pdf  -F "html=@./sbgg.html" -F "css=@./style.css" -o sbgg.pdf

Run tests:

uv run pytest

Run linter

uv run flake8 ./src

Run formatter

uv run black ./src

About

Rest API service that converts HTML and CSS into high‑quality PDFs and streams the result as a response.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 2

  •  
  •