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

Free Support Forum - aspose.com

Getting Error "Out of Memory Exception"


I am using ASPOSE.Word( , and also Used latest version as ASPOSE.Word(, For creating Images of pages from the Word document. I am using SaveToImage method of Aspose.Words.Document.

I save the document file in a SQL Database into Memeory Stream format.When i am going to upload document file of 3-4MB(Or more than this) its gives me error as “System.OutOfMemoryException”.

The word document contains images,indexing etc.

(I cannot upload file here)

Please tell me the solution for this ASAP.



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please send me the document to my e-mail, as described here:


Best regards.

Hello Alexy ,

I sent you mail,
contains DOC file as well as My function

Please go through it and let me know ASAP.


Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I cannot reproduce “OutOfMemory” exception. However, “Index out of range” exception occurs when I use your code, because there is a small mistake. This code works fine on my side:

Public Sub ConvertToImages(ByVal docs As MemoryStream)

Dim srcDoc As New Aspose.Words.Document(docs)

' PageCount-1 because zero based index is used

For i As Integer = 0 To srcDoc.PageCount - 1

Dim stream As MemoryStream = New MemoryStream()

srcDoc.SaveToImage(i, 1, stream, Imaging.ImageFormat.Bmp, Nothing)

'i saved images to file

Dim imgFile As FileStream = New FileStream(String.Format("C:\Temp\pages\p_{0}.bmp", i), FileMode.Create)




End Sub

Best regards.