News

PHPDocX and COM

  • Jun 19, 2012

Warning

This post is outdated. For up date information about PHPDocX and COM please refer to the Conversion plugin.

Although PHPDocX has been designed to work in non-proprietary environments like LAMP servers, and therefore has no need of specific Microsoft components, some of our users do indeed work on Windows environments (PHPDocX only requires PHP 5).

So there is no good reason to avoid interaction with MS Word on the server side when that may add extra value for some of our users.

By the time being we have only developed one method that uses COM with the goal to improve the format conversion capabilities of our library: transformDocxUsingMSWord.

This method does not only require to work on a Windows server but also to have a copy of MS Word (2007 or newer) running on the server.

Its use is extremely simple and the functionality offered includes the transformation of Word docx document into PDF, DOC (legacy version of Word), RTF and TXT files.

The conversion is, of course, as good as the one of Word (it is Word what is really doing the job for us so no merit on us for that).

To illustrate it use we just point out that the conversion of a docx document into pdf just needs a single line of code:



$docx->transformDocxUsingMSWord($myPath.'TemplateText.docx', $targetPath.'test.pdf');



We hope that some of you will find this addition useful.