^ "/bin/wkhtmltopdf --lowquality --margin-bottom '28mm' --margin-left '12.7mm' --margin-right '12.7mm' --margin-top '108mm' --page-size 'A4' --footer-html '/tmp/knp_snappy604ca42537cad8.41582781.html' --header-font-size '9' --header-html '/tmp/knp_snappy604ca425381664.17807617.html' --header-spacing '35' '/tmp/knp_snappy604ca425376a93.90581590.html' '/tmp/knp_snappy604ca425379d27.84192902.pdf'"
^ "/bin/wkhtmltopdf --lowquality --margin-bottom '28mm' --margin-left '12.7mm' --margin-right '12.7mm' --margin-top '108mm' --page-size 'A4' --footer-html '/tmp/knp_snappy604ca4278bbf83.36217007.html' --header-font-size '9' --header-html '/tmp/knp_snappy604ca4278c01f7.01412639.html' --header-spacing '35' '/tmp/knp_snappy604ca4278b7080.67871534.html' '/tmp/knp_snappy604ca4278b7804.67510287.pdf'"
^ "/bin/wkhtmltopdf --lowquality --margin-bottom '28mm' --margin-left '12.7mm' --margin-right '12.7mm' --margin-top '108mm' --page-size 'A4' --footer-html '/tmp/knp_snappy604ca429d13ff6.49480072.html' --header-font-size '9' --header-html '/tmp/knp_snappy604ca429d16b02.79007078.html' --header-spacing '35' '/tmp/knp_snappy604ca429d10551.15502426.html' '/tmp/knp_snappy604ca429d10c60.64803963.pdf'"
^ "/bin/wkhtmltopdf --lowquality --margin-bottom '28mm' --margin-left '12.7mm' --margin-right '12.7mm' --margin-top '108mm' --page-size 'A4' --footer-html '/tmp/knp_snappy604ca42bf0f520.81006821.html' --header-font-size '9' --header-html '/tmp/knp_snappy604ca42bf121c0.58055908.html' --header-spacing '35' '/tmp/knp_snappy604ca42bf0b1a4.97984239.html' '/tmp/knp_snappy604ca42bf0b9d6.69117414.pdf'"
^ "/bin/wkhtmltopdf --lowquality --margin-bottom '28mm' --margin-left '12.7mm' --margin-right '12.7mm' --margin-top '108mm' --page-size 'A4' --footer-html '/tmp/knp_snappy604ca42e35e5d2.87116495.html' --header-font-size '9' --header-html '/tmp/knp_snappy604ca42e362745.68628164.html' --header-spacing '35' '/tmp/knp_snappy604ca42e3591d8.37035366.html' '/tmp/knp_snappy604ca42e359e44.86383899.pdf'"
^ "/bin/wkhtmltopdf --lowquality --margin-bottom '28mm' --margin-left '12.7mm' --margin-right '12.7mm' --margin-top '108mm' --page-size 'A4' --footer-html '/tmp/knp_snappy604ca4307233c7.92844580.html' --header-font-size '9' --header-html '/tmp/knp_snappy604ca430726ac1.01641554.html' --header-spacing '35' '/tmp/knp_snappy604ca43071f457.12291005.html' '/tmp/knp_snappy604ca43071fc24.67774604.pdf’"
This looks pretty ok to me. For a second I thought maybe the temple was the issue, but I see the tempfiles have specific hash, so they can not really interfere with one-another.
BTW: I’ve also realised, it is only the FIRST document which is generated correctly, everything after that isn’t.
Here is a code snippet of the actual pdf part:
$fileName = sprintf('%s.pdf', (string) $document->getDocumentNumber());
$cssFiles = $this->encore->getEntrypointLookup('_default')->getCssFiles('pdf');
$css = '';
foreach ($cssFiles as $cssFile) {
$css .= file_get_contents($this->projectDir.'/public'.$cssFile);
}
$html = $this->twig->render('sales/pdf/index.html.twig', ['document' => $document, 'css' => $css]);
$header = $this->twig->render('sales/pdf/header.html.twig', ['document' => $document, 'css' => $css]);
$footer = $this->twig->render('snippets/pdf-footer.html.twig', ['document' => $document, 'css' => $css]);
$pdfOptions = [
'page-size' => 'A4',
'header-html' => $header,
'header-font-size' => 9,
'header-spacing' => 35,
'footer-html' => $footer,
'margin-top' => '108mm',
'margin-bottom' => '28mm',
'margin-left' => '12.7mm',
'margin-right' => '12.7mm',
];
$pdf = $this->pdf->getOutputFromHtml($html, $pdfOptions);
if ($save === true) {
$this->pathBuilder->setCompanyId((string) $document->getCompanyId());
$this->uploadFile->saveNewFile($this->pathBuilder, $document->getType(), $fileName, $pdf);
} I have a console command which retrieves all documents from the database and calls this code for every document in order to generate all the pdf’s. As for the css, I get the css files from Encore and then get their contents to build up a css string which is added in a <style> tag in the <head> of the html files.
I have also attached a correct (OF-20-0019), and incorrect (OF20-0018) file so you can see the difference. Considering the fonts are still generated I’m not sure CSS is the problem here.