Skip to main content

turbo-html2pdf (Python)

Native HTML/CSS-to-PDF engine with a Jinja-compatible templating DSL. PyO3 binding over turbo-html2pdf-core. Version 0.8.3 uses the published turbo-dom 0.8.3 DOM/layout crates. It shares the Node package's compile/render pipeline, with bundled fonts, PDF/A, PDF/UA, CMYK, endnotes, internal links, append and encryption; Node's post-render stamp API is not exposed by this binding.

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.8.3

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.8.3
File Size Uploaded Provenance Actions
turbo_html2pdf-0.8.3.tar.gz 352.6 kB Without provenance Details for turbo_html2pdf-0.8.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for turbo-html2pdf 0.8.3
File Actions
turbo_html2pdf-0.8.3-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for turbo_html2pdf-0.8.3-cp38-abi3-win_amd64.whl
turbo_html2pdf-0.8.3-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.8.3-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
turbo_html2pdf-0.8.3-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for turbo_html2pdf-0.8.3-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
turbo_html2pdf-0.8.3-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for turbo_html2pdf-0.8.3-cp38-abi3-macosx_11_0_arm64.whl

Total release size: 28.8 MB

Release files / turbo_html2pdf-0.8.3.tar.gz

Download URL turbo_html2pdf-0.8.3.tar.gz
Size 352.6 kB
Tags Source
SHA-256 checksum
How to use checksums
63f89f06aac433eda91065329c7c73e34a37e9adeb665cd5ef199239c1d6be09
BLAKE2b-256 checksum
How to use checksums
f2a80f69c5b9e4dbabe3fcdf45f8280995e32e0eaea7598828620d4c41e47f9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

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

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

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

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

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

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

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

Download URL turbo_html2pdf-0.8.3-cp38-abi3-macosx_11_0_arm64.whl
Size 7.0 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1e82fc02cc85f9734d600481377b6a5f3ce7df7f432f989ff0da0d33da0b7fc3
BLAKE2b-256 checksum
How to use checksums
fe9b023a1b3567fe1b9db17a4bb72cd160a69faea5168219d679dce8c8838fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.16.0

Security for turbo-html2pdf 0.8.3

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.8.3 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