Forum


Replies: 2   Views: 139
How to improve merging process ?

Posted by Bouillou  · 01-11-2024 - 14:26

Dear support,

I've been using PHPDocX for a long time, and I'd like your advice on one of my processes. 

I often have mass mailings letter containing 100 pages to create using a Word template.

Here's my process:

1) Load a specific template containing ~20 variables, a header with a small image, a footer with text and few variables and font customization with "CreateDocxFromTemplate"

2) Replace variables

3) Save the document in a specific folder pending merging

4) Repeat steps 1, 2 and 3 with the same template 100 times

5) Merge all documents to create the final document (with MultiMerge class), then delete individual files.

This process works well, but when the template size is 200kB (because of the header logo for example), the final document size is 200kB * 100 small files merged together => 20MB.

I'm sure I could improve this process to reduce the final file size as the template is always the same for all my 100x individual files.

Could you please give me your advice?