We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Inserting many identical images in document

Hi. We are planning to use Aspose.Words to generate huge documents with a lot of identical images (icons). We have a problem now, if we use this


then our document generates for around 8 hours and .docx size is around 25 Mb, but the process takes around 7-8 Gb of memory (3 Gb of them is your internal copy of the images).
If we remove this line document generates about 10 minutes, it’s OK for us.
So how can we optimize it? Can we add only one copy of image to document and then make a links to it? Or there is another way? Or we can’t do it better than now?


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document and image.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

AsposeTest.zip (67.2 KB)
Hello. It’s a WinForms app with test template. Allows to test generating report with images and without them and shows timing and memory consumption. You can set any segments to generate, but in general we need to generate around 5000 segments (the worst case). With our current version of Aspose.Words (16.2.0) on 3000 segments we get OutOfMemoryException after many hours of work. We need to determine if there any improvements in new versions of Words (memory consumption, generation and saving speed). Can you test it and send us comparison for 16.2.0 version and the latest? Test templates and images are in resources of the project.


Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for .NET 17.9 for 500 segments. It takes 7 minutes at our end. You can also test this scenario at your end using temporary license. Please request for it from here:
Get a Temporary License

Thanks, we will try! But what can we do if we need 5 000 segments? Is there any way to do that?


Thanks for your inquiry. Please note that performance and memory usage all depend on complexity and size of the documents you are generating. In your case, we suggest you please create the small size documents instead of one huge size document. After creating the documents, please join them using Document.AppendDocument method. Hope this helps you.