--- id: pdfkit version: "1.0.0" license: MIT license_treatment: permissive maintenance: dormant --- # pdfkit — Wkhtmltopdf python wrapper to convert html to pdf using the webkit rendering engine and qt License: permissive · Maintenance: dormant · Downloads: 7.8M/mo ## What it is and what it does pdfkit is a thin Python wrapper around the wkhtmltopdf command-line tool, which uses the Webkit rendering engine to convert HTML into PDF files. It lets you generate PDFs from live URLs, local HTML files, or HTML strings passed directly to the API, with support for options like page size, margins, headers, footers, and table of contents. The package handles the subprocess plumbing and argument construction so you don't have to shell out to wkhtmltopdf manually. The wrapper requires wkhtmltopdf to be installed as a separate system binary; pdfkit itself has no Python runtime dependencies. It supports both Python 2 and 3 (though Python 2 is long obsolete) and offers a simple three-function API: from_url(), from_file(), and from_string(). You can also retrieve the PDF as a byte string instead of writing to disk, and pass detailed configuration options via dictionaries. Use it for: - Generate PDF reports from HTML templates in a web application without relying on a headless browser service. - Batch-convert multiple HTML files or URLs to PDF for archival or distribution. - Create invoices or receipts by rendering HTML with CSS styling directly to PDF. - Embed PDF generation in a Python script that needs to produce documents from web content. - Add table of contents, headers, and footers to HTML-based documents during PDF export. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Python wrapper for wkhtmltopdf that converts HTML to PDF using the Webkit rendering engine, supporting URLs, files, and HTML strings as input. Yes, if you need simple HTML-to-PDF conversion and are willing to manage the wkhtmltopdf system dependency. The package is stable and widely used, but dormant—no active maintenance since late 2023. Check the two known vulnerabilities before use in security-sensitive contexts. For new projects, consider whether a maintained alternative or headless-browser service better fits your risk tolerance. ## Install pip install pdfkit uv add pdfkit poetry add pdfkit ## Installing pdfkit Before you install: Low install friction with no runtime dependencies. However, the package is dormant—last release was 2021-11-14 and last commit 2023-10-26—so expect no active maintenance or updates for emerging issues. License in practice: MIT license is permissive, allowing commercial and private use with minimal restrictions. Quickstart: pip install pdfkit import pdfkit pdfkit.from_url('http://google.com', 'out.pdf') pdfkit.from_file('test.html', 'out.pdf') pdfkit.from_string('Hello!', 'out.pdf') wkhtmltopdf binary must be installed separately on your system (via apt-get, brew, or direct download); pdfkit is only a Python wrapper and will not function without it. Verify before relying: - Current compatibility with modern Python versions beyond 3.9 (classifiers list 3.9 as latest) - Status of the two known vulnerabilities (GHSA-9g3x-6x24-vf9f, PYSEC-2026-2860) and whether they affect typical use - Whether Debian/Ubuntu wkhtmltopdf packages still have reduced functionality as documented ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 7.8M/month (top 5,000 on PyPI) - Known vulnerabilities: 2 ## Tags html to pdf conversion, wkhtmltopdf python wrapper, webkit pdf generation, convert html string to pdf, batch html to pdf, pdf from url python, html file to pdf converter, pdf-generation, html-conversion, webkit-rendering [View on SkillFed](https://skillfed.io/packages/pdfkit) · [View on PyPI](https://pypi.org/project/pdfkit/)