Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to install the wkhtmltopdf Python package on Windows?

I'm trying to convert some HTML files stored locally on my computer to PDF format through a Python script, and I've tried xhtml2pdf but I ran into countless errors and decided to stop using it.

I heard that wkhtmltopdf was a better alternative and I found a Python package that integrated well into it. Unfortunately, this package requires xvfb which cannot be installed for Windows. Is there any other way to install wkhtmltopdf for Python on Windows?

Thanks for your help!

like image 883
Amit Avatar asked Feb 04 '12 21:02

Amit


People also ask

Where is Wkhtmltopdf installed Windows?

When you install wkhtmltopdf, it will go into either c:\Program Files\wkhtmltopdf\ or c:\Program Files (x86)\wkhtmltopdf. This will create the PDF in the right place. Since we're using the Windows command prompt, there's really no reason to use PHP.

How do I use Wkhtmltopdf?

Open a command prompt window. The syntax for using the tool is fairly simple, enter the name wkhtmltopdf, followed by the URL of the web page, and the name of the PDF that you want to create, like so. Let's say you want to save a copy of a website, this is what the command will look like.


2 Answers

Here's wkhtmltopdf download list, windows installer included

like image 152
stuudent Avatar answered Sep 18 '22 20:09

stuudent


  • install wkhtmltopdf for Windows(http://wkhtmltopdf.org/downloads.html)
  • Add the bin folder to the "Path" env variable (eg: C:\Program Files (x86)\wkhtmltopdf\bin)
  • Install pdfkit for python bindings (pip install pdfkit)

Documentation about pdfKit can be found here: https://pypi.python.org/pypi/pdfkit

like image 28
Fabricio Reinert Avatar answered Sep 19 '22 20:09

Fabricio Reinert