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 offers four different execution modes:
- native: based on native PHP classes
- libreoffice: based on LibreOffice
- msword: based on MS Word
- openoffice: based on OpenOffice
All execution modes are compatible with Linux, Windows and macOS but the one based on MS Word, which requires a Windows server.
Thanks to the conversion plugin it is possible to perform the following conversions:
Due to format limitations, the PNG transformation only generates the first page of the document.
This way, the phpdocx functionalities allow you to achieve almost any type of conversion.
All the conversion plugin execution modes can be run by calling the transformDocument method, available in the CreateDocx class:
or in an independent way by directly instantiating its classes:
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.
- 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.
- Transform PDF, DOC, ODT and RTF files to DOCX to modify their contents with phpdocx.
- Convert DOCX files to PDF or PNG to preview it in browsers.
Besides 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
- Export comments and form fields
- Getting statistics of pages, images, tables...
Please visit the conversion plugin documentation page.