Hello,
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”.
The word document contains images,indexing etc.
(I cannot upload file here)
Please tell me the solution for this ASAP.
Thanks
Kishan
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:
http://www.aspose.com/corporate/purchase/faqs/send-license-to-aspose-staff.aspx
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.
Thanks
Kishan
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)
stream.WriteTo(imgFile)
imgFile.Close()
Next
End Sub
Best regards.