PHPWord
PHPWord copied to clipboard
not adding header and footer on pdf:(dompdf and mpdf)
Describe the Bug
i want convert docx to pdf that docx file contains header and footer
Steps to Reproduce
sample code with file docx sample sample.docx
<?php
require __DIR__ . '/vendor/autoload.php';
$address='sample.docx';
$savePath='sample.pdf';
$word = IOFactory::load($address); // load file word(docx)
Settings::setPdfRenderer(Settings::PDF_RENDERER_MPDF, __DIR__ . '/../../../vendor/mpdf');
$pdf = new PDF($word);
$render = $pdf->getRenderer();
$render->setPaperSize('A4');
$render->save($savePath);
Expected Behavior
exported file pdf with header
Current Behavior
exported file with out header and footer exorted pdf.pdf
Context
Please fill in your environment information:
- PHP Version:8.1
- PHPWord Version: ^1.2
this problem because WORD to PDF but for this job first exported WORD to HTML then HTML to PDF but WORD to HTML not header and footer supported
@hamedzare1397 any solution for adding header and footer?
@hamedzare1397 any solution for adding header and footer? try this project https://github.com/gotenberg/gotenberg