And issue is only with the Headers And Footer Options?
I would start debugging from the static text in the header and footer options, rather supplying the dynamic variables to these args. Can you check if any of header-footer args in your case. The list of arguments are here https://wkhtmltopdf.org/usage/wkhtmltopdf.txt