Thanks a lot, this solved the problem.
But now the document loses its previous headers and footers.
Can you please tell me if it is possible to combine the new headers and footers with the old headers and footers from the template?
$phpdocx=new CreateDocxFromTemplate(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$document_source);
$phpdocx_numbering=new CreateDocx();
$numbering=new WordFragment($phpdocx_numbering,'defaultFooter');
$numbering->addPageNumber('numerical',array(
'textAlign'=>'right',
'bold'=>false,
'sz'=>12,
'color'=>'65a9ef',
'spacingBottom'=>0,
'spacingTop'=>0,
));
$numbering->addText($numbering_text,array(
'textAlign'=>'right',
'bold'=>false,
'sz'=>8,
'color'=>'65a9ef',
));
$phpdocx_numbering->addFooter(array('default'=>$numbering,'first'=>$numbering,'even'=>$numbering));
$phpdocx_numbering->createDocx(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$numbering_name);
$phpdocx->addBreak(array('type'=>'page'));
$phpdocx->embedHTML($add_text);
$phpdocx->importHeadersAndFooters(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$numbering_name);
$phpdocx->createDocx(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$temp_name);
$phpdocx->transformDocument(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$temp_name,ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$pdf_name);
$pdf_util=new PdfUtilities();
$pdf_util->addBackgroundImage(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$pdf_name,ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$pdf_name,ROOT_DIR.IMAGES_SETTINGS_DIR.$settings['wtm'],array('height'=>'auto','width'=>'auto','opacity'=>0.1));