Convert To PDF after mailmerge performance issue

Hi muhammad,

I’m sorry that I can’t show you the complete code for my company’s policy. But I can tell you how to reproduce the issue in another way.

if you unhide text from the template(111.doc) you will find a lot bookmark code like {set XXX} {ref XXX} which surrounds the {tablestart} and {tableend}. So these bookmarks will be replicated as many as the number of table rows. So you can
1. Manually “merge” the field by replace the mergefield with some sorts or data.
2. Copy the line for 100+ times, to mimic the table merge process.

Then you will got a word doc, just try the convert to pdf of this DOC, you will find it spend much more time(about 500 times) to convert. In fact, the merge process has the similar issue and take even more time than the convert process.

For your convince I attached the “merged” doc.

Hi Kin,
This document has a complex structure and it takes a lot of time if we try to load and convert it in MS Word also. Aspose.Words takes less time (almost half) to load and convert it. At my end 15.9.0 version takes 100 seconds to load and convert it and MS Word takes a lot more than that.
As far as memory is concerned, the document size is around 100 MB and Aspose.Words for Java takes ten times more memory than the document size which is normal behavior. MS Word also takes more memory for the same document.
Although this 100 MB size takes around 1 GB memory at my end when it is converted to PDF however I was not able to reproduce out of memory exception at my end.
Best Regards,

Can you pls have a look at the template I upload previously and comparing it with the merged doc? Do you know the reason why it takes so many time and memory to merge and convert? If we can rewrite the template to optimize it?

The OOM will not happen this time because this DOC only contain 195 table items. But if the number increase to 300, if will cost not only linear memory usage.

Hi Kin,
We are investigating your template and trying to simplify it to reduce memory usage. It would be better to create a new template from scratch as the size of templates does not increase that much with 200-300 rows.
Best Regards,

Hi Kin,
Your template has a complex structure and it is difficult to edit it even in MS Word. You can check it by opening the template in MS Word and then pressing Alt+F9.
It would be better to create a new Word document and add the same fields in the new document manually. This will reduce the template size and improve performance.
Best Regards,