Forum


Replies: 1   Views: 3935
How can i set position to watermark to footer?
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 admin  · 23-10-2017 - 11:24

Hello,

Watermarks are always added centered to the page. You can scale the image added as watermark and add watermarks per section.

If you need to add an image to even pages, the easiest approach is to create a custom DOCX template with headers and footers with an image placeholder, then import it to your DOCX and then replace the placeholder image:

https://www.phpdocx.com/api-documentation/layout-and-general/import-headers-and-footers-Word-document-with-PHP

https://www.phpdocx.com/api-documentation/templates/replace-placeholder-image-Word-document

Anyway, adding WordFragments with images to headers and footers work perfectly and they aren't overwrite unless you remove them.

Just to comment other approach, since phpdocx 7.5, the addImage method includes the relativeToHorizontal and relativeToVertical options to add images relative to margins, pages...:

https://www.phpdocx.com/api-documentation/word-content/insert-image-Word-document-with-PHP

Regards.