PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

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

Open hamedzare1397 opened this issue 1 year ago • 3 comments

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

hamedzare1397 avatar Apr 03 '24 10:04 hamedzare1397

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 avatar Apr 03 '24 10:04 hamedzare1397

@hamedzare1397 any solution for adding header and footer?

robertnicjoo avatar Apr 15 '24 07:04 robertnicjoo

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

Maybe-U avatar Apr 17 '24 10:04 Maybe-U