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

Free Support Forum - aspose.com

Getting OutOfMemoryException while downloading in DOC or PDF


We are using Aspose.Words(version=14.6.0) in our application. And getting below error on downloading a file in doc or pdf format.

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. NEWLINETOKEN at System.IO.MemoryStream.set_Capacity(Int32 value) NEWLINETOKEN at System.IO.MemoryStream.EnsureCapacity(Int32 value) NEWLINETOKEN at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) NEWLINETOKEN at ? .(Stream ) NEWLINETOKEN at ? .() NEWLINETOKEN at ? . () NEWLINETOKEN at ? . ? ( ? ) NEWLINETOKEN at Aspose.Words.Document.(Stream , String , SaveOptions ) NEWLINETOKEN at Aspose.Words.Document.Save(HttpResponse response, String fileName, ContentDisposition contentDisposition, SaveOptions saveOptions) NEWLINETOKEN

Can someone look into this and let us know the root cause?

Hi there,

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

  • Your input Word document.
  • 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 them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.


Actually we are creating a new document and filling it with data from our DB and data is huge.When trying to export it using Document.Save it’s giving System.OutOfMemoryException almost all of the time in fact I am able to export it in pdf format only one time and not a single time for word format.
So to analyze it I am attaching the pdf file that I am able export only once.

For conversion you can check out same app I am attaching.

Hi there,

Thanks for sharing the detail. Your query is related to Aspose.Words and Aspose.Pdf. So, I am moving this forum thread to Aspose.Total forum. The shared application is related to Aspose.Pdf. My colleagues from Aspose.Pdf team will investigate this issue and inform you about their findings.

Regarding the issue related to Aspose.Words, we suggest you please upgrade to the latest version of Aspose.Words for .NET 17.1.0. Hope this helps you. If you still face problem, please share the requested detail in my previous post for testing. We will investigate the issue on our side and provide you more information.


Thanks for contacting support.

I have tried replicating above mentioned problem but I am afraid the attached Pdf.pdf appears to be corrupted as the output in directory is 0KB. Can you please again try attaching the document, so that we can test the scenario in our environment. We are sorry for this inconvenience.

I am attaching the PDF file again.



Thanks for your patience. I tried to convert your shared file (Pdf.pdf) into DOC and was unable to convert. Therefore for further investigation I have logged this issue as PDFNET-42232 in our issue tracking system. We will keep you updated on the status of resolution process. Please spare us a little time.

We are sorry for the inconvenience.

Best Regards,

If you can provide an ETA on this that would be great.


Thanks for your patience.

As we recently have noticed earlier reported issue, so its pending for review and is not yet resolved. However the product team will surely consider investigating/fixing it as per development schedule and as soon as we have some definite updates regarding its resolution, we will let you know. Please be patient and spare us little time. We are sorry for this delay and inconvenience.