When you start to use python pdfkit library to convert a html to pdf in win 10, you may find OSError: No wkhtmltopdf executable found. In this tutorial, we will introduce you how to fix this error.
If you have read how to install wkhtmltopdf in here.
You may notice, if the system is window system, you shoud add wkhtmltopdf folder to system environment. However, i will tell you this method does not work.
How to fix this error?
Find the installation path of wkhtmltopdf.exe
As to us, this path is: C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe
Set pdfkit configuration
config = pdfkit.configuration(wkhtmltopdf='C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe')
Convert html to pdf
pdfkit.from_url('https://www.tutorialexample.com', 'out-test.pdf', configuration=config)
Then you will find this error is fixed.