Skip to main content

pdfox (Python)

Native HTML-to-PDF rendering for Python — no Chromium, no headless browser, no external binary. A thin PyO3 wrapper over the Rust pdfox-core engine.

Install

pip install pdfox

Wheels are abi3 (abi3-py38), so a single wheel per platform works on CPython 3.8 and newer.

Usage

import pdfox

# Simplest: HTML string in, PDF bytes out.
pdf: bytes = pdfox.render_html("<h1>Hello</h1>")

# Resolve relative <img>/<link> paths against a directory.
pdf = pdfox.render_html(html, base_dir="./assets")

# Full control — returns an object with .pdf and .diagnostics.
result = pdfox.render(
    html,
    base_dir="./assets",
    allow_remote=True,
    deny_list=["internal.corp"],
    pdf_a=True,
    template_vars={"customer": "Acme Inc."},
)
result.pdf            # bytes
result.diagnostics    # list[Diagnostic]
result.has_errors()   # bool

# Convenience: write straight to a file.
pdfox.render_to_file(html, "out.pdf", base_dir="./assets")

Diagnostics

render() never raises for a missing asset or an unsupported CSS feature — it degrades gracefully and records a Diagnostic:

for d in result.diagnostics:
    print(d.severity, d.kind, d.url, "—", d.reason)

kind ∈ {"image", "font", "stylesheet", "css_feature"}; severity ∈ {"warning", "error"}.

Genuinely broken input raises a pdfox.PdfoxError subclass (ParseError, LayoutError, EmissionError, FontError, ImageError, IoError).

Concurrency

render() and render_html() release the GIL while rendering (the work is pure-Rust and CPU-bound, ~70 ms for a typical page), so they parallelise across threads. In async frameworks, call them from a thread pool:

pdf = await loop.run_in_executor(None, pdfox.render_html, html)

Develop

# From bindings/python/
pip install maturin pytest
maturin develop            # builds the extension into the active venv
pytest                     # runs tests/

On a just-released CPython where the pinned PyO3 has no version table yet, set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 before building.

Metadata

Release files for pdfox 0.1.0

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

Built distributions (wheels)

Table of built distributions (wheels) for pdfox 0.1.0
File Interpreter ABI Platform Actions
pdfox-0.1.0-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for pdfox-0.1.0-cp38-abi3-win_amd64.whl
pdfox-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for pdfox-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pdfox-0.1.0-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for pdfox-0.1.0-cp38-abi3-macosx_11_0_arm64.whl

Total release size: 25.3 MB

Release files / pdfox-0.1.0-cp38-abi3-win_amd64.whl

Download URL pdfox-0.1.0-cp38-abi3-win_amd64.whl
Size 8.1 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a07df67a75faa0143dfff688f841ab12147414d9d0f1436607c3bfca5da77808
BLAKE2b-256 checksum
How to use checksums
09e9f712a478f94c9ececd33bd63e6fb28fe4f6b98ddaab66f7bae32c2c6c0a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 30, 2026.

Transparency log

Release files / pdfox-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pdfox-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 8.8 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
8b97735bdab4ff51aa5ba9d13460854cdcf6f37373d7e6040f3f666709aa899a
BLAKE2b-256 checksum
How to use checksums
0c43b9434f1c14143702fc2e17abb4ca230b38ff55797974ba21ad009120fd50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 30, 2026.

Transparency log

Release files / pdfox-0.1.0-cp38-abi3-macosx_11_0_arm64.whl

Download URL pdfox-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Size 8.4 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d3a12e20ede4d1648c6d774b4d5fb3a5ead4624b90aa24f8df6cef5c1f73b269
BLAKE2b-256 checksum
How to use checksums
4467b042690567d908684bfd3beb63316b057da7fc12173199a479c72f02908e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 30, 2026.

Transparency log

Security for pdfox 0.1.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.

Full provenance

All 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for pdfox-0.1.0-cp38-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 30, 2026.

Transparency log

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.1.0 This release

3 release files Full 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