DEV Community

Atir Tahir
Atir Tahir

Posted on

1

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay