DEV Community

Techsolutionstuff
Techsolutionstuff

Posted on • Originally published at techsolutionstuff.com

How To Convert HTML To PDF In Python

In this article, we will see how to convert HTML to PDF in python. Here, we will learn to generate HTML to PDF using wkhtmltopdf. wkhtmltopdf and wkhtmltoimage are open source command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine.

Python 2 and 3 wrapper for wkhtmltopdf utility to convert HTML to PDF using Webkit. So, we will use pdfkit library and wkhtmltopdf.

So, let's see how to generate HTML to PDF in python, python convert HTML to PDF, and pdfkit python.

The Portable Document Format (PDF) is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems.

There are two libraries required:

  1. wkhtmltopdf
  2. pdfkit

Top comments (1)

Collapse
 
corentinbettiol profile image
Corentin Bettiol

We're using Weasyprint to render pdfs of html content, and it's working great!