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.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| turbo_html2pdf-0.3.6.tar.gz | 4.2 MB | Without provenance | Details for turbo_html2pdf-0.3.6.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| turbo_html2pdf-0.3.6-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details for turbo_html2pdf-0.3.6-cp38-abi3-win_amd64.whl |
| turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details for turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| turbo_html2pdf-0.3.6-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details for turbo_html2pdf-0.3.6-cp38-abi3-macosx_11_0_arm64.whl |
Total release size: 28.7 MB
Release files / turbo_html2pdf-0.3.6.tar.gz
| Download URL | turbo_html2pdf-0.3.6.tar.gz |
|---|---|
| Size | 4.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f264b41481dd75baf1c370f31d98159659bd38632919ed2cccde14ae4b3d84ba
|
|
BLAKE2b-256 checksum How to use checksums |
481443c5da5a1063b60e133c6a2791b47427c7d10b61dbb55697bf3de4a39477
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / turbo_html2pdf-0.3.6-cp38-abi3-win_amd64.whl
| Download URL | turbo_html2pdf-0.3.6-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 5.9 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
49f30e5e1edb4be2876cdc0bdbe17f4c032a93fd9ed799e890d6009583cda5ab
|
|
BLAKE2b-256 checksum How to use checksums |
98eeda876536498cdb40bd1ca424ca3b9d83c7a42b578942a9e3ed537b8aa557
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
345e1105d60af750f32042003fe2d6adf1b6b9eef9f280360d8332db044df92b
|
|
BLAKE2b-256 checksum How to use checksums |
418f1f5151095d1d6a93f55fa8e5ac65ff2076c58d73acceb8ca294d1e9a66aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | turbo_html2pdf-0.3.6-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3471b30bb0165719b796bbdadbdae0fe2fe074ef29f8fded7e30951bdd347123
|
|
BLAKE2b-256 checksum How to use checksums |
3362e1e58104079dc5201470d0b343202267817bec7c95576eb43be77623bf1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / turbo_html2pdf-0.3.6-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | turbo_html2pdf-0.3.6-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
25f7b8f64ae9d895f3484fad7c07c768f086984f25d0df9e3d32814739d2d552
|
|
BLAKE2b-256 checksum How to use checksums |
b72662b0c2cd43c2bd8ff5077bb0212238c2a7769048058844e02a119d34513d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Security for turbo-html2pdf 0.3.6
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.