Answer the question
In order to leave comments, you need to log in
How to convert an image file in Python pdfkit?
there is a loop that receives a list of html files and then the loop should create pdf files, but the trouble is, it has a file blocking error and creates only the first pdf, but also the one without a picture, the pdf creation loop:
for i in list_svod:
path_wkthmltopdf = b'C:\Program Files\wkhtmltopdf\\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkthmltopdf)
css = 'style.css'
options = {
'orientation': 'landscape',
'margin-bottom': '0in',
'margin-left': '0in',
'margin-right': '0in',
'margin-top': '0in',
'page-size': 'a4',
'page-height': '10in',
'page-width': '7.12in',
}
pdfkit.from_file(str(i[1]) + ".html", str(i[1]) + ".pdf", configuration=config, options=options, css=css)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question