DEV Community

loading...

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

atir_tahir profile image Atir Tahir ・1 min read

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());

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

Discussion (0)

pic
Editor guide