Conversion plugin phpdocx

Debugging LibreOffice

Debugging LibreOffice

If you use LibreOffice as the transformation tool for the conversion plugin and the example of the library doesn't create the PDF file, follow these steps to find out the source of the error:

1. Execute the LibreOffice conversion from the command-line interface.

For example, in Linux, type this:

Replace /opt/libreoffice4.3/program/soffice for the path to LibreOffice in your Operating System, and replace document.docx for an existing document.

2. Make sure there's no other LibreOffice installation.

For example, if you download and install the last package from www.libreoffice.com, this one cannot work along with the default installation of the distribution.

In Linux operating systems, execute this to look for LibreOffice installations in the system directories:

3. Execute the transformDocument example included through the CLI mode.

4. If the PDF file is generated through the CLI mode, but not with a web server like Apache, the error is due to a security or permission problem.

To call LibreOffice, the server:

  • Needs to delete the possible blockage of SELinux or the blockage of the execution settings of external programs
  • Needs read and write permissions in the .config folder of the user´s HOME directory

So, for example, if the user of the web server is www-data, and the HOME directory of this user is the default /var/www, then you must provide the user www-data with read and write permissions in the directory /var/www/.config.

5. Check the server and system log files to detect other possible problems related to the configuration of any program or the lack of permissions.