Install & Compatibility
Where this runs
tested against v5.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✕ build_error
86MB installed
● package 86MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
RML2PDF
✓ from z3c.rml import rml2pdf
✗ from z3c.rml.rml2pdf import RML2PDF
RML2PDF is obtained via the module, not directly imported; use the module-level functions.
story
✓ from z3c.rml import story
✗ import z3c.rml.story
Access story elements via attribute of the module, not submodule import.
Minimal example: create a document, add a paragraph, and render to PDF.
from z3c.rml import rml2pdf, story
from io import BytesIO
# Create a simple RML document (this is a Pythonic representation, not raw XML)
doc = story.DocTemplate(
pagesize=(595.27, 841.89), # A4
title="Hello World"
)
story = doc.story
story.append(story.Paragraph("Hello, World!", style=story.ParagraphStyle(name='Normal')))
# Generate PDF
buf = BytesIO()
rml2pdf.go(doc, buf)
buf.seek(0)
print("PDF generated, size:", len(buf.read()))
z3c-rml --version
Errors
Common errors & fixes
AttributeError: module 'z3c.rml' has no attribute 'story'
Incorrect import. The library is structured so that `z3c.rml` is a namespace package; you must import submodules explicitly.
fixUse `from z3c.rml import story` instead of `import z3c.rml.story`.
ImportError: cannot import name 'RML2PDF' from 'z3c.rml'
Trying to import the old class directly from the package root. In modern versions, use `from z3c.rml import rml2pdf`.
fixReplace `from z3c.rml import RML2PDF` with `from z3c.rml import rml2pdf`.
TypeError: go() takes at least 2 positional arguments (0 given)
Calling `rml2pdf.go()` without arguments or with incorrect arguments. The function expects a doc and an output.
fixCorrect usage: `rml2pdf.go(doc, output)` where doc is a story.DocTemplate and output is a file path or BytesIO.
Upgrade
Version history
5.1.1latest on PyPI · released May 21, 2026
Audit
Dependencies
reportlabrequiredRequired for PDF generation from RML