Conversion plugin phpdocx

Information

Information

The conversion plugin is one of the most remarkable features of phpdocx.

This plugin is available for the Advanced and Premium licenses. It allows to convert a DOCX file to PDF while keeping the contents and visual appearance.

phpdocx can generate this DOCX from scratch or through the replacement of placeholders in the case of templates.

Besides PDFs, it is also possible to generate HTML, ODT, DOC, RTF and TXT documents, always within file type limitations.

phpdocx has four methods to achieve the highest quality and best compatibility available:

  • transformDocument: This method is compatible with Linux, Windows and Mac OS X operating systems. You can choose between OpenOffice or LibreOffice to make the conversion to PDF and other format files. This method offers perfect results in most of the cases. In some templates it will be required to perform small changes to get a satisfactory output. The conversion plugin uses this method to transform the DOCX files to PDF and other formats. Use this method to transform or get other formats such as HTML, ODT, DOC, RTF and TXT.
  • transformDocUsingMSWord: This method is only available for Windows operating system. It uses the COM methods of PHP and a MS Word installation, running on Windows.
    The advantage of this method is that it obtains perfect results in all documents while using MS Word. The only drawback is that it forces the user to run Windows. If you have a document which transformDocument can't convert to PDF with proper quality, this is the method to achieve it.
  • txt2docx: This method transforms TXT files to DOCX.
  • docx2txt: This method transforms DOCX files to TXT.

transformDocument is the method which offers the best performance, flexibility and output quality of the four.

Although this method uses OpenOffice or LibreOffice to make the transformation, phpdocx doesn't just call these programs. Moreover, it previously prepares the document, cleans and fixes it to obtain the best possible quality in the resulting PDF file. To do that, phpdocx applies several tailor-made classes and methods.

Next - Installation and Set-up