PDFKIT does not find wkhtmltopdf
Asked Answered
R

2

5

Hi I have looked through all similar posts and implemented the suggestions but still no luck.

Running Python, PDFKIT, Windows 7, Google App Engine.

I get this error when trying to run the program

IOError: No wkhtmltopdf executable found: "C:/Users/nb198011/Documents/Shillan/Personal/Installs/wkhtmltopdf/bin/wkhtmltopdf.exe"

If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

I have confirmed the file is indeed in that location using the "where" command and I can execute the wkhtmltopdf program from the command line.

I import PDFKIT into my program by holding it in the same folder as my project and wkhtmltopdf is installed into the folder specified in the error message

Any new suggestions would be greatly appreciated

Reface answered 24/11, 2014 at 16:59 Comment(4)
"I can execute the wkhtmltopdf program from the command line" - but can the user that is running the program? If it's not you. Try granting full access to everyone everywhere to the file and try that, it should rule out permission issues.Nidus
Okay managed to sort it out. Not sure what the problem was though. I uninstalled PDFkit from site-packages and removed all enviro paths to it. Then downloaded a version and copied it to my project folder as before and it worked.Reface
Cool! You can add that as an answer to this question to help future answer seekers :)Nidus
Oh hey the solution didn't work for me. I'm on Windows 7, running python 3 from anaconda. It seems like it might be a windows environment variable issue because after fiddling with this solution I get different errors with the filepath to the executable.Leucite
D
7

I have spent some time ti figure out the process to converting html pages to pdf on mac os. Here are the steps,

  1. install pdfkit from pip pip install pdfkit
  2. download and install wkhtmltopdf from link
  3. Then setup is done, My python file is

    import pdfkit
    config = pdfkit.configuration(wkhtmltopdf="path_to_exe")
    pdfkit.from_url('http://google.com', 'out.pdf',configuration = config)
    pdfkit.from_file('test.html', 'out.pdf',configuration = config)
    pdfkit.from_string('Hello!', 'out.pdf',configuration = config)
    

And it worked perfectly.

Delvalle answered 22/7, 2016 at 7:3 Comment(0)
R
1

Okay managed to sort it out. Not sure what the problem was though. I uninstalled PDFkit from site-packages and removed all enviro paths to it. Then downloaded a version and copied it to my project folder as before and it worked. – Shillz

Reface answered 5/12, 2014 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.