Reputation: 167
I can run the following comand under Win cmd box:
"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe" --header-html "C:\temp\Header.html" http://google.de "C:/temp/out_new1.pdf"
Output looks like expected and includes the Header.html
However, if I try to place it in Python it will return errors. I've tryed the following configruration:
path_wkthmltopdf = "'C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe' --header-html 'C:/temp/Header.html'"
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
I'm receiving the following error:
OSError: No wkhtmltopdf executable found: "'C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe' --header-html 'C:/temp/Header.html'"
Can u help please?
Thank you very much in advance
Andreas
Upvotes: 1
Views: 4703
Reputation: 167
thanks for the tips. I figured out how it works.
I try somesing like:
path_wkthmltopdf = r"'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe' options=pdf_options"
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
which is not working.
You have to put the option to the call like
pdfkit.from_string(data, outputfile_name, configuration=config, options=pdf_options)
Best regards Andreas
Upvotes: 2