Free Support Forum - aspose.com

Problem converting .EML to .PDF


#1

Hello Aspose Team,


I have a problem converting .eml to .pdf. In the majority of the time it works fine, but sometimes a random e-mail gets converted like that in attachment.

Here’s the code I am using. Is there something wrong with it? Or with the .eml?


ByteArrayOutputStream dstStream = new ByteArrayOutputStream();
MailMessage mail = MailMessage.load(filePath);
mail.save(dstStream, MailMessageSaveType.getMHtmlFormat());

ByteArrayInputStream srcStream = new ByteArrayInputStream(dstStream.toByteArray());
Document doc2 = new Document(srcStream);
doc2.save(pdfFilePath, com.aspose.words.SaveFormat.PDF);


Please, any help would be greatly appreciated.

Thanks.

#2

Hi Mario,


Thank you for contacting Aspose support team.

I have tested the above sample code using Aspose.Email for Java 4.7.0 and Aspose.Words for Java 14.10, but am afraid to share that I could not re-produce the scenario. The output PDF file is generated properly as can be seen in the attached output PDF file. Could you please give it a try using above mentioned library versions and let us know the feedback?

#3

Thank you!


I was using an older version of Aspose Email, it works fine now. :slight_smile:

[]'s

#4

Hi Mario,

Thank you for providing the feedback and please feel free to write to us in case you have any other query/inquiry related to Aspose.Email.