Stack overflow in document renderer

The attached document makes the Aspose.Words.Viewer renderer go in stack overflow (in mscorlib). I use Aspose.Words 5.1 for .net 2.0 in 32 bits.
Exception trace:

mscorlib.dll!System.Security.CodeAccessSecurityEngine.Assert(System.Security.CodeAccessPermission cap = {System.Security.Permissions.SecurityPermission}, ref System.Threading.StackCrawlMark stackMark) + 0x3d bytes 
mscorlib.dll!System.Security.CodeAccessPermission.Assert() + 0x15 bytes 
System.Drawing.dll!System.Drawing.Font.SetFontFamily(System.Drawing.FontFamily family) + 0x43 bytes 
System.Drawing.dll!System.Drawing.Font.Font(string familyName, float emSize = 10.0, System.Drawing.FontStyle style = Regular) + 0x57 bytes 
Aspose.Words.dll!ӓ.ఉ.⸆() + 0xc7 bytes 
Aspose.Words.dll!ӓ.ఉ.ఉ(ӓ.Ӿ pgfx = {ӓ.Ӿ}, Aspose.Words.Font asposeFont = {Aspose.Words.Font}, string text = "1) Fire Fighting ring made by ") + 0x3b bytes 

My code:

Dim AspLic As New Aspose.Words.License
AspLic.SetLicense(Costanti.ASPOSE_LICENCE_PATH)
Dim MemStream As New IO.MemoryStream(DocToRender, False) ' DocToRender is a buffer with attached file contents
Me.Renderer = New Aspose.Words.Viewer.DocumentRenderer(MemStream)
Me.Renderer.PageBounds = Aspose.Words.Viewer.PageBounds.Border
Me.Renderer.Document.Sections(0).PageSetup.RightMargin = 8
Me.Renderer.Document.Sections(0).PageSetup.LeftMargin = 8
Me.Renderer.Document.Sections(0).PageSetup.TopMargin = 8
Me.PageNav = New Aspose.Words.Viewer.PageNavigator(Me.mRenderer)
Me.PageNav.GoToPage(1)

Please let me know if there is any workaround/fix for this issue.
Thanks,
Pascal.

Hi
Thanks for your request. It seems that problem occurs because your document is not well formatted. Just switch to page layout to see problems. I did the following and now document works fine on my side.

  1. In page setup change Right Margin to 90pt.
  2. Change Right indent of the third paragraph to 0pt.

You can do this programmatically using the following code.

Document doc = new Document(@"Test122\rendering.DOC");
doc.FirstSection.PageSetup.RightMargin = 90;
foreach (Paragraph par in doc.FirstSection.Body.Paragraphs)
{
    par.ParagraphFormat.RightIndent = 0;
}

I hope this could help.
Best regards.

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.

Saving to image

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

Saving to Pdf

The latest version of Aspose.Words is available for download from downloads section or from NuGet