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

Free Support Forum - aspose.com

Out of Memory exception on saving PDF file

I am using below source code to save 60MB pdf file to MemoryStream, and I am getting out of memory exception. Is there any limitation to the PDF file size on Aspose. Is there any option from Aspose to get size of the PDF file instead of using System.IO.FileInfo(path).Length.

byte[] bytes = null;
MemoryStream docStream = new MemoryStream();

using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fullFilePath))
{
pdfDocument.FitWindow = true;
intPageCount = pdfDocument.Pages.Count;
pdfDocument.Save(docStream); //Memory Exception on this line of code
bytes = docStream.ToArray();
docStream.Flush();
docStream.Close();
}

Hi there,


Thanks for your inquiry. I have tested the scenario with a sample 60+MB PDF document and unable to notice the reported exception. We will appreciate it if you please share your sample PDF document via some free file sharing service. We will look into it and will guide you accordingly.

Furthermore, I am afraid Aspose.Pdf does not provide any option to get file size.

Best Regards,