Forum


Replies: 4   Views: 3079
Toc update fails when transform docx to pdf
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 kratpic  · 08-05-2018 - 13:28

Here is my code :

$docx = new Phpdocx\Create\CreateDocx();

$docx->enableCompatibilityMode();

$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
    'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' .
    'officia deserunt mollit anim id est laborum.';

$paramsText = array(
    'b' => 'single',
    'font' => 'Arial'
);

$docx->addText($text, $paramsText);

$docx->addTableContents(array('autoUpdate' => true,"displayLevels" => "1-2")); // add some headings so they show up in the TOC

$docx->createDocx('example_text');

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

With 

$docx->transformDocument('example_text.docx', 'example_text.pdf', null, array('toc' => false));

the PDF is created, but the TOC is not updated.

With 'toc' => true, the conversion fails

I need your help plese. Is-it a bug with version 8 ?