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

Free Support Forum - aspose.com

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.