Can't create pdf using python PDFKIT Error : “ No wkhtmltopdf executable found:”

前端 未结 10 1950
灰色年华
灰色年华 2020-12-01 06:37

I tried installing pdfkit Python API in my windows 8 machine. I\'m getting issues related to path.

Traceback (most recent call last):
  File \"C:\\Python27\\         


        
10条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 07:09

    Found the decode on a windows platform needed to be a binary string, try:

            path_wkthmltopdf = b'C:\Program Files\wkhtmltopdf\\bin\wkhtmltopdf.exe'
            config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
            pdfkit.from_url(url=urlpath, output_path=pdffilepath,configuration=config)
    

提交回复
热议问题