# xhtml2pdf

Python HTML\-to\-PDF converter built on ReportLab with page templates, frames and resource\-access policies\.

ID: Q1453 · Revision: 1533

Type: software · License: Apache\-2\.0[^license] · Status: active

Website: https://xhtml2pdf.readthedocs.io/



xhtml2pdf converts HTML and supported CSS into PDFs using Python and the ReportLab toolkit, with pypdf among its dependencies\. It provides a Python interface and command\-line entry points for template\-driven document generation\. Its page\-and\-frame model and renderer\-specific controls mean that browser layout compatibility must be assessed rather than assumed\.[^home][^layout][^package]

## Capabilities and substitutions

### Page templates and frames — supported

Content flows through rectangular content frames; static frames provide recurring content\.[^layout]

Use case: Python HTML\-template PDF generation · Platforms: Python 3\.10\+; dependencies vary by platform · Region: Version, build and integration requirements apply

### Interactive form controls — limited

Supported named controls become PDF fields; radio inputs are drawn without an interactive radio group\.[^reference]

Use case: Python HTML\-template PDF generation · Platforms: Python 3\.10\+; dependencies vary by platform · Region: Version, build and integration requirements apply

### Denied\-resource handling — limited

Denied assets are warned about and omitted while rendering continues; successful completion need not mean every asset loaded\.[^security]

Use case: Python HTML\-template PDF generation · Platforms: Python 3\.10\+; dependencies vary by platform · Region: Version, build and integration requirements apply

### [Substitute for WeasyPrint](/weasyprint) — limited

Can cover compatible HTML\-template PDF generation in Python, with different page\-template syntax and layout limits\.[^home][^layout][^weasy]

Use case: Python HTML\-template PDF generation · Platforms: Python 3\.10\+; dependencies vary by platform · Region: Version, build and integration requirements apply

## References

[^home]: [xhtml2pdf documentation](<https://xhtml2pdf.readthedocs.io/en/latest/>) — HTML/CSS conversion, Python and CLI interfaces (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^layout]: [xhtml2pdf page layout](<https://xhtml2pdf.readthedocs.io/en/latest/format_html.html>) — Content/static frames and unsupported CSS page property (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^reference]: [xhtml2pdf reference](<https://xhtml2pdf.readthedocs.io/en/latest/reference.html>) — Tables, long\-cell handling and PDF form limitations (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^security]: [xhtml2pdf resource security](<https://xhtml2pdf.readthedocs.io/en/latest/security.html>) — Default resource policy, skipped denied assets and resource exhaustion (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^package]: [xhtml2pdf package metadata](<https://github.com/xhtml2pdf/xhtml2pdf/blob/master/pyproject.toml>) — Python 3\.10\+, dependencies and command\-line entry points (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^license]: [xhtml2pdf license](<https://github.com/xhtml2pdf/xhtml2pdf/blob/master/LICENSE.txt>) — Apache License Version 2\.0 (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^weasy]: [WeasyPrint documentation](<https://doc.courtbouillon.org/weasyprint/stable/>) — HTML/CSS pagination engine (vendor; retrieved 2026-10-07T12:42:28.193Z)

[^source-8]: [https://xhtml2pdf\.readthedocs\.io/en/latest/security\.html](<https://xhtml2pdf.readthedocs.io/en/latest/security.html>) — What is refused by default; Choosing your own policy; On the command line; link\_callback warning\. (vendor; retrieved 2026-10-07T12:42:28.193Z)

Source revision: https://substitutefor.net/entities/Q1453?revision=1533
