Enterprise PDF for Python

The enterprise PDF library
Python doesn't have.

Generate archival PDF/A, sign documents with PAdES, encrypt with AES-256 and produce accessible PDF/UA from plain Python. One memory-safe core, the same behavior as every other binding, running entirely on your servers: no per-document SaaS fees, no data leaving your network, no AGPL strings.

Install from PyPI. The wheel bundles the native core, nothing to compile.
pip install rustpdf
Validated by independent tools: veraPDFpdfsigopenssl cmsqpdfmutool

Why Python teams pick rust-pdf

Python is everywhere documents are generated: invoices, reports, statements, e-invoices for tax authorities. But the regulated-grade building blocks (PDF/A, juridically-valid signatures, AES-256, PDF/UA) are scattered across half-maintained libraries, fragile HTML→PDF via headless Chrome, or per-document SaaS that ships your sensitive data off-site.

rust-pdf gives you all of it through one pip install, with a single offline license that unlocks the corporate features. The native core releases the GIL on every call, so you can render thousands of documents in parallel.

  • Native, not a wrapper around Chrome: no headless browser, no gigabytes of RAM per worker.
  • Runs on your servers: documents never leave your network and nothing phones home, ideal for LGPD/GDPR, fintech and health.
  • No AGPL trap: a commercial per-application license, never the AGPL of iText or the per-server billing of Aspose.
  • Deterministic output: the same input always produces the same bytes, so you can diff and audit it.
  • Free to build with: everyday PDF generation is free forever; you only license the regulated-grade features.

Free to build with. Licensed when you ship.

Prototype and generate everyday PDFs for free. When you need archival, signatures, encryption or accessibility, one license unlocks them all in Python and every other binding.

Community free

  • Pages & vector graphics
  • Embedded/subset fonts, Unicode shaping
  • Justified paragraphs & tables
  • Images (JPEG/PNG/alpha/16-bit)
  • Merge / split / rotate
  • Text extraction & optimize

Corporate licensed

  • PDF/A: 1b / 2b / 2a / 3b / 3a / 4 / 4e / 4f archival
  • Digital signatures: PKCS#7, visible & multiple
  • PAdES: B-B / B-LT / B-LTA + RFC 3161 timestamps
  • Encryption: RC4 / AES-128 / AES-256 (R6)
  • Accessibility: Tagged PDF / PDF/UA-1
  • AcroForm: fields with generated appearances
  • Validate & convert: verify signatures, PDF→PDF/A, ZUGFeRD/Factur-X
  • Process: redaction, image extraction, form fill/flatten, page→PNG

Try every licensed feature free for 5 days.

Get a trial token by email and unlock PDF/A, digital signatures, encryption and accessibility in Python. No account, no card required.

Author a tagged, signed PDF/A in a few lines of Python

# pip install rustpdf
import rustpdf

with rustpdf.Document() as doc:
    doc.pdfa(rustpdf.PdfaLevel.A2A).tagged().set_info(title="Q3 Report")
    f = doc.add_font_file("Roboto-Regular.ttf")
    doc.add_page()
    doc.show_text(f, 26, 72, 760, "Annual report", heading_level=1)
    doc.show_text(f, 11, 72, 720, "Olá, açúcar e café")  # shaped, kerned, Unicode
    data = doc.to_bytes()

# Encrypt with AES-256, or sign with PAdES (same offline license):
with rustpdf.EditableDoc.load(data) as ed:
    ed.encrypt(owner="owner-secret", method=rustpdf.Encryption.AES256)
    ed.save("secured.pdf")

The full Python reference (fonts, images, forms, manipulation, encryption and signatures) lives in the Python docs.

Fits your Django, FastAPI or Flask stack

rust-pdf is a plain Python package: it builds a document in memory and hands you bytes. That drops straight into a Django HttpResponse, a FastAPI StreamingResponse or a Flask send_file, with no temp files and no subprocess. Because the native core releases the GIL on every call, a Celery, RQ or Dramatiq worker can render statements and invoices across all your cores at once.

Install once with pip install rustpdf; the wheel bundles the native core per platform, so there is nothing to compile in CI, containers or serverless. It runs the same on a laptop, a Gunicorn worker and an AWS Lambda image.

# FastAPI: stream a PDF/A straight from a route
from fastapi import FastAPI
from fastapi.responses import Response
import rustpdf

app = FastAPI()

@app.get("/invoice.pdf")
def invoice():
    with rustpdf.Document() as doc:
        doc.pdfa(rustpdf.PdfaLevel.A2B)
        f = doc.add_font_file("Roboto-Regular.ttf")
        doc.add_page()
        doc.show_text(f, 18, 72, 760, "Invoice #1024")
        return Response(doc.to_bytes(), media_type="application/pdf")

Common PDF tasks in Python

Each guide below is a focused, copy-paste walkthrough in Python, backed by the same Rust core. Start with one task and grow into the rest.

Start building in Python

pip install rustpdf and ship your first archival PDF today. Free for everyday generation; license the corporate features when you go to production.

Python PDF library FAQ

Does it release the GIL for parallel rendering?

Yes. The native core releases the GIL on every call, so threads, a Gunicorn/Uvicorn worker pool, or a Celery/RQ queue can render many documents at once and use every core. Each Document or EditableDoc owns its own handle, so give each task its own object.

Will it work in Docker, AWS Lambda and serverless?

Yes. pip install rustpdf pulls a prebuilt wheel with the native core bundled per platform, so there is nothing to compile in your image and no system PDF tools to install. It runs fully offline, which keeps cold starts small and documents inside your own environment.

Can I use it from async views (FastAPI, Starlette)?

Yes. Calls are synchronous and fast; for heavy documents in an async handler, offload to a thread (for example asyncio.to_thread) so you never block the event loop. The call returns plain bytes, ready to stream back in a response.