Thank you for the fast response however we have tried the following code which takes the final output document with TOC but which does not get updated :
$phpdocx->transformDocument($_SERVER['DOCUMENT_ROOT'] . '/pdf/output.docx', $_SERVER['DOCUMENT_ROOT'] . '/pdf/output.docx', null, array('toc' => true));
Any help appreciated.