snappy: ContentNotFoundError on pdf generation
Hello,
I’m currently having the following error when trying to generate a pdf from html:
The exit status code '1' says something went wrong:
stderr: "Loading pages (1/6)
[> ] 0%
[======> ] 10%
[=======> ] 12%
Warning: Failed to load file:///assets/admin/scripts/bootstrap.js (ignore)
Warning: SSL error ignored
[=================> ] 29%
[=====================> ] 35%
[============================================================] 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 1
Done
Exit with code 1 due to network error: ContentNotFoundError
"
stdout: ""
command: /usr/local/bin/wkhtmltopdf --lowquality '/var/tmp/knp_snappy55c0b954e4cf05.58613037.html' '/var/tmp/knp_snappy55c0b954e4dfd4.48017554.pdf'.
Did I miss something ?
Thanks
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19 (5 by maintainers)
It would be very convenient to choose which exit status codes throw an exception.
For example an option could be added to the AbstractGenerator class. This option may contain the list of codes not throwing an exception.
Find the list of wkhtmltopdf exit codes found in the manual below:
The thing is codes 1 & Z should not throw an exception systematically because the PDF is generated.
I made a workaround, you can find it below:
It is not very clean code but it does the job, thus the issue should remain opened until it is fixed 😃
Ive set load-error-handling and load-media-error-handling to ‘ignore’
@nWidart you are trying to convert local file, right? In this case,
bootstrap.jshas relative path and it is interpreted as invalid. You should either use absolute file path in your html or if this JS file is not important for you, you can try https://github.com/wkhtmltopdf/wkhtmltopdf/blob/gh-pages/usage/wkhtmltopdf.txt#L138-L143Anyway, it is not Snappy issue.