Compress/Optimize PDF documents using Aspose.PDF for .NET - StackOverFlowException occurs

Hi,
I am using aspose.pdf (v17.6) to compress pdfs. It works fine with small files, but it has “StackOverflowException” for big files greater than about 130MB. I tested it with the latest aspose.pdf version ( v19.7 ), but still had the same issue. Any suggestions?

using (Aspose.Pdf.Document pdfDocumentTemp = new Aspose.Pdf.Document(inputFile))
{
pdfDocumentTemp.OptimizeSize = true;
pdfDocumentTemp.OptimizeResources(new Aspose.Pdf.Document.OptimizationOptions()
{
RemoveUnusedStreams = true,
RemoveUnusedObjects = true,
LinkDuplcateStreams = true,
AllowReusePageContent = true,
UnembedFonts = false
});

                        pdfDocumentTemp.Save(tempFileName);                            
                    }

Regards,
JS

@dtechtest1

Would you kindly upload your PDF document to Google Drive or Dropbox and share the link with us. We will test the scenario in our environment and address it accordingly.

Hi,
here is the pdf link. The size is about 250 MB.

@dtechtest1

We were able to notice that memory consumption was hiking continuously while processing your document. However, we were unable to notice StackOverFlowException due to suspended system during testing. Would you kindly share the stack trace of exception which you have received at your end. We will further proceed to assist you accordingly.

Hi,
It doesn’t have much info… I hope the screen shots help

image.png (11.1 KB)

image.png (13.8 KB)

image.png (28.7 KB)

@dtechtest1

We have logged an issue as PDFNET-46805 in our issue tracking system. We will further look into the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.