PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents

Home Page:https://phpoffice.github.io/PHPWord/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

hamedzare1397 opened this issue · 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

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