From b8626f28f5c1dc82299a5e6216c98a62943afcfd Mon Sep 17 00:00:00 2001 From: Sarthak Roy Date: Sun, 2 Oct 2022 10:09:30 +0530 Subject: [PATCH] Add HTML url to PDF converter Signed-off-by: Sarthak Roy --- scripts/HTML-To-PDF/README.md | 9 +++++++++ scripts/HTML-To-PDF/requirements.txt | 1 + scripts/HTML-To-PDF/script.py | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 scripts/HTML-To-PDF/README.md create mode 100644 scripts/HTML-To-PDF/requirements.txt create mode 100644 scripts/HTML-To-PDF/script.py diff --git a/scripts/HTML-To-PDF/README.md b/scripts/HTML-To-PDF/README.md new file mode 100644 index 0000000..8a79c9c --- /dev/null +++ b/scripts/HTML-To-PDF/README.md @@ -0,0 +1,9 @@ +# HTML to PDF +This is a simple script that lets you convert HTML url to pdf. + +## Usage + +* Clone the repo +* download the requirements +* Install [wkhtmltopdf](https://wkhtmltopdf.org/downloads.html) as per your operating system +* run `python script.py` diff --git a/scripts/HTML-To-PDF/requirements.txt b/scripts/HTML-To-PDF/requirements.txt new file mode 100644 index 0000000..da9d589 --- /dev/null +++ b/scripts/HTML-To-PDF/requirements.txt @@ -0,0 +1 @@ +pdfkit==0.6.1 diff --git a/scripts/HTML-To-PDF/script.py b/scripts/HTML-To-PDF/script.py new file mode 100644 index 0000000..34c0e5c --- /dev/null +++ b/scripts/HTML-To-PDF/script.py @@ -0,0 +1,5 @@ +import pdfkit +url = input('Enter the URL of the HTML: ') +pdf = input('Enter name of output pdf file without extension :') +pdfkit.from_url(url, pdf + '.pdf') +print("Done, The HTML url has been converted to PDF")