Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

DOCX to PDF vs wysiwyg to PDF

Hello,

I work on this functionality.

I have a DOCX document with some variables like ${variable}, so that it's possible to replace the variables with values by using the word template processor from the phpword package.

So I upload the file to the server and then I replace the variables with some values and I convert the resulting file to PDF. To do that it's necessary to use either an API or a robust PHP package if I don't want to lose some formats inside the DOCX file (phpword with DomPDF isn't sufficient). For example it works fine with PSPDFKIT.

Instead of doing this way, I can perhaps create the documents directly in a wysiwyg and save the content of the file in the database. Then I can transform the content to PDF by using DomPDF (not tested yet).

What would you suggest me ? Is it a good idea to use a wysiwyg ? Is it better to work with real DOCX files ?

Thanks for your help.

V

0 likes
0 replies

Please or to participate in this conversation.