I'm using Knp SnappyBundle in Symfony 4.
I'm having trouble passing the custom-header argument (--custom-header <name> <value>
) to wkhtmltopdf
through yaml or as option in request.
Here is what I'm trying, which seems to fail:
knp_snappy:
temporary_folder: "%kernel.cache_dir%/snappy"
pdf:
enabled: true
binary: xvfb-run wkhtmltopdf
options:
- { name: 'custom-header', value: '%app_auth_header_name%' '%app_auth_header_token%' }
I've also tried passing the values as an array, but that also fails.
I have solved it partially, unfortunately not by yaml, but direcly in code example:
public function getPdfBinary($url, Pdf $pdfService): PdfResponse
{
$url = urldecode($url);
$res = new PdfResponse($pdfService->getOutput($url, ['custom-header' =>
[ 'X-Authorization' => 'mytoken' ] ]),'output.pdf');
return $res;
yaml expect scalar value of custom-header...