python-pdfkit
python-pdfkit copied to clipboard
Exit code on pdfkit.from_string(html, False)
OS information
Python 3.8 wkhtmltopdf 0.12.6 pdfkit 0.6.1
Description
When i call
pdf_bytes = pdfkit.from_string(html, False)
OSError('wkhtmltopdf reported an error:\nLoading pages (1/6)\n[> ] 0%\r[======> ] 10%\rWarning: Blocked access to file \n[=========> ] 16%\rError: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown\n[============================================================] 100%\rCounting pages (2/6) \n[============================================================] Object 1 of 1\rResolving links (4/6) \n[============================================================] Object 1 of 1\rLoading headers and footers (5/6) \nPrinting pages (6/6)\n[> ] Preparing\r[============================================================] Page 1 of 1\rDone \nExit with code 1 due to network error: ProtocolUnknownError\n')
Comparing
This works when call
pdfkit.from_string(html, file_path)
How to reproduce
Call a html with css and midia with auth
Expected behavior
I need to ignore failure on load and brings half of the pdf. The images how dont load, can be blank.
Possible Solution
https://stackoverflow.com/questions/63446380/how-to-ignore-the-error-exit-with-code-1-due-to-network-error-contentnotfounde