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

Free Support Forum - aspose.com

E-mail massage is saved as an empty pdf

Hello,



We are using next code for conversion of .msg files to PDF:

var message = Aspose.Email.Mail.MailMessage.Load(inputFilePath);

using (var msgStream = new MemoryStream())

{

message.Save(msgStream, new Aspose.Email.Mail.HtmlSaveOptions());

msgStream.Position = 0;

var options = new Aspose.Words.LoadOptions

{

LoadFormat = Aspose.Words.LoadFormat.Mhtml,

Encoding = Encoding.UTF8

};

var document = new Aspose.Words.Document(msgStream, options);

document.Save(outputFilePath, new Aspose.Words.Saving.PdfSaveOptions());

}



Conversion of attached .msg file (please unzip it first) ends up with creation of empty PDF file while message is correctly loaded to message variable.



We are using Aspose.Email.dll of version 16.11.0.0 and Aspose.Words.dll of version 16.12.0.0



Thanks in advance.

Valeriy

Hi Liza,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for .NET 17.2.0 and Aspose.Email for .NET 17.2.0. We have not found the shared issue. Please upgrade to the latest versions of Aspose.Email and Aspose.Words. We have attached the output Pdf with this post for your kind reference.

Hi Tahir,



I have tested conversion of message with 17.2.0 version of Aspose.Email and Aspose.Words and still have the same issue. Please see my screenshot in attachment.

As you can see at the breakpoint position the message is loaded to the msgStream (it’s length is 1759 bytes), but document text contains “\r\f” only, while it must contain 1759 bytes of the text.

Have you used the same as ours code for testing? Possibly we have missed some options for Aspose.Words.LoadOptions?



Hope for your help.

Valeriy

Hi Valeriy,

Thanks for sharing the detail. The MHTML file generated by Aspose.Email does not open in browser. Your query is more related to Aspose.Email API. So, I am moving this forum thread to Aspose.Total forum. My colleagues will answer your query shortly.