Convertt EML to PDF

According to the documentation provided at:

it should be relatively easy to load an EML file and then save it as a PDF.

However, when I try to implement the code, I do not get ‘DefaultPdf’ as a valid save option.

Here is my code:

        // Activate the Aspose temporary license
        Aspose.Email.License licenseEmail = new Aspose.Email.License();
        licenseEmail.SetLicense("Aspose.Total.NET.lic");

        // Load EML/MHTML/MSG file as MailMessage
        Aspose.Email.MailMessage message = Aspose.Email.MailMessage.Load(filePathSource);

        // Save Message as a PDF
        message.Save(filepathTarget, Aspose.Email.SaveOptions.DefaultPdf);

@jburnett

You need to use Aspose.Words and Aspose.Email to achieve your requirement. Please read the following article to convert Email to PDF.
Saving an Email as PDF

Hi Tahir,

Thank you for your response. I tried using the combination of Aspose.Email and Aspose.Words to convert the EML to MHTML and then PDF. However, although it creates a PDF, this approach appears unable to handle embedded images. Fortunately, I had more success using Aspose.Email to create the MHTML and then using Aspose.PDF to create the PDF. Even so, it still struggles with embedded images. I will submit a separate ticket under the the Aspose.PDF topics, as it only relates to the MHTML to PDF conversion (the MHTML itself looks correct).

@jburnett

Please share the input EML and problematic output PDF here for testing. We will investigate the issue and provide you more information on it.

Hi Tahir,
You have responded to the ticket under the Aspose.PDF topic. It looks as though you have solved the issue.
Thank you for your assistance!

@jburnett

Thanks for your feedback. Please feel free to ask if you have any question about Aspose APIs, we will be happy to help you.