I am working on pdfkit library in python in order to create pdf file from html string. It works fine on my linux system but when i try to run it on windows server then it gives me error
pdfkit.from_string(html_string, output_dir)
and i get following error
import pdfkit
ImportError: No module named pdfkit
I installed wkhtmltopdf
using .exe and pdfkit
on windows using pip.
I also set path for wkhtmltopdf
in environment variables.
Yaa, the main issue is, it may unable to find out the absolute path because of permission in windows, just try with administrator privileges as well give permission to directories to traversal.
for simple, you can do, copy the executable into your current directory :) :-)
or use the below lines in your code
path_wkthmltopdf = 'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
pdfkit.from_string(html_string, output_file, configuration=config)
If you are using Anaconda cloud, you can install pdfkit using
conda install -c conda-forge python-pdfkit
or
conda install -c bioconda wkhtmltopdf
for more details you can go through below links
Docs
1: wkhtmltopdf
2: pdfkit