Can’t create pdf using python PDFKIT Error : ” No wkhtmltopdf executable found:”

The following should work without needing to modify the windows environment variables:

import pdfkit
path_wkhtmltopdf = r'C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
pdfkit.from_url("http://google.com", "out.pdf", configuration=config)

Assuming the path is correct of course (e.g. in my case it is r’C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe’).

Leave a Comment