Closed daemon-byte closed 5 years ago
Ok it seems I needed bigger margins and to explicitly set a font size. Might be worth putting that in the readme file?
$converter->setOptions([
'landscape' => false,
'printBackground' => true,
'displayHeaderFooter' => true,
'headerTemplate' => '<div style="font-size:10px !important;">I am a header</div>',
'footerTemplate' => '<div style="font-size:10px !important;">I am a footer</div>',
'margin' => ['top' => '40px', 'bottom' => '40px', 'left' => '40px', 'right' => '40px']
]);
The problem is that page styles are not visible inside header and footer templates. This is a limitation of Chromium. Therefore, without setting any styles inside the templates, a default font size is being used which can be very small. Will update the documentation accordingly.
im also using same liberary on codeigniter when im parsing the url the fucntion get the content for the url but its stills return null can you help me with that
I'm using the code below and it's generating the pdf file with the margins. However it's not displaying any header or footer. Neither my custom or chrome's standard. I even tried removing the headerTemplate option and nothing. Is there a bug or am I doing something wrong? I'm using the latest version.
$input = new StringInput(); $input->setHtml($html); $converter = new Converter($input, new StringOutput()); $converter->setOptions([ 'landscape' => false, 'printBackground' => true, 'displayHeaderFooter' => true, 'headerTemplate' => '<p>I am a header</p>', 'margin' => ['top' => '5px', 'bottom' => '5px', 'left' => '5px', 'right' => '5px'] ]); $output = $converter->convert(); $binary = $output->get(); if ($binary) { $this->getLogger()->logUserActivity('result_download'); $filename = 'result.pdf'; return new Response($binary, 200, [ 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="' . $filename . '"' ]); }