How to use macros with the libreoffice conversion plugin
--------------------------------------------------------
1. It is necessary to use the LibreOffice plugin to make the conversion.
2. Open with a text editor the macros file.
This file is located in the home directory of the user that is going to make the conversion.
For example with the default configuration for the apache web server, it is located in the path /var/www/.config/libreoffice/V/user/basic/Standard/Module1.xba.
Or using FastCGI as PHP handler, this file is located at .config/libreoffice/V/user/basic/Standard/Module1.xba of ther user's folder. V is the LibreOffice version.
If the directory .config/libreoffice, doesn’t exists, make a first conversion so LibreOffice generates this path structure.
Using Windows, the default path of this file is in the AppData\Roaming\LibreOffice folder of the user's profile.
3. In the opened file, add the new macro. You may find the available macros in the macros folder.
4. You can now use the new macro.
These are the available options:
Generate TOC when transforming to PDF:
$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice', array('toc' => true));
Generate PDF/A-1:
$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice', array('pdfa1' => true));
Generate PDF/A-2:
$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice', array('pdfa2' => true));
Generate PDF/A-3:
$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice', array('pdfa3' => true));
Generate TOC when transforming to PDF/A-1:
$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice', array('toc' => true, 'pdfa1' => true));
Generate TOC of a DOCX document (global path must be used as target folder):
$docx->transformDocument('document.docx', '/global_path/document.docx', 'libreoffice', array('toc' => true));
Export the notes/comments:
$docx->transformDocument('document.docx', 'document.docx', 'libreoffice', array('comments' => true));
Lossless compression:
$docx->transformDocument('document.docx', 'document.docx', 'libreoffice', array('losslesscompression' => true));
Form fields:
$docx->transformDocument('document.docx', 'document.docx', 'libreoffice', array('formsfields' => true));
Get the document statistics:
$docx->getStatistics('document.docx');
How to add the comments in the margins
--------------------------------------------------------
1. Edit the configuration file properties of LibreOffice. This file is available in the HOME folder in the following path: .config/libreoffice/4/user/registrymodifications.xcu
2. Find the following line:
- 0
And set '4' as value:
- 4