wkhtmltopdf has very different behavior when certain resources fail to load, which depends on the URL of the resource.
Simply changing the URL of the failed resource changes the exit code of wkhtmltopdf. Certain URLs cause a ContentNotFoundError with an exit code of 1, and others are ignored with an exit code of 0.
All of these tests seem like they should have at least the same exit code.
Tested with wkhtmltopdf 0.12.2.1 (with patched qt).
wkhtmltopdf test1.html test1.pdf
Loading pages (1/6)
Warning: Failed to load file:///not_here.css (ignore)
Warning: Failed to load file:///not_here.js (ignore)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Exit code: 0
wkhtmltopdf test2.html test2.pdf
Loading pages (1/6)
Warning: Failed to load file:///not_here.js (ignore)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Exit with code 1 due to network error: ContentNotFoundError
wkhtmltopdf --load-error-handling ignore test2.html test2.pdf
Exact same output as above: --load-error-handling ignore
has no effect
wkhtmltopdf test3.html test3.pdf
Loading pages (1/6)
Warning: Failed to load file:///not_here.css (ignore)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done
Exit with code 1 due to network error: ContentNotFoundError
wkhtmltopdf --load-error-handling ignore test3.html test3.pdf
Exact same output as above: --load-error-handling ignore
has no effect
Quite helpful! 👍