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

前端 未结 10 1948
灰色年华
灰色年华 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:04

    def urltopdf(url,pdffile):
        import pdfkit
        '''
            input
            - url : target url
            - pdffile : target pdf file name
        '''
        path_wkthmltopdf = 'D:\\Program Files (x86)\\wkhtmltopdf\\bin\\wkhtmltopdf.exe'
        config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
        #pdfkit.from_url(url=urlpath, output_path=pdffilepath,configuration=config)
        pdfkit.from_url(url,pdffile,configuration=config)
    
    
    urltopdf('http://www.google.com','pdf/google.pdf')
    

    very good solution! thanks everyone!

提交回复
热议问题