Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

Generating images from eml

$
0
0
Hello!

I'm using Aspose Words for creating images from eml files. But the country specific characters in the "From" or "To" field of the email are not displayed correctly in the output image. Here is my code:

1. Creating a document object from the eml file:
        var options = new MailMessageLoadOptions { MessageFormat = MessageFormat.Eml };
        var message = MailMessage.Load(inputStream, options);
        message.PreferredTextEncoding = Encoding.Unicode;
        message.SubjectEncoding = Encoding.Unicode;
        message.BodyEncoding = Encoding.Unicode;
        message.TimeZoneOffset = TimeZoneInfo.Local.BaseUtcOffset;
       
        using (var mhtStream = new MemoryStream())
        {
          message.Save(mhtStream, MailMessageSaveType.MHtmlFormat, MailMessageSaveOptions.WriteHeaderToMht);
          doc = new Aspose.Words.Document(mhtStream, new Aspose.Words.LoadOptions(Aspose.Words.LoadFormat.Mhtml, "", ""));         
        }

2. Creating images from the document object:
      var imageSaveOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg);
      imageSaveOptions.JpegQuality = 150;
      imageSaveOptions.Resolution = configElLarge.Dpi;
      imageSaveOptions.PageCount = 1;

      for (int counter = startPage; counter < endPage.Value; counter++)
      {
        imageSaveOptions.PageIndex = counter;
        var imageStream = new MemoryStream();
        doc.Save(imageStream, imageSaveOptions);
      }

Please check and let me know if I'm doing someting wrong. You can find attached an example of the eml file and an image of the problem.

Best regards,
Dejan

Viewing all articles
Browse latest Browse all 1367

Latest Images

Trending Articles



Latest Images