Ask questionsraise IOError("wkhtmltopdf exited with non-zero code {0}.

wkhtmltopdf version(s) affected: 0.12.5

OS information:windows 10 python 3.7.5

Description Traceback (most recent call last): File "", line 26, in <module> options=options File "D:\Python37\lib\site-packages\pdfkit\", line 49, in from_file return r.to_pdf(output_path) File "D:\Python37\lib\site-packages\pdfkit\", line 159, in to_pdf raise IOError("wkhtmltopdf exited with non-zero code {0}. error:\n{1}".format(exit_code, stderr)) OSError: wkhtmltopdf exited with non-zero code 1. error:

How to reproduce import pdfkit import os

path_wk = r'D:\wkhtmltox\bin\wkhtmltopdf.exe' #安装位置 , wkhtmltopdf程序位置

config = pdfkit.configuration(wkhtmltopdf = path_wk)

options = { 'page-size': 'Letter', 'margin-top': '0.85in', 'margin-right': '0.85in', 'margin-bottom': '0.85in', 'margin-left': '0.85in', 'encoding': "UTF-8", }

for home, dirs, files in os.walk('html'): for filename in files: file_path = os.path.join(home, filename) with open(file_path, encoding='utf-8') as f: pdfkit.from_file( f, './5.1/{0}/{0}.pdf'.format(filename.split('.')[0]), configuration=config, options=options )

Expected behavior I want to successfully convert html to pdf

Possible Solution
I think it might be incompatible with python version


Answer questions ashkulz

Please open a ticket in the pdfkit repository.

Github User Rank List