Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Footer/Header in PDF #843

Open
buchmayr opened this issue Jul 27, 2016 · 3 comments
Open

Footer/Header in PDF #843

buchmayr opened this issue Jul 27, 2016 · 3 comments

Comments

@buchmayr
Copy link

buchmayr commented Jul 27, 2016

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();


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@zdimension
Copy link

zdimension commented May 23, 2021

Any news on this? Ended up inserting custom html code with a position: fixed style

@vkurlenko
Copy link

Any news on this? Ended up inserting custom html code with a position: fixed style

Can you show some example of your code?

@FabianKoestring
Copy link

FabianKoestring commented Jun 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants