I am trying to generate pdf of the order summary in my ecommerce website but receiving the following error.
OSError: wkhtmltopdf reported an error:
Loading pages (1/6)
[> ] 0%
[======> ] 10%
[=========> ] 16%
[============> ] 20%
[================> ] 27%
[===================> ] 32%
[=====================> ] 36%
[========================> ] 40%
[=========================> ] 42%
[===================================> ] 59%
[=====================================> ] 62%
[========================================> ] 68%
[===========================================> ] 72%
[============================================> ] 74%
[==============================================> ] 77%
[===============================================> ] 79%
[=================================================> ] 82%
[==================================================> ] 84%
[====================================================> ] 87%
[=====================================================> ] 89%
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[==============================> ] Page 1 of 2
[============================================================] Page 2 of 2
Done
Exit with code 1 due to network error: RemoteHostClosedError
I am using flask as the webframework and here's the code:
rendered = render_template("order-summary.html",
total_cost=total_cost,
name=name,
price=price)
config = pdfkit.configuration(wkhtmltopdf=r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe')
pdf = pdfkit.from_string(rendered, False, configuration=config)
response = make_response(pdf)
response.headers['Content-Type'] = 'application/pdf'
response.headers['Content-Disposition'] = 'inline; filename=output.pdf'
return response
I searched over the internet but didn't got anything relevant that solves the problem.