close

[Solved] Can’t create pdf using python PDFKIT : ” No wkhtmltopdf executable found:”

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Can’t create pdf using python PDFKIT : ” No wkhtmltopdf executable found:” in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

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

Today I get the following error Can’t create pdf using python PDFKIT : ” No wkhtmltopdf executable found:” in python.

How To Solve Can’t create pdf using python PDFKIT : ” No wkhtmltopdf executable found:” Error ?

  1. How To Solve Can't create pdf using python PDFKIT : ” No wkhtmltopdf executable found:” Error ?

    To Solve Can't create pdf using python PDFKIT : ” No wkhtmltopdf executable found:” Error Make sure that you have wkhtmltopdf in your $PATH or set via custom configuration. where wkhtmltopdf in Windows or which wkhtmltopdf on Linux should return actual path to binary.

  2. Can't create pdf using python PDFKIT : ” No wkhtmltopdf executable found:”

    To Solve Can't create pdf using python PDFKIT : ” No wkhtmltopdf executable found:” Error Make sure that you have wkhtmltopdf in your $PATH or set via custom configuration. where wkhtmltopdf in Windows or which wkhtmltopdf on Linux should return actual path to binary.

Solution 1

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’).

Solution 2

IOError: 'No wkhtmltopdf executable found'

Make sure that you have wkhtmltopdf in your $PATH or set via custom configuration. where wkhtmltopdf in Windows or which wkhtmltopdf on Linux should return actual path to binary.

Adding this configuration line worked for me:

config = pdfkit.configuration(wkhtmltopdf="C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe")
pdfkit.from_string(html, 'MyPDF.pdf', configuration=config)

From github

Seems you need to pass configuration=config as argument.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read