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

Free Support Forum - aspose.com

Outlook Email to PDF

I’ve been reading through your examples / forums and haven’t been able to find what I’m looking for. Is it possible, using Aspose, to convert a .msg or .eml file to PDF? If so, can you point me to an example or the products needed to accomplish this. Thank you for your time and assistance.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Cheers,


This message was posted using Email2Forum by Sheliah.

Hi,

Thank you for inquiry.

Please refer to http://www.aspose.com/documentation/.net-components/aspose.email-for-.net/convert-outlook-message-file-msg-to-tiff-image.html page for converting MSG files to TIF. You can easily update the sample code to:
load the EML, MSG or MHT files

MailMessage msg = MailMessage.Load(“test-message.msg”, MessageFormat.Msg); // or eml, mht


save to TIF, PDF, XPS etc

msgDocument.Save(“Outlook-Aspose.tif”, SaveFormat.Tiff); // or pdf, xps, doc, docx etc


Hi

I changed the code as below since my message file extension is "eml" -

MailMessage msg = MailMessage.Load("test-message.eml", MessageFormat.Eml);
MemoryStream msgStream = new MemoryStream();
msg.Save(msgStream, MailMessageSaveType.MHtmlFormat);
msgStream.Position = 0;
Document msgDocument = new Document(msgStream);
msgDocument.Save(@"D:\TEMP\Outlook-Aspose.tif", SaveFormat.Tiff);

Although I should get multi page image file, code generate tif for 1st page only. How could I change on code to generate multi tiff image from eml?

Thanks.

Hi Yimon,


Thank you for sharing your concern with Aspose support team.

Could you please provide us with your sample EML file that you are trying at your end? We’ll look into it for assisting you further as soon as possible.

Hi Kashif,


Thanks for your reply.
Now, I changed my code to load MHTML code into Aspose.Words.Document since we can extract email into MHTML.

Here is my sample code and I have questions how to set tif -dpi, compression in Aspose.Words.Document.Save.
Document msgDoc= new Document(strMHTML);
msgDoc.Save(“test.tif”, SaveFormat.Tif);

And, check with you whether my approch will use your Aspose.Word is okay or you have any suggestions?
My requirement is to convert email into tif.



Regards,
Yi Mon


Hi Yi,


Thanks for your inquiry. You can use ImageSaveOptions.Resolution Property to set the resolution for the generated images, in dots per inch as follows:
Document doc = new Document(MyDir + “Rendering.doc”);

ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Tiff);
options.Resolution = 300;
options.PageCount = 1;

doc.Save(MyDir + “Rendering.SaveToImageResolution Out.tiff”, options);

I hope, this helps.

Best regards,