Python configure pdfkit on windows

mr.boris picture mr.boris · Jun 20, 2017 · Viewed 9.3k times · Source

I started to learn python recently and I want to convert existing html file to pdf file. It is very strange, but pdfkit seems to be the only lib for pdf docs for python.

import pdfkit
pdfkit.from_file("C:\\Users\\user\Desktop\\table.html", "out.pdf")

An error occurs: OSError: No wkhtmltopdf executable found: "b''"

How to configure this lib properly on windows to make it work? I can't get it :(

Answer

Sean picture Sean · Jun 20, 2017

It looks like you need to install wkhtmltopdf. For windows, the installer can be found at https://wkhtmltopdf.org/downloads.html

Also check out a post by this guy, who is having the same problem: Can't create pdf using python PDFKIT Error : " No wkhtmltopdf executable found:"