Open buchmayr opened 8 years ago
Any news on this? Ended up inserting custom html code with a position: fixed style
Any news on this? Ended up inserting custom html code with a position: fixed style
Can you show some example of your code?
Settings::setPdfRendererName(Settings::PDF_RENDERER_DOMPDF);
Settings::setPdfRendererPath('/vendor/dompdf/dompdf');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addHeader()->addImage('my-image.png');
$section->addTitle("HELLO WORLD!");
$section->addText('Lorem ipsum dolor sit amet, consetetur sadipscing elitr');
$footer = $section->addFooter();
$footer->addText('FOOTER');
$pdfWriter = IOFactory::createWriter($phpWord, 'PDF');
$pdfWriter->save('sample.pdf');
$docxWriter = IOFactory::createWriter($phpWord, 'Word2007');
$docxWriter->save('sample.docx');
The resulting .docx has header and footer but the .pdf has not. Why? I tested dompdf and mpdf.
Is it possible to render Footer and Header from Word using the PDF writer? Seems like it skips the parts created with:
$section->createHeader(); $section->createFooter();