Open links in new tab
    • Work Report
    • Email
    • Rewrite
    • Speech
    • Title Generator
    • Smart Reply
    • Poem
    • Essay
    • Joke
    • Instagram Post
    • X Post
    • Facebook Post
    • Story
    • Cover Letter
    • Resume
    • Job Description
    • Recommendation Letter
    • Resignation Letter
    • Invitation Letter
    • Greeting Message
    • Try more templates
  1. PDFKit is a Python wrapper for the wkhtmltopdf utility, which converts HTML to PDF using the Webkit rendering engine and Qt. It allows you to generate PDFs from URLs, files, or strings.

    Installation

    First, you need to install pdfkit and wkhtmltopdf:

    pip install pdfkit
    sudo apt-get install wkhtmltopdf # For Debian/Ubuntu
    Copied!

    For macOS, use:

    brew install homebrew/cask/wkhtmltopdf
    Copied!

    Basic Usage

    To create a PDF from a URL, file, or string, you can use the following methods:

    import pdfkit

    # From URL
    pdfkit.from_url('http://google.com', 'out.pdf')

    # From file
    pdfkit.from_file('test.html', 'out.pdf')

    # From string
    pdfkit.from_string('Hello!', 'out.pdf')
    Copied!

    You can also pass a list of URLs or files:

    pdfkit.from_url(['google.com', 'yandex.ru', 'engadget.com'], 'out.pdf')
    pdfkit.from_file(['file1.html', 'file2.html'], 'out.pdf')
    Copied!

    Adding a Page

    To add a page to an existing PDF, you can use the wkhtmltopdf options. For example, you can specify multiple HTML files to be converted into a single PDF:

    Feedback
  2. pdfkit · PyPI

    Nov 14, 2021 · Wkhtmltopdf python wrapper to convert html to pdf using the webkit rendering engine and qt

  3. How to Generate PDFs from HTML with Python-PDFKit …

    Jul 4, 2024 · In this article, we will introduce another tool that can be used to automate PDF generation from HTML in Python. PDFKit is another Python library …

  4. How to Convert HTML to PDF with python-pdfkit - Templated

    • See More

    Feb 8, 2024 · Uncover the straightforward approach to converting HTML to PDF in Python using the python-pdfkit library, accompanied by practical code examples.

  5. Python HTML to PDF Conversion Guide - PyTutorial

    Feb 7, 2026 · Learn how to convert HTML to PDF in Python using libraries like WeasyPrint and wkhtmltopdf for reports, invoices, and web archiving.

  6. PDFKit Module in Python - Convert HTML to PDF

    Oct 30, 2022 · In this article let’s learn about a PDFKit, which is a PDF document generation open-source library. It is the easiest way to convert any webpage into …

  7. Converting Multiple html file into pdf using pdfkit in Python

    Nov 16, 2017 · The solution i found was to first merge the html files into one and then go on to convert it using pdfkit. so in your case would be to save the tophtml and html files together in same dir and …

  8. Python: Convert HTML to PDF in 2026 (pdfkit + wkhtmltopdf, plus …

    Feb 1, 2026 · Below is the workflow I use in production: quick wins for local HTML, reliable conversion from URLs, generating PDFs from strings, print-friendly CSS patterns, and the failure modes you’ll hit …

  9. Python HTML to PDF: Convert HTML to PDF using …

    Aug 13, 2024 · This tutorial demonstrates HTML-to-PDF conversion in Python using wkhtmltopdf and python-pdfkit. Install wkhtmltopdf on your system, and then use …

  10. How to generate PDF from HTML Using Python-PDFKit

    Oct 11, 2024 · Generate PDF from HTML using Python-PDFKit with ease in this guide and automate document creation for invoices, reports, or contracts in your …

  11. Converting HTML to PDF files using Python - Tpoint …

    Mar 17, 2025 · This section will demonstrate how to convert HTML to PDF format files using the PDFKit module in the Python programming language with different …