Conversion plugin phpdocx

Preparing the templates for its conversion and exporting the charts

Preparing the templates for conversion

To achieve the highest quality when transforming a document to PDF, it is advisable to follow some good practice steps:

  • You must set the sizes of the tables manually. So, instead of keeping the sizes with automatic values according to the content, indicate specific values for each row, column and cell.
  • Backgrounds will not be printed, so they won't appear in the final PDF.
  • Headers and footers are best transformed if their content is in a table. This allows to place correctly each header and footer element.
  • To hide the tables borders, erase them cell by cell. If you generate the DOCX from HTML with the embedHtml method, hide the border in each <td>.
  • Choose font types available in the operating system where the conversion plugin is running. Linux, Windows and MAC OSX allow to add new fonts easily.
Exporting the charts

Same as with pictures, it is possible to export existing charts in a DOCX document to PDF.

LibreOffice comes with Word graphic charts support. It runs a straight conversion with no extra configurations.

In the case of OpenOffice, it is necessary to install one of the following PHP libraries:

Unzip the chosen library in the lib directory with the name “jpgrah” or “ezcomponents”.

Running with JpGraph, you may encounter this error message:

  • 'JpGraphError::RaiseL(25128);//(‘The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.’)',

This is due to an incompatibility with the PHP version.

To fix this, modify the file gd_image.php of JpGraph commenting the line JpGraphError::RaiseL(25128); of the SetAntiAliasing method.

Next - Other conversion plugin