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 Encaster  · 26-06-2020 - 11:40

i've installed last version of libreoffice in ubuntu. 
If i try to convert from docx to pdf /usr/bin/soffice --invisible --convert-to pdf test.doc it works fine, but i got no TOC in result file. Also i try to convert using PHP:

$docx->transformDocument(storage_path('app/temp_docx/test.docx'), storage_path('app/temp_docx/test2.pdf'), 'libreoffice', array('toc' => true));

It also works, but there is no TOC in PDF. What is the reason?
I tried like this, to be sure, that php is using libreoffice method:

$docxConvert = new TransformDocAdvLibreOffice();
$docxConvert->transformDocument(storage_path('app/temp_docx/test.docx'), storage_path('app/temp_docx/test2.pdf'), array('toc' => 'true'));

No TOC there. 
Any suggestions? 
I also tried to convert like this
/usr/bin/soffice --headless --invisible --nodefault --view --nolockcheck --nologo --norestore --nofirststartwizard --convert-to pdf /var/www/application/storage/app/temp_docx/test.docx (same result)

So how can i get TOC in converted file?
And one more question. Is it possible to convert with libreoffice from DOCX to DOCX ( to get TOC before save) ?
I tried to do it in cli, but got error:
root@c3142a888a46:/var/www/html# /usr/bin/soffice --invisible --convert-to docx test.docx
convert /var/www/html/test.docx -> /var/www/html/test.docx using filter : MS Word 2007 XML
Overwriting: /var/www/html/test.docx
Error: Please verify input parameters... (SfxBaseModel::impl_store <file:///var/www/html/test.docx> failed: 0x4c0c(Error Area:Sfx Class:Write Code:12))