skillfed

wkhtmltopdf

Simple python wrapper for wkhtmltopdf

wkhtmltopdf v0.2 98.4K downloads/30d#13,084 on PyPI109
Permissive license BSD Abandoned released

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 wkhtmltopdf

uv

uv add wkhtmltopdf

poetry

poetry add wkhtmltopdf

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonTopic :: Internet :: WWW/HTTP :: Dynamic Content

Tags

convert url to pdf pythonhtml to pdf wrapperwkhtmltopdf pythonweb page pdf generationrender html as pdf
pdf-generationlegacy-python2abandoned

More Dynamic Content packages