Forum


Replies: 4   Views: 3041
How can i addimage after header/footer for each page?
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  · 08-12-2017 - 20:18

Hello,

We recommend you to use a custom template with an image placeholder and a text placeholder surrounded by block placeholders, and then use the cloneBlock method (http://www.phpdocx.com/api-documentation/docx-path/clone-blocks-in-docx) to clone the block as many times as needed. This method is available since phpdocx 7 for Advanced and Premium licenses.

The options relativeFromHorizontal and relativeFromVertical available in the addImage method since phpdocx 7.5 can also help for that task.

But please note there's no a 'perfect' approach for that task, as a DOCX is not like a PDF that is 'painted' in fixed positions. It is more similar to HMTL, as it is painted 'dynamically'; so you should manage the contents of the blocks to avoid creating new extra pages. There's no way to know the content after a header.

Regards.