radarini/printer
7
0
Fork
You've already forked printer
0
No description
  • Python 90%
  • Shell 5.9%
  • Dockerfile 4.1%
lino 8491d531fa
All checks were successful
/ test (push) Successful in 7s
chore: change naming to booklet
2026年01月05日 05:55:41 +01:00
.forgejo/workflows fix: remove app user and make output dir variable 2025年12月01日 18:12:21 +01:00
lib init 2025年12月01日 16:12:48 +01:00
.dockerignore init 2025年12月01日 16:12:48 +01:00
.gitignore init 2025年12月01日 16:12:48 +01:00
.python-version init 2025年12月01日 16:12:48 +01:00
Dockerfile fix: remove app user and make output dir variable 2025年12月01日 18:12:21 +01:00
pyproject.toml feat: add command to update all translation files 2025年12月03日 01:59:01 +01:00
README.md fix: style readme img 2025年12月02日 03:53:31 +01:00
run.py chore: change naming to booklet 2026年01月05日 05:55:41 +01:00
uv.lock feat: add command to update all translation files 2025年12月03日 01:59:01 +01:00
watch.sh feat: add watcher script 2025年12月02日 03:51:04 +01:00

Printer

Radarini

Printer helps you to generate beautifully styled PDF booklets from your MD-file input.

Features:

  • Manage content in Markdown files
  • Style with CSS
  • Translate with PO-files
  • Load additional remote content using placeholders

Run

You can run the printer in various ways, as described below. Regardless of how the printer is executed, it is always important to set the CONTENT_DIR environment variable. (See configuration for more details.) Further commands will be displayed in the help text of the executed printer.

A: Python

  1. Install the python dependencies with uv uv sync && source .venv/bin/activate
  2. Install pandoc (Tested with version 3.1.11.1).
  3. Run the script python run.py.

B: Docker

To run with docker execut the following.

docker run \
--volume $CONTENT_DIR:/root/content \
-e CONTENT_DIR="/root/content" \
codeberg.org/radarini/printer:latest \
uv run run.py

C: Pipeline

You can easily integrate the docker image in your CI-pipelines. For a gitlab reference see the Mutual Aid - Berlin Survival Guide.

D: Watch

For easy editing there is a watch script that regenerates the PDFs automatically on file change. This could be executed with Docker or Python. Run bash watch.sh to start the watcher. The package inotifywait is required.

Configure

The printer expects the following file structure with CONTENT_DIR as the root. If this variable is not set, it falls back to the current directory.

CONTENT_DIR/
├─ code/
│ ├─ template.html
│ ├─ static/
│ │ ├─ style.css
├─ translations/
├─ 1_first_chapter.md
├─ 2_second_chapter.md
│ ...

You could use an other structure, by setting the path for the files explicitly. See run.py for a list of available variables.

Style

There are two files to define the style of the generated PDFs.

  1. template.html - A jinja2 template to generate the transitional HTML file. The string Title and the list Chapters are available vars in the context of the template.
  2. style.css - The CSS file for styling. To generate PDFs from HTML weasyprint is used. See the weasyprint samples for reference.

Translate

Translations are managed with gettext in PO-files. You can edit them with tools like poedit or weblate. You always need a POT-file as basis. See the printer help text for commands to create this file.

Attribution