Forum


Replies: 3   Views: 1942
Generating toc before save
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by admin  · 26-06-2020 - 11:51

Hello,

Please check the docs folder included in the package to understand how to generate TOC contents when transforming to PDF/DOCX, get PDF A-1 files and other options available in transformDocument when using libreoffice. This feature is fully tested and working on Windows, Linux and macOS. As explained in the previous documentation you need to add a macro to your installation of LibreOffice to be able to generate the TOC (this macro needs to be added one time and it will used in all conversions that TOC are generated). Also note that the TOC content must exist, the following command:

$docx->transformDocument('document.docx', 'document.pdf', 'libreoffice', array('toc' => true));

update an existing TOC, but it doesn't add it. If you need to add a TOC dynamically you can use addTableContents.

You can generate TOC when transforming DOCX to PDF or to other document formats, including DOCX, but you can't use the same values as source and target. Also please check you are using a version of LibreOffice that supports saving as DOCX (LibreOffice 5.4 or newer, but we recommend using the latest release on libreoffice.org), using an old version of LibreOffice saving to DOCX isn't supported.

For further support, please send to contact[at]phpdocx.com the username or e-mail of the user that purchased the license and the DOCX you are using so we can check it.

Regards.