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

Free Support Forum - aspose.com

Priting MSG to XPS fails

Hi,


I am unable to print the attached MSG file to XPS using the MailPrinter class.
Using Aspose Email 3.0.0 (latest version).

Unbehandelte Ausnahme: System.InvalidOperationException: Given document can’t be processed
bei ☼?↨.???.Execute(Object )
bei ☼?↨.◄?↨.▼?↨(Stream , Stream , ♫?↨ )
bei ☼?↨.◄?↨.▼?↨(String , Stream , ♫?↨ )
bei ☼?↨.◄?↨.Print(MailMessage , Stream )
bei Aspose.Email.Printing.MailPrinter.Print(MailMessage message, String outputFile, PrintFormat printingFormat)


The following code is used:
MailMessage msg = MailMessage.Load(“Neuer Prozess ( Dokument prüfen ) zur Bearbeitung anstehend…msg”);
Aspose.Email.Printing.MailPrinter printer = new Aspose.Email.Printing.MailPrinter();
printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo;
printer.Print(msg, “output.xps”, Aspose.Email.Printing.PrintFormat.XPS);


If I remove the FormattingFlags MailInfo setting, the error is gone, but the output XPS is empty.


Best Regards
Andreas
Hi Andreas,

Thank you for considering Aspose.Email as part of your solutions.

I was able to reproduce this issue at my end using the latest version of Aspose.Email for .NET 3.0.0 and have logged it in our bug tracking system under issue id: NETWORKNET-33881. Development team will look into it and once we have any information regarding the resolution of this issue, we'll update you here via this thread.

If you have any other query/inquiry regarding Aspose.Email, please feel free to post to us. We'll try to assist you further as soon as possible.

Hi,


any news on this? When can I expect a fixed version?

Thank you.

Best Regards
Andreas

Hi Andreas,


We have investigated this issue in detail and found that this is not a bug at Aspose.Email end. The HtmlBody property of the MSG is included between comments which gives raise to this exception. In order to avoid this exception, please use the following work around method:

Code Sample:


string fileName = Path.Combine(TestUtil.GetTestPath(), “Neuer+Prozess+(+Dokument+prüfen+)+zur+Bearbeitung+anstehend…msg”);

string outFileName = Path.Combine(TestUtil.GetTestOutPath(), “Neuer+Prozess.xps”);

using (FileStream fs = new FileStream(outFileName,FileMode.Create))

{

MailMessage mm = MailMessage.Load(fileName);

Printing.MailPrinter printer = new Printing.MailPrinter();

printer.FormattingFlags = Printing.MessageFormattingFlags.MailInfo;

//workaround to avoid exception

mm.HtmlBody = mm.HtmlBody.Replace("", String.Empty);

printer.Print(mm, fs, Printing.PrintFormat.XPS);

}

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan