Forum


Replies: 5   Views: 201
Remove watermark added by phpdocx

Posted by admin  · 04-09-2024 - 15:01

Hello,

If we run the following code:

$docx = new CreateDocx();

$docx->addText('Section 1A');
$docx->addBreak(array('type' => 'page'));
$docx->addText('Section 1B');

$docx->addSection('nextPage', 'A4-landscape');
$docx->addText('Section 2A');
$docx->addBreak(array('type' => 'page'));
$docx->addText('Section 2B');

$docx->addSection('nextPage', 'A4');
$docx->addText('Section 3A');
$docx->addBreak(array('type' => 'page'));
$docx->addText('Section 3B');

$docx->createDocx('new_document');

$docxUtilities = new DocxUtilities();
$docxUtilities->watermarkDocx('new_document.docx', 'new_document_watermark.docx', 'text', array('text' => 'phpdocx'));

that adds: two pages, a section break with a landscape layout, two pages, a section break with a portrait  layout, and two pages. A watermark is added to all sections.

If we open the DOCX output with MS Word and choose "Remove Watermark", all watermarks are removed correctly. However, as explained in our previous reply, removing watermarks per section may sometimes be needed.

For further support, we'd need to check the DOCX output and the watermarkDocx options you are using. You can send them to contact[at]phpdocx.com

Regards.