Forums

how to install wkhtmltopdf on pythonanywhere

does anyone, how to install wkhtmltopdf on pythonanywhere?

Does this help?

no that not helps at all wkhtmltopdf is not a python module, so you cant use pip3 to install

Sorry for the confusion. Unfortunately I don't think wkhtmltopdf will work on PythonAnywhere -- it depends on WebKit, which isn't compatible with our virtualization system :-(

That is such a shame, I hope pythonAnywhere consider adding this in the future, i did try changing to weasyprint, but the end results are far from comparable with pdfkit, I am so sad as my project depends on this pdfs i need to know search a different hosting :(

is there a solution to this problem? I also desperately need wkhtmltopdf on pythonanywhere.

@giovannipiccinelli, it is quite sad that this is not available, I wish it was at least in the roadmap. What you could do, and that depends on your project is create the file as html and make it public and then use something like https://pdflayer.com/ to do an api and get the pdf, not ideal but is a workaround without changing to a different host provider. or trying a different library, please let us know if you find a decent one, as I havent

also imgkit gives me error after the installation. I run the simple script:

import imgkit imgkit.from_url('http://google.com', 'out.png')

And this throws me:

Traceback (most recent call last): File "/home/giovannipiccinelli/bot_actions/test.py", line 3, in <module> imgkit.from_url('http://google.com', 'out.png') File "/home/giovannipiccinelli/.local/lib/python3.6/site-packages/imgkit/api.py", line 31, in from_url cover_first=cover_first) File "/home/giovannipiccinelli/.local/lib/python3.6/site-packages/imgkit/imgkit.py", line 34, in init self.config = Config() if not config else config File "/home/giovannipiccinelli/.local/lib/python3.6/site-packages/imgkit/config.py", line 36, in init 'http://wkhtmltopdf.org\n'.format(self.wkhtmltoimage)) OSError: No wkhtmltoimage executable found: "b''" If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - http://wkhtmltopdf.org

@giovannipiccinelli -- unfortunately wkhtmltopdf or anything that depends on it won't work until we change the way our virtualization system works. We don't have a timeline for that.

However, we do have weasyprint -- perhaps that would work for your use case?

PythonAnywhere weasyprint is good but however I dont think the results as close to be as good as pdfkit, i hope you guys add this in the near future, :)

We're certainly planning to make the changes to support WebKit (which would then mean that wkhtmltopdf would work). Might not be the very near future, though :-(

@giles Is there any html to pdf converter tool that is supported by pythonanywhere right now ?? I am desperately in need of this feature in my project

Have you tried weasyprint?

weasyprint is not redesing bootstrap css properly... the code is clean and easy but the results is ugly, in my opinion not worth. The best tool is whkhtmltopdf works great with bootstrap-3.4.1.

The good news is that in the two years since the last post on this thread, we've done the updates to our virtualization system that were mentioned earlier on, so it works now if your account is updated to use the new system.