We are using the Aspose c# library.
When we try to convert MSG files to PDF, for some MSG files, Sent Date appears twice in the PDF files.
Below is the code that we use:
// Load the MSG file
MapiMessage msg = MapiMessage.Load(inputFilePath);
// Convert MapiMessage to MailMessage for rendering
MailMessage mailMessage = msg.ToMailMessage(new MailConversionOptions());
// Convert MailMessage to MHTML
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();
mhtSaveOptions.MhtFormatOptions = MhtFormatOptions.WriteHeader | MhtFormatOptions.RenderCalendarEvent;
// Save the MailMessage as an MHTML file in a memory stream
using (MemoryStream mhtmlStream = new MemoryStream())
{
mailMessage.Save(mhtmlStream, mhtSaveOptions);
mhtmlStream.Position = 0;
// Load the MHTML stream into Aspose.Words Document
Document document = new Document(mhtmlStream);
// Save the Document as a PDF file
document.Save(outputFilePath, SaveFormat.Pdf);
result = true;
}
I am attaching the sample msg files and the screenshot of the pdf with double Sent Date entries
Samples.zip (18.4 KB)