Hi
We are combining 1000s of small (average 100-150kb each) A4 pngs into a single PDF. This works fine but when we run the following:
pdf.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
RemovePrivateInfo = true,
AllowReusePageContent = true,
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
CompressImages = true,
ImageQuality = 50,
});
pdf.Optimize();
to optimize we are hitting memory issues.
The application server has 1.75GB of memory and it’s fine with 2000 pages but crashes with 3000 pages however if we up the memory to the next size 3.5GB then the PDF saves fine.
Given the final PDF for the 3000 page pdf is only about 45MB I’m confused as to why it should be blowing the memory.
Additionally when I run this on a local machine for 3000 images with bucket loads of memory it happily swallows 3GB before it even gets to the optimize, then during optimize it uses another 1GB, the final save doesn’t seem to impact the memory usage that much.
We add the images to each page like so (to avoid having them in memory was my hope):
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
image1.File = tempfile;
page.Paragraphs.Add(image1);
Is there anything else we can do to reduce the memory usage or is this a memory leak?
Thanks
Simon
PS: I recently updated to version 17.6 of the Aspose.Pdf library so it’s fairly recent.