Conversion plugin phpdocx
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 transform documents while keeping their contents and visual appearance. For example DOCX to PDF, DOCX to HTML, DOC to DOCX, PDF to DOCX, DOCX to PNG...
phpdocx includes four transformation methods to achieve the highest quality and best compatibility available:
-
native: it uses native PHP classes to transform documents.
HTML to DOCX and DOCX to HTML conversions are done using PHP native classes: HTML to Word and Word to HTML.
- libreoffice: based on LibreOffice. This is the recommended method to transform DOCX to PDF because of its compatibility (Windows, Linux, macOS), performance, flexibility and number of options, for example, support for the generation of TOC contents or comment export.
- msword: based on MS Word. Only available for Windows. It uses PHP COM methods and requires a MS Word installation.
- openoffice: based on OpenOffice. Deprecated. It is advisable to choose one of the previous modes. This one is only compatible with Windows and Linux. It remains for compatibility reasons with old phpdocx versions.
The supported document formats depend on the conversion plugin method chosen for the transformation.
native
Source | Output | |
---|---|---|
DOCX | HTML | |
HTML | DOCX | |
PNG |
libreoffice
Source | Output | |||||||
---|---|---|---|---|---|---|---|---|
DOCX | (X)HTML | DOC | ODT | PNG | RTF | TXT | ||
DOC | DOCX | (X)HTML | ODT | PNG | RTF | TXT | ||
ODT | DOCX | (X)HTML | DOC | PNG | RTF | TXT | ||
DOCX | DOC | ODT | RTF | PNG | TXT | |||
RTF | DOCX | (X)HTML | DOC | ODT | PNG | TXT |
Due to format limitations, the PNG transformation only generates the first page of the document using the conversion plugin based on LibreOffice. To transform all DOCX pages to PNG the best approach is transforming DOCX to PDF using this conversion plugin and then use the native conversion plugin to transform PDF to PNG.
msword
Source | Output | ||
---|---|---|---|
DOCX | DOC | ||
DOCX | DOC | ||
DOC | DOCX |
openoffice
Source | Output | ||||||
---|---|---|---|---|---|---|---|
DOCX | (X)HTML | DOC | ODT | RTF | TXT | ||
DOC | DOCX | (X)HTML | ODT | RTF | TXT | ||
ODT | DOCX | (X)HTML | DOC | RTF | TXT | ||
RTF | DOCX | (X)HTML | DOC | ODT | TXT |
HTML to DOCX and DOCX to HTML conversions are done using PHP native classes: HTML to Word and Word to HTML.
To transform DOCX to PDF, for the vast majority of projects it is advisable to run the method based on Libreoffice, as it is compatible with Linux, Windows and macOS, converts perfectly a great amount of documents and includes options like comment and form fields export, automatic generation of the TOC content or creation of PDF/A-1 documents, among other features.
If you can only run PHP in the server, the native method is an excellent choice, provided that the documents use the supported contents and styles.
In the event of a compatibility issue with the requisites of the contents of the previous conversion modes or in case of a need of converting PDF documents to DOCX, the preferred method is the one based on MS Word. This method demands a Windows server, PHP COM and MS Word and allows to obtain documents absolutely identical to the original one.