MHtml file is not rendered correctly

Hi,

The attached Mhtml file is not rendered correctly by Aspose.Words 17.1. Only the first page can be displayed. MS Word displays 6 pages.

Additional info that might be helpful. The file is produced by the attached MSG file using Aspose.Email 17.1.

Best Regards,

Vassil

Hi Vassil,

Thanks for your inquiry. Please call Document.UpdatePageLayout method before saving the document to Pdf to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "170397\_OnlyFirstPageDisplayed.msg.MHtml");
doc.UpdatePageLayout();
doc.Save(MyDir + "Out v17.1.0.pdf");

Hi Tahir,

Okay, this works. But, I want to render pages using RenderToScale method.

This code works fine: both produced images are OK.

var doc = new Document(myDir + "170397\_OnlyFirstPageDisplayed.msg.MHtml");
doc.UpdatePageLayout();
doc.Save(myDir + "Out v17.1.0.png"); // does some magic
// Render first page
var bmp = new Bitmap(816, 1056);
using (var g = Graphics.FromImage(bmp))
{
    g.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);
    doc.RenderToScale(0, g, 0, 0, 1);
    bmp.Save(myDir + "Out v17.1.0.Render.p1.png");
}

The problem is that this doc.Save() method does some magic. And the code bellow DOES NOT work correctly:

See the attached result images.Please help. What else should I call?

var doc = new Document(myDir + "170397\_OnlyFirstPageDisplayed.msg.MHtml");
doc.UpdatePageLayout();
//doc.Save(myDir + "Out v17.1.0.png"); - skip the save magic
// Render first page
var bmp = new Bitmap(816, 1056);
using (var g = Graphics.FromImage(bmp))
{
    g.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height);
    doc.RenderToScale(0, g, 0, 0, 1);
    bmp.Save(myDir + "Out v17.1.0.Render.p1.png");
}

Best Regards,

Vassil

Hi Vassil,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14764. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-14764) have been fixed in this Aspose.Words for .NET 19.12 update and this Aspose.Words for Java 19.12 update.