wkhtmltopdf
Simple python wrapper for wkhtmltopdf
What it is and what it does
python-wkhtmltopdf is a Python wrapper around the wkhtmltopdf command-line utility, which uses a headless WebKit renderer to convert web pages and HTML to PDF. It exposes wkhtmltopdf's rendering capabilities through a Python class and function interface, allowing you to specify a URL or HTML content, configure rendering options like screen_resolution, color_depth, dpi, orientation, and write the resulting PDF to a file.
The package includes optional Flash plugin support and can be used as a class, a function, a command-line tool, or an HTTP API. However, it has been abandoned since 2011 and requires substantial system-level setup: you must install Xvfb, wkhtmltopdf itself, system fonts, and flashplugin-nonfree before the Python package can run. No runtime Python dependencies are declared.
Use it for:
- Generate PDFs from live web pages or HTML templates in legacy Python 2 applications
- Batch convert URLs to PDF files with customizable rendering parameters like dpi and orientation
- Render web content with Flash animations to PDF using the flash_plugin option
- Expose PDF generation as an HTTP API endpoint via the built-in API server
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps the wkhtmltopdf command-line tool to convert URLs and HTML to PDF from Python, with optional Flash rendering support.
No. The package is abandoned (last release 2011-07-21, repository archived) and targets python 2.5+, which is long out of support. Install only if maintaining legacy Python 2 code already using this package. The system-level dependency burden, high install friction, and lack of maintenance make it unsuitable for new projects.
Install
wkhtmltopdf on PyPI
pip
pip install wkhtmltopdfuv
uv add wkhtmltopdfpoetry
poetry add wkhtmltopdfInstalling wkhtmltopdf
Before you install
High install friction: requires system-level dependencies (Xvfb, wkhtmltopdf, fonts, flashplugin-nonfree) to be installed separately before the Python package can function. Package is abandoned since 2011 with no maintenance activity.
License in practice
BSD license is permissive and poses no restrictions on use, modification, or distribution.
Quickstart
from wkhtmltopdf import WKHtmlToPdf
wkhtmltopdf = WKHtmlToPdf(
url='http://www.example.com',
output_file='~/example.pdf',
)
wkhtmltopdf.render()
Requires system installation of Xvfb, wkhtmltopdf, xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic, and flashplugin-nonfree before the Python package can function.
Verify before relying
- Whether the package works with Python versions beyond 2.5–2.7
- Current compatibility with modern wkhtmltopdf versions and contemporary Linux distributions
- Whether Flash plugin dependency remains relevant or is a legacy artifact
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 5,503 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 98,433/month — #13,084 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: wkhtmltopdf-0.2-py2.5.egg; wkhtmltopdf-0.2-py2.6.egg; wkhtmltopdf-0.2-py2.7.egg; wkhtmltopdf-0.2.tar.gz
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
pdfkitPython wrapper for wkhtmltopdf that converts…
permissive · top 5,000 on PyPI
django-wkhtmltopdfWraps the wkhtmltopdf binary to convert HTML to…
permissive · top 15,000 on PyPI
imgkitimgkit wraps the wkhtmltoimage command-line…
permissive · top 15,000 on PyPI
fpdfGenerates PDF documents from Python code,…
copyleft · top 5,000 on PyPI
pdf2imageConverts PDF files to PIL Image objects by…
permissive · top 1,000 on PyPI
gh-md-to-htmlConverts GitHub-flavored Markdown to HTML with…
unclear · top 15,000 on PyPI
gotenberg-clientA fully-typed Python client for the Gotenberg…
copyleft · top 15,000 on PyPI
nokapnokap captures screenshots and PDFs from web…
permissive · top 15,000 on PyPI
pypandoc-binarypypandoc_binary wraps pandoc, a universal…
permissive · top 5,000 on PyPI
pypandocPypandoc wraps pandoc, a universal document…
permissive · top 5,000 on PyPI