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