Skip to main content

2 posts tagged with "xhtml2pdf"

View All Tags

Python HTML to PDF with xhtml2pdf: Step-by-Step Guide

· 12 min read
Michał Szymanowski
Michał Szymanowski
PDFBolt Co-Founder

Python HTML to PDF generation using xhtml2pdf and Jinja2

This guide walks through building a Python HTML to PDF report using xhtml2pdf, Jinja2 templates, and matplotlib charts. By the end, you will have a working script that reads sales data from a JSON file, renders it into styled HTML, and converts it to a PDF ready for distribution or printing.

Top Python HTML to PDF Libraries Compared

· 7 min read
Michał Szymanowski
Michał Szymanowski
PDFBolt Co-Founder

Google Trends overview showing the relative search interest for HTML to PDF conversion libraries over the past 12 months

Five Python libraries handle most HTML to PDF conversions today: Playwright, WeasyPrint, pdfkit, Pyppeteer, and xhtml2pdf. Below we compare them by download numbers, features, and code examples so you can pick the one that fits your project.