Standalone Rust CLI for rendering persisted report-template payloads to PDF
Project description
report_pdf_renderer (rust)
Standalone PDF renderer for persisted report templates.
Goals
- Fast standalone binary (Rust)
- Render report sections with explicit spacing/layout rules
- Embed frame images (single image or grid)
- Render template sentence sections with variable substitution
- Callable from Python (
subprocess) without importing heavy PDF libs
Quick Start (with devenv)
This repo includes a devenv.nix with Rust tooling.
cd lx-report-generator
devenv shell
Then build and run:
cargo build --release
./target/release/report_pdf_renderer \
--input examples/report_payload.json \
--output /tmp/report_example.pdf
Open the generated file:
xdg-open /tmp/report_example.pdf
Install From PyPI
Once published, install the renderer with:
python -m pip install report-pdf-renderer
The wheel installs the Rust binary as report_pdf_renderer on your Python
environment's PATH:
report_pdf_renderer \
--input examples/report_payload.json \
--output /tmp/report_example.pdf
Build (separate install, no devenv)
cargo build --release
# binary: target/release/report_pdf_renderer
CLI
report_pdf_renderer --input payload.json --output report.pdf
Run From Anywhere
Either:
./target/release/report_pdf_renderer --input payload.json --output report.pdf
or install/copy the binary to your PATH:
install -m755 target/release/report_pdf_renderer ~/.local/bin/report_pdf_renderer
report_pdf_renderer --input payload.json --output report.pdf
Backend integration can also point to a custom path via:
export ENDOREG_REPORT_PDF_RENDERER_BIN=/absolute/path/to/report_pdf_renderer
When installed from PyPI in the same runtime environment as the backend, Python
callers can either rely on report_pdf_renderer being available on PATH or
set the integration variable explicitly:
export ENDOREG_REPORT_PDF_RENDERER_BIN="$(command -v report_pdf_renderer)"
Input JSON (snake_case)
Top-level keys:
title: stringsubtitle: optional stringheader: optional objectlayout: optional object (page,margins_mm, spacing values)assets_root: optional path for relative image lookupsblocks: ordered content blocks
Supported block types
headingparagraphspacersentence_group(template sentences + variables)imageimage_grid
sentence_group
{
"type": "sentence_group",
"section_title": "Findings",
"variables": {"segment": "sigma", "size_mm": "8"},
"sentences": [
{"template": "Polyp in {segment}.", "enabled": true},
{"template": "Estimated size {size_mm} mm.", "enabled": true}
]
}
image_grid
{
"type": "image_grid",
"title": "Frames",
"columns": 3,
"image_paths": ["frames/f_001.png", "frames/f_002.png"],
"captions": ["frame 1", "frame 2"]
}
Notes
- This renderer uses a lightweight layout engine (text flow + page breaks).
- For now it uses built-in PDF fonts (Helvetica).
- If an image fails to load, the renderer logs and continues.
- Integrate from Python by writing a JSON payload to a temp file and invoking the binary.
assets_rootis used to resolve relative image paths (e.g. frame images inimage_grid).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file report_pdf_renderer-0.1.0.tar.gz.
File metadata
- Download URL: report_pdf_renderer-0.1.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
742dbff54ae310a23fcc2a6f437f110ee406df0a9aca33f2d5595f7087e12eae
|
|
| MD5 |
ebec834ded9fca70afcb469098e44e00
|
|
| BLAKE2b-256 |
28d31277fa6ece2964fb7b72dc206fe065cd5f7885e74a2fa31d80daa9c653a2
|
File details
Details for the file report_pdf_renderer-0.1.0-py3-none-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: report_pdf_renderer-0.1.0-py3-none-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: Python 3, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb8983e58b9ad0678ab1adfab11093612d93dec78ee876a746dd135df406ffa9
|
|
| MD5 |
14c5e4e143ef95bf71a3d40f363835ac
|
|
| BLAKE2b-256 |
fa4af6efbc1a58a5ccc70d7baa6335b4a9e56ed6bb4e97224d4862d8d83fd655
|