Forum


Replies: 2   Views: 2176
Convert docx with header/footer to pdf without any office?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Chrisrj78  · 24-02-2020 - 13:56

Hi

Is it at all possible to convert a docx with header/footer to pdf without any office program installed on the server?

Can it be done with a dirty workaround?

Posted by admin  · 24-02-2020 - 15:16

Hello,

UPDATE: phpdocx 13 added support for headers and footers using the native conversion plugin.

DOCX to HTML allows getting each structure of the transformed DOCX using the returnHTMLStructure option (https://www.phpdocx.com/api-documentation/format-conversion/transform-docx-html-using-native-php-classes). Using this option you can get headers, footers and body transformed to HTML and then use DOMPDF (or any other HTML to PDF lib) to create the PDF output with the transformed contents, including headers and footers (https://ourcodeworld.com/articles/read/687/how-to-configure-a-header-and-footer-in-dompdf).

We recommend using the conversion plugin based on LibreOffice.

Regards.

Posted by Chrisrj78  · 24-02-2020 - 15:29

Hmmm...looks complicated. :D

But if that's the only way, I'll have to do it that way.

 

Thanks. :)