Outlook .msg to PDF content gets cropped

Hi Aspose Team,

We have a Outlook .msg where the content gets cropped while converting it to PDF.
Using Aspose v22.12.

sample file for testing (Just rename to .msg):
ContentCropped.zip (96 KB)

Code:

Aspose.Email.MailMessage emailDoc = Aspose.Email.MailMessage.Load(filename);

emailDoc.TimeZoneOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
MemoryStream htmlStream = new MemoryStream();
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions()
{
    CheckBodyContentEncoding = true,
    PreserveOriginalBoundaries = true,
    MhtFormatOptions =
        MhtFormatOptions.WriteHeader |
        MhtFormatOptions.WriteCompleteFromEmailAddress |
        MhtFormatOptions.WriteCompleteToEmailAddress |
        MhtFormatOptions.WriteCompleteCcEmailAddress |
        MhtFormatOptions.WriteCompleteBccEmailAddress |
        MhtFormatOptions.HideExtraPrintHeader |
        MhtFormatOptions.RenderVCardInfo
};

emailDoc.Save(htmlStream, mhtSaveOptions);

Aspose.Words.Loading.LoadOptions loadOptions = new Aspose.Words.Loading.LoadOptions()
{
    LoadFormat = Aspose.Words.LoadFormat.Mhtml,
};

var wordDoc = new Aspose.Words.Document(htmlStream, loadOptions);

foreach (Aspose.Words.Tables.Table table in wordDoc.GetChildNodes(NodeType.Table, true))
    table.AutoFit(AutoFitBehavior.AutoFitToWindow);

var saveOptions = new Aspose.Words.Saving.PdfSaveOptions()
{
};

if (addMessageDelegate != null && !aborted)
    addMessageDelegate(DocProcessStatus.Message.MessageType.Info, "Exporting email document to PDF...");

foreach (Aspose.Words.Drawing.Shape shape in wordDoc.GetChildNodes(NodeType.Shape, true))
{
    ResizebigImage(shape);
}

wordDoc.Save(dstFilename, saveOptions);

Thank you for looking into this matter

@andersalvsaker
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25074

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi, was wondering if i could get a status update on this issue. Been a while.

Thank you in advance!

@andersalvsaker We have completed analysis of the issue. The problem occurs because table column widths are not calculated correctly for a set of nested auto-fit tables in html document.
It is related to table grid calculation algorithm we are working on. The issue has been linked to the root WORDSNET-832 and has been postponed until the root issue is resolved.
Unfortunately, there are no estimates at the moment, since table grid calculation is extremally complex task and MS Word behavior is not documented and not always obvious.

Thank you very much for your explanation hereπŸ‘πŸ»

1 Like

The issues you have found earlier (filed as WORDSNET-25074) have been fixed in this Aspose.Words for .NET 23.8 update also available on NuGet.

1 Like