I am using ASPOSE.Word(6.0.0.1) , and also Used latest version as ASPOSE.Word(6.1.0.0), 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”.
Hi
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)
stream.WriteTo(imgFile)
imgFile.Close()
Next
End Sub
Best regards.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.