PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.16k stars 2.68k forks source link

not adding header and footer on pdf:(dompdf and mpdf) #2602

Open hamedzare1397 opened 3 months ago

hamedzare1397 commented 3 months ago

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:

hamedzare1397 commented 3 months ago

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

robertnicjoo commented 2 months ago

@hamedzare1397 any solution for adding header and footer?

Maybe-U commented 2 months ago

@hamedzare1397 any solution for adding header and footer? try this project https://github.com/gotenberg/gotenberg