
In many cases, it is required to convert HTML output into pdf. For eg:- Consider a scenario, in which you did some payment on a website, and they provide just an HTML receipt, but you require a pdf version of that HTML receipt.
So via this article we gonna show, how to convert HTML into pdf using python.
// installing library pdfkit
pip install pdfkit
// installing wkhtmltopdf
sudo apt-get install wkhtmltopdf
// Case: 1
// if already saved html page = test.html
import pdfkit
pdfkit.from_file('test.html', 'out.pdf')
//Case 2:
// if converting directly from a webpage
import pdfkit
pdfkit.from_url('https://www.example.com/','out.pdf')
//Case3 :
// passing multiple sources
pdfkit.from_url(['google.com', 'xyz.com', 'facebook.com'], 'out.pdf')
pdfkit.from_file(['file1.html', 'file2.html'], 'out.pdf')
You may Also Like
By Richard
/ January 6, 2021
In Python, there is a module, which allows you to copy a mutable object so that changes made in the...
Read More
By Richard
/ December 15, 2020
What is Unity? According to Wikipedia : Unity is a cross-platform game engine with a built-in IDE developed by Unity...
Read More
By Richard
/ December 8, 2020
Cascading Style Sheets, fondly referred to as CSS, is a style sheet language used to define visual appearance and formatting...
Read More
By Richard
/ December 1, 2020
Mobile applications have come a long way since the basic arcade game “Snake,” which many consider the first mobile application....
Read More
By Richard
/ November 23, 2020
In this tutorial we gonna learn how to create a simple login form using HTML and CSS Step 1) Add...
Read More
By Richard
/ November 16, 2020
Information technology is growing rapidly and it is not slowing down, neither it will according to the pace and the...
Read More
By Richard
/ November 9, 2020
What is PHP ? PHP is a server-side scripting language that is used to develop Static websites or Dynamic websites...
Read More
By Richard
/ November 6, 2020
Machine Learning is undeniably one of the most influential and powerful technologies in today’s world. Machine Learning is enabling computers...
Read More
By Richard
/ November 2, 2020
A modal is a dialog box/popup window that is displayed on top of the current page: How To Create a...
Read More
By Richard
/ October 29, 2020
Blockchain is a technology that is rapidly expanding with the development of new platforms and applications. Blockchain is an open...
Read More