Conversion plugin

Conversion plugin

Purpose of the conversion plugin

The Advanced and Premium licences of phpdocx include the conversion plugin. Its purpose is to convert document formats while keeping their content and visual style at the same time.

The main goal of the conversion plugin is to transform DOCX documents to PDF and HTML. However, it is also compatible with many other formats. This way you can work with the following document formats: DOCX, PDF, (X)HTML, DOC, ODT, PNG, RTF and TXT.

The conversion plugin is multi-platform and compatible with Windows, Linux and macOS. Once installed, it is as easy to use as executing this PHP line of code:

Since the release of phpdocx 8, Advanced and Premium license includes native PHP classes to transform DOCX to HTML:

Possible conversions

Thanks to the conversion plugin it is possible to perform the following conversions:

Source Output
DOCX PDF (X)HTML DOC ODT PNG RTF TXT
DOC DOCX PDF (X)HTML ODT PNG RTF TXT
ODT DOCX PDF (X)HTML DOC PNG RTF TXT
RTF DOCX PDF (X)HTML DOC ODT PNG TXT

Due to format limitations, the PNG transformation only generates the first page of the document.

You can combine the conversion plugin with the embedHTML method to transform HTML to DOCX, and with TXT2DOCX to convert text files to DOCX.

This way, the phpdocx functionalities allow you to achieve almost any type of conversion.

Usual test cases

These are the most usual test cases when working with the phpdocx conversion plugin:

  • Generate DOCX files from scratch or from templates and convert them to PDF.
  • Create a WYSIWYG HTML editor with CKEditor (or any other editor), convert the resulting HTML to DOCX and finally transform it to PDF, DOC and so on.
  • Transform DOC, ODT and RTF files to DOCX to modify their contents with phpdocx.
  • Convert DOCX files to HTML and embed them in a WYSIWYG editor. This allows to edit it online, then converting it again to DOCX to lastly transform it to PDF, PNG, DOC and so on.
  • Convert DOCX files to PDF or PNG to preview it in browsers.

Additional features

Apart from the features of the conversion plugin explained so far, phpdocx adds support for the following options:

  • Generate PDFs in PDF/A-1 format
  • Automatic generation of the Table of Contents (TOC)
  • Default configuration for CKEditor
  • Options to improve the final output of the documents
  • Obtaining statistics of pages, images, tables...
  • Support to run MS Word on Windows servers to generate the documents

For more information

Please visit the conversion plugin documentation page.