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

Free Support Forum - aspose.com

Converting msg files to PDF

Hello,
I need to convert msg files to pdf, and are using aspose.network, aspose.pdf and aspose.word for this task.

It is very important to keep the text formating (bold, italic etc) from the msg file.
edit: I’ve this possible, but letter coloring is not kept. (this is done for rtf documents in aspose.word)


can this be done ?

Regards
Martin

Hi Martin,

Thanks for considering Aspose.

We are looking into this issue to keep the text coloring in rtf and will get back to you shortly.

Msg files can be converted to pdf using Aspose.Network and Aspose.Words. The latest version of Aspose.Words can load an rtf file and save as pdf document.

// first msg to rtf

MapiMessage msg = MapiMessage.FromFile(@"E:\Data\Aspose\temp\test.msg");

// write the BodyRtf to an rtf file in disk

TextWriter tw = new StreamWriter(@"E:\Data\Aspose\temp\test.rtf");

tw.Write(msg.BodyRtf);

tw.Close();

// load the Rtf file in Document class and save it as pdf

Document doc = new Document(@"e:\data\aspose\temp\test.rtf", LoadFormat.Rtf, "");

doc.SaveToPdf(@"e:\data\aspose\temp\test.pdf");