From value is displayed in first page of tiff file for EML files when Lotus Notes not installed

Hi,

I am using Aspose.Email.dll V -1.2.0.0 (for .net framework 3.5) and able to convert the eml file into tiff. But when I open that file I could able to see the additional text(From text) at the top left in the first page of tiff file. Also I am able see the "from" content in the from section(that is fine).

I am using Mailmessage to load the eml file and converting into stream with fileformat as"mhtml" . and using Aspose.words.Document to save as tiff.

Please let me know how to avoid of priting unwanted From text @ left top corner.

Note:Unable to see the unwanted text when Lotus Notes is installed.

Thanks,

Ponraj.M

Hi Ponraj,


Thank you for your inquiry.

With the release of Aspose.Email for .NET v1.3.0, we have introduced a new namespace Aspose.Email.Printing that will enable you to output your email messages to XPS and TIFF file formats without needing Aspose.Words component.

Please check the below source code for your reference,
C#

//load your message
var message = Aspose.Email.Mail.MailMessage.Load(“sample.msg”);
var printer = new Aspose.Email.Printing.MailPrinter();
//Set properties for your printing area
printer.PageUnit = Aspose.Email.Printing.PrinterUnit.Pixel; //Pixel,Inch,Cm,Millimeter,Point;
printer.PageHeight = //any value;
printer.PageWidth = //any value;
//Print the message to Tiff format
printer.Print(message, “output.tiff”, Aspose.Email.Printing.PrintFormat.Tiff);


Hopefully this will help. If your problem persists then please share your sample input message for your review.

Thanks for your reply.

The above code is targed for priting the file in xps or tiff. I don't want to print , just I want to convert into a tiff file.

Hi,


Please try the code. It will not send the command to the printer rather I will save the output in Tiff file format.

By Using the sample code,I could able to get only the body of the eml file and not the From address,to address,subject etc.

But I want to get those details also.

Thanks,

Ponraj.M

Hi Ponraj,


I am afraid that the current implementation of Aspose.Email.Printing.MailPrinter class allows you to print/save only the body of email message. I have logged a ticket in our tracking system to enhance this feature to include the From, To, CC and Subject fields in the printed output. The ticket Id for your reference is 33109. You will be notified once this feature is available.

If you require to save the complete message to Tiff format then you have to use the Aspose.Words component. Please share a problematic message file so we can determine the cause of problem.

Thank you for your patience.

Please find the attached sample file. I have changed the extension to .txt. Please change to .eml while testing.

Note: I am getting this error for some of the files.

Thanks,

Ponraj.M

Any updates for me on this?

Hi Ponraj.


Thank you for your sample file.

I am able to reproduce the said issue with latest version of Aspose.Email for .NET v1.3.0. So I have logged it in our tracking system for the sake of further investigation. The Ticket Id for your reference is 33114. As soon as we receive any updates regarding this issue, we will post here for you.

Please note that I was unable to replicate the problem with other EML files (other than your sample). Can you please share the origin of your sample message?

Thanks and Regards

Sorry, I am not sure.

Please let me know once this issue is fixed.

Thanks,

Ponraj.M

Hi Ponraj,


Thank you for your reply.

You will be notified automatically once this issue is resolved.

The issues you have found earlier (filed as NETWORKNET-33109;NETWORKNET-33114) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi Ponraj,


Please check the below source code for your reference to include the email headers in your resultant Tiff/XPS.

C#

var message = Aspose.Email.Mail.MailMessage.Load(“message.msg”);
var printer = new Aspose.Email.Printing.MailPrinter();
printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo;
printer.Print(message, “test.xps”, Aspose.Email.Printing.PrintFormat.XPS);
printer.Print(message, “test.tiff”, Aspose.Email.Printing.PrintFormat.Tiff);

Hi,

Please find the sample code below: I am using the above sample code provided by you.Instead of saving as tiff file, just I am trying to load the message in outstream and tried to access the stream in document.

using (MemoryStream msgStream = new MemoryStream())

{

var printer = new Aspose.Email.Printing.MailPrinter();

printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo;

printer.Print(message, msgStream, Aspose.Email.Printing.PrintFormat.Tiff);

document = new Document(msgStream, options);

}

I am getting an issue "cannot access closed stream". Please advise.

Hi Ponraj,


I am afraid, I am unable to replicate your said exception. When printed to Tiff format, the stream object contains valid image data that can also be used to save the image on disk without any exception.

Also, there is no LoadFormat available in Aspose.Words for .NET component that could enable you to load the Tiff image into an instance of Document. Moreover, we have provided the MailPrinter class in Aspose.Email for .NET component so that you do not have to use Aspose.Words for printing purposes.

Please elaborate your scenario so we may assist you in this regard.

My requirement is simple. I am following the standard of converting mailmessage intostream and load in Aspose.word document with load option. So I caanot change the standard. While loading the stream in document class I got the error "Cannot open closed stream". Also I am sure we have LoadOption class in Aspose.word.

Did you able to replicate this issue? Please let me know if you need any further details.

Hi Ponraj,


If you still want to use Aspose.Words component to convert your messages to Tiff format then the printing functionality provided via Aspose.Email.Printing.MailPrinter class is of no use to you. You simply can not use both approaches in collaboration to produce one output.

I am unable to replicate your said exception but I was hit with an UnsupportedFileFormatException at last line of my below provide sample source,

C#
var message = Aspose.Email.Mail.MailMessage.Load(“sample.msg”);
using (MemoryStream msgStream = new MemoryStream())
{
var printer = new Aspose.Email.Printing.MailPrinter();
printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo;
printer.Print(message, msgStream, Aspose.Email.Printing.PrintFormat.Tiff);
var options = new Aspose.Words.LoadOptions();
options.LoadFormat = LoadFormat.Auto;
var document = new Document(msgStream, options);
}


This exception is obvious because no value from LoadFormat enumeration relates to the image data present in the MemoryStream object. Thus, I believe that you can not load an image into an instance of Aspose.Words.Document. You may confirm this from the experts of Aspose.Words component.