python html to pdf

# Shell
pip install pdfkit
sudo apt-get install wkhtmltopdf

# Python
import pdfkit 
pdfkit.from_file('input.html','shaurya.pdf') # .from_url and .from_string also exist

# Source: https://www.geeksforgeeks.org/python-convert-html-pdf/

Here is what the above code is Doing:
1. We are importing the pdfkit module.
2. We are creating a pdf file from the HTML file input.html.
3. We are using wkhtmltopdf to convert the HTML file to PDF.
4. We are using the from_file() method to convert the HTML file to PDF.
5. We are using the from_url() method to convert the HTML file to PDF.
6. We are using the from_string() method to convert the HTML file to PDF.