Free Support Forum - aspose.com

How to save MSG as XPS file

Hi,


I want to convert mail messages in a PST to XPS. Is there any option in Aspose.Email to convert MSG file to XPS?

Hi,


Aspose.Email does support conversion of Emai messages to XPS. You can find more about the printing options offered by Aspose.Email by going through our online article. Please refer to the following code that converts a MSG file to XPS. Here are the minimum lines of code to achieve this for you.


// load the MSG file using Aspose.Email for .NET
MailMessage msg = MailMessage.Load(“RE Lotus Notes Files.msg”, MessageFormat.Msg);

//Instantiate an instance of MailPrinter
var printer = new Aspose.Email.Printing.MailPrinter();

//Set the MessageFormattingFlags to none to display only the message body
printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.None;

//Print the email to an XPS file
printer.Print(message, “test.xps”, Aspose.Email.Printing.PrintFormat.XPS);