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

Free Support Forum - aspose.com

Error using Aspose.Words.Viewer.DocumentRenderer on Japanese document

When attempting to preview a Word document as an image using Aspose, we get an error when the document contains Japanese text.

The error is "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll"

It appears to cause IIS to crash with DoctorWatson errors...

File that can cause this issue is attached.

Code example below:

Dim bmp As Bitmap

AsposeCommon.LoadLicence(True)
Using blobStream As New System.IO.MemoryStream(BLOBData)
Dim wordDoc As New Aspose.Words.Document(blobStream)
Dim view As New Aspose.Words.Viewer.DocumentRenderer(wordDoc)
Using memStream As New MemoryStream
bmp = view.GetPage(1) 'first page

If Deliver Then
bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png)
Response.Clear()
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "image/png"
memStream.WriteTo(Response.OutputStream)
Response.End()
End If
End Using
End Using

Return bmp

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

Thanks for your request. I can’t reproduce this issue on my side. I use the latest version of Aspose.Words for testing. Also please note that Aspose.Words.Viewer namespace is currently in beta and limited technical support is provided for it.

Best regards.

Apparently, when I stripped customer specific content from the file, the problem no longer occurred. So, it isn't just japanese content... it is something specific somewhere in the document. I'll try to reproduce. In the mean time, I wanted to mention that we've had a variety of issues using the preview functionality in Aspose.Words, including issues that seem to be caused by long documents, some of which take down the whole server. Have there been any fixes to the preview functionality? Is there anything wrong with the following code?

Dim bmp As Bitmap

AsposeCommon.LoadLicence(True)

Using blobStream As New System.IO.MemoryStream(BLOBData)

Dim wordDoc As New Aspose.Words.Document(blobStream)

Dim view As New Aspose.Words.Viewer.DocumentRenderer(wordDoc)

Using memStream As New MemoryStream

bmp = view.GetPage(1) 'first page

If Deliver Then

bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png)

Response.Clear()

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Response.ContentType = "image/png"

memStream.WriteTo(Response.OutputStream)

Response.End()

End If

End Using

End Using

Return bmp

Do you have an address where I should email the file? I apparently cannot post it to the web site privately. Thanks.

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

Thanks for your inquiry. Your code is correct. But as I told you earlier Aspose.Words.Viewer namespace is currently in beta and limited technical support is provided for it. So there can be problems with Aspose.Words preview feature.

You can send file to my e-mail: alexey.noskov@aspose.com

Best regards.

The file has been sent via email. I understand that it is in beta, but that's a time for finding and fixing bugs. =)

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

Thank you for additional information. It seems to be a known issue #4197. Unfortunately it is unresolved yet. I will notify you as soon as it is fixed.

Best regards.

All we need to do is get a thumbnail preview of the first page of the document. Are there any other alternatives or workarounds you can suggest?

When does Aspose plan to improve this feature? This issue, and others I've seen posted, have been open for quite a long time. We are at a point where the severity of some of the issues may require that we discontinue use of this Aspose feature in the next service release of our product unless we hear that it will be getting some attention.

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

Thanks for your inquiry. As a workaround you can try converting your document to PDF using Aspose.Words and Aspose.Pdf. And then generate preview images using Aspose.Pdf.Kit.

Best regards.

Hi

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

We are happy to tell you that the new Rendering Engine has replaced the “old Viewer Beta”. The Rendering Engine can print, save as images or draw onto .NET Graphics object any document page.

Please see Aspose.Words documentation to learn more about new features.

SaveToImage method renders document pages into images:

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.document.savetoimage_overloads.html

Also new Rendering engine allows you to convert Word document to PDF directly (without using Aspose.Pdf).

SaveToPdf method converts the whole document or selected pages to PDF.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.document.savetopdf_overloads.html

You can download the latest version of Aspose.Words from here:

http://www.aspose.com/community/files/51/file-format-components/aspose.words/entry158153.aspx

Best regards.