Conversion plugin phpdocx

Conversion plugin installation and set up

Set up

The selection of the transformation method to choose is done in the config/phpdocxconfig.ini file:

The available options are the following:

  • method: the option of choice in the conversion plugin. Available options: native, libreoffice, openoffice or msword.
  • path: only necessary if the previous option is libreoffice. Type the absolute path to the LibreOffice executable file.

Type this configuration to use the conversion plugin based on LibreOffice (including the path in the OS to the LibreOffice executable):

AppImage format can also be used. This requires using global paths in source and target options.

Type this if you prefer the native PHP classes:

Type this if you prefer to work with the msword method:

Or type this if you prefer OpenOffice:

If you are using a Windows server and the LibreOffice method and the path includes blank spaces please wrap the path with single quotation marks:

You can also choose and overwrite the conversion method dynamically with the "method" option when invoking transformDocument. E.g., when working with the method based on LibreOffice:

Installation

The native method requires installing DOMPDF.

To work with the method based on LibreOffice it is mandatory to install its version 4.3 or higher. It is suggested to download and install the latest available version: https://www.libreoffice.org/download/libreoffice-fresh.

For Linux operating systems, you can also download LibreOffice from the distribution official repositories.

The msword method needs a Windows server, PHP COM support and the installation of MS Word 2007 or higher.

Starting OpenOffice in headless mode

If you have chosen OpenOffice as the tool to transform to PDF, you need to start it in headless mode before doing any transformation.

In order to do this with Windows, just open a terminal and execute:

Or with Linux:

Next - Running the first example and options