Skip to main content

turbo-html2pdf (Python)

Native HTML/CSS-to-PDF engine with a Jinja-compatible templating DSL. PyO3 binding over the turbo-pdf Rust core; mirrors the Node turbo-html2pdf package 1:1.

import turbo_html2pdf as t

# Compile once, render many times.
prog = t.compile("<p>Hello {{ data.name }}</p>")
pdf = prog.render(data={"name": "world"})       # -> bytes, starts with b"%PDF"

# Warm fonts once, reuse the handle across renders.
fonts = t.Fonts.load([open(p, "rb").read() for p in font_paths])
pdf = prog.render(
    data={"name": "world"},
    css="body { font-family: font0 }",
    fonts=fonts,
)

# One-shot: compile + render in a single call.
pdf = t.render("<p>{{ data.x }}</p>", data={"x": 1})

# Inspect non-fatal lints + page count.
pdf, diagnostics, page_count = prog.render_full(data={"name": "world"})

Fatal compile/render faults raise TurboPdfError carrying .code (a stable string such as "TemplateSyntax") and .span ({"line", "col", "byte_offset"}). Non-fatal lints are returned by render_full, never raised.

API

Surface Signature
compile(template_html, opts=None) -> Program
Program.render(data=None, css="", fonts=None, images=None, meta=None, now=None) -> bytes
Program.render_full(...) -> (bytes, list[dict], int)
Program.has_header() / Program.has_footer() -> bool
render(template_html, ...) one-shot -> bytes
Fonts.load([bytes, ...]) warm registry -> Fonts

Building from source

pip install maturin
maturin develop --manifest-path crates/turbo-pdf-py/Cargo.toml
python -m pytest crates/turbo-pdf-py/tests

Metadata

Release files for turbo-html2pdf 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for turbo-html2pdf 0.6.0
File Size Uploaded Provenance Actions
turbo_html2pdf-0.6.0.tar.gz 305.5 kB Without provenance Details for turbo_html2pdf-0.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for turbo-html2pdf 0.6.0
File Actions
turbo_html2pdf-0.6.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for turbo_html2pdf-0.6.0-cp38-abi3-win_amd64.whl
turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
turbo_html2pdf-0.6.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for turbo_html2pdf-0.6.0-cp38-abi3-macosx_11_0_arm64.whl

Total release size: 27.8 MB

Release files / turbo_html2pdf-0.6.0.tar.gz

Download URL turbo_html2pdf-0.6.0.tar.gz
Size 305.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5132869a56dc6f682b22022d3e82bd7b76b30d9f9b052d44e70011513ea30044
BLAKE2b-256 checksum
How to use checksums
a8184e3746a54fcf0ee0ed6e866285931cc5922b83c28e3eef253f34a725fc45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / turbo_html2pdf-0.6.0-cp38-abi3-win_amd64.whl

Download URL turbo_html2pdf-0.6.0-cp38-abi3-win_amd64.whl
Size 6.7 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
058d3ce07a4edd07a469a7fba435114be4df44eaa9dde67c3d89a810786fe027
BLAKE2b-256 checksum
How to use checksums
e82d652955aaaf0d5e7a6f6a4074075b983194498fd42d9b81a43cdfacc34135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 7.0 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fc7d39e98e19dfd32152407c3dc33010a305c3eb90ede92557fa7198e9854fea
BLAKE2b-256 checksum
How to use checksums
1048b68e580c49a3b841433bc84ff981116c18aca8e3ce1a83abf43cefbb2b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL turbo_html2pdf-0.6.0-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 7.0 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9c7d6c3bf89c874b21bc5cc591fc39725fc3e71617006ed0235e29380c8dca69
BLAKE2b-256 checksum
How to use checksums
45949ec03ba69e411fa113496e368e95a5a227f96a165e55602646a9e7bbe0a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Release files / turbo_html2pdf-0.6.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL turbo_html2pdf-0.6.0-cp38-abi3-macosx_11_0_arm64.whl
Size 6.8 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
047588bcf27e5c626aacdb72491c1022e0af06651b21ef4fede36ad019204635
BLAKE2b-256 checksum
How to use checksums
67ecc16e822effced899bda42708ff66f7aa1d469881d15809a8a36417d9abf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Security for turbo-html2pdf 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page