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!
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.
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.
Here's wkhtmltopdf download list, windows installer included
Documentation about pdfKit can be found here: https://pypi.python.org/pypi/pdfkit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With