DEV Community

Atir Tahir
Atir Tahir

Posted on

How to convert an email file (.msg) to PDF using Java

I discussed how to convert a msg/eml file to PDF using C# in this post. Let's see how to achieve this using Java.

ConversionHandler conversionHandler = new ConversionHandler(Utilities.getConfiguration());
PdfSaveOptions saveOption = new PdfSaveOptions(); 
String guid = fileName;
ConvertedDocument convertedDocumentPath = conversionHandler.<String> convert(guid, saveOption);
convertedDocumentPath.save(fileName + "." + convertedDocumentPath.getFileType());
Enter fullscreen mode Exit fullscreen mode

I used GroupDocs.Conversion for Java API for the conversion process. Have a look at this thread.

Top comments (0)