Aspose PDF throwing System.OutOfMemoryException exception while executing document.Pages.Add and document.save method for large size pdf of 133MB

Aspose.pdf
Version: 11.2.0.0

Code Snippet:

try
{
document.Pages.Add(pdfDocument.Pages[pageCount]);
bool IsExcludeTemplateFolderStructure = CheckIsExcludeTemplateFolderStructure(SessionKey, obj.ObjectType);

                                        if (newDoc == true && pageCount == pdfDocument.Pages.Count)
                                        {
                                            MemoryStream outStream1 = new MemoryStream();
                                            document.Save(outStream1, SaveFormat.None);
                                            byte[] docBytes1 = outStream1.ToArray();
                                            var log = UploadFile(SessionKey, obj.ObjectType, obj.ObjectCode, obj.AttachmentType, SessionKey.UserId, obj.FileName, docBytes1, false, false, Convert.ToInt32(FileOperation.Override));

}
catch (Exception ex)
{
SessionKey.LogException(ex);
}

@pranalisargar

You are using very old version of Aspose.PDF. Please upgrade to the latest version of Aspose.PDF for .NET 22.6 and let us know how it goes on your side. Hope this helps you.