The task is as follows:
Add a new page with html to an existing document.
Add pagination and text with an image (html) to the footers.
For some documents this works, for some it does not (footer only in last page).
Please tell me what is the reason and how to solve it.
Additionally required:
Transform to pdf, add background image.
My code:
$phpdocx=new CreateDocxFromTemplate(ROOT_DIR.UPLOAD_DOCUMENTS_DIR.$document_source);
$phpdocx->addBreak(array('type'=>'page'));
$phpdocx->embedHTML($new_page);
$numbering=new WordFragment($phpdocx,'defaultFooter');
$numbering->addPageNumber('numerical',array(
'textAlign'=>'right',
'bold'=>true,
'sz'=>14,
'color'=>'65a9ef',
));
$numbering->embedHTML($footer_html);
$phpdocx->addFooter(array('default'=>$numbering));
$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));