There are many sites that do not allow pdf downloads, either ask to buy their premium version, or do not have such a pdf download service.
Step 1: Download pdfkit library
$ pip install pdfkit
Step 2: Download wkhtmltopdf
For Ubuntu / Debian:
sudo apt-get install wkhtmltopdf
(a) Link for downloads: WKHTMLTOPDF
(b) Set : PATH variable sets the binary folder in environment variables.
Step 3: Python code to download:
(i) Already saved HTML page
(ii) Convert by website URL
Congratulations : Your PDF file will be created and saved in the same directory where it exists Python file.
Miscellaneous knowledge content:
1. You can pass a list with multiple URLs or files:
2. Store content in variable
| tr> |
For my django powered site, I am looking for an easy solution to convert dynamic html pages to pdf.