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

Free Support Forum - aspose.com

Convert e-mail to MHT to Tif

Not sure if this is a Aspose.Network or Aspose.Words problem.

When we convert an e-mail message to TIF we sometimes get a lot of 'extra' XML in the first page of the TIF.

Our steps for this coversion are:

1) Acquire the e-mail message (in the included sample we just read it from a .msg file)

2) Save the message in MHTML format

3) Read the MHTML back as an Aspose.Words Document object

4) Loop over the pages and save each as a TIF image.

Attached is sample code, and 2 message files. The files are virtually identical, but when the first one renders we get the XML at the top of the first page, we don't see the xml with the second one.

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words (9.4.0) and Aspose.Network (5.6.0). Please try using the following code and let me know how it goes on your side:

MapiMessage msg = MapiMessage.FromFile("CallRef27240058_1.msg"); // or CallRef29911022_1.msg

using (MemoryStream rtfStream = new MemoryStream())

{

TextWriter tw = new StreamWriter(rtfStream);

tw.Write(msg.BodyRtf);

tw.Flush();

Document doc = new Document(rtfStream);

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);

options.Resolution = 300;

options.TiffCompression = TiffCompression.Ccitt3;

options.PageCount = 1;

for (int pageIndex = 0; pageIndex < doc.PageCount; pageIndex++)

{

string outputFileName = string.Format("{0}\\{1}_{2}.tif", "Temp", "Test", pageIndex + 1);

options.PageIndex = pageIndex;

doc.Save(outputFileName, options);

}

}

Best regards,