Issue while creating Words.Document with MHTML LoadOptions

Hi Team,

We are facing issues while trying to convert a .msg to .pdf
The error is thrown at words.Document instantiation.
We are using aspose-words:21.10:jdk17 and aspose-email:22.5:jdk16

Here is the running code -

public static byte[] convertEmailToPdf(ByteArrayInputStream emailInputStream) throws Exception {
        ByteArrayOutputStream result = new ByteArrayOutputStream();
        try {
            MailMessage mailMsg = MailMessage.load(emailInputStream);
            // converting mailMsg to HTML (aspose doesn't support direct eml -> pdf conversion)
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            mailMsg.save(baos, SaveOptions.getDefaultMhtml());

            // loading HTML into Aspose.Words Document
            LoadOptions lo = new LoadOptions();
            lo.setLoadFormat(LoadFormat.MHTML);
            Document document = new Document(new ByteArrayInputStream(baos.toByteArray()), lo);

            // finally saving Document as PDF.
            document.save(result, SaveFormat.PDF);
            return result.toByteArray();

        } catch (Exception ex) {
            LOGGER.error("Exception occurred while converting Email to pdf :" + ex.getMessage());
            throw ex;
        } finally {
            result.close();
        }
    }

Attaching sample .msg file in ZIP sample.zip (566.0 KB)

@shaurya.chawla Thank you for reporting the problem to us. For a sake of correction it has been logged as WORDSNET-24055. We will keep you informed and let you know once it is resolved.

Hi there. Any update yet?

@shaurya.chawla Unfortunately, the issue is not resolved yet. Currently it is in a queue for analysis. We will keep you informed and let you know once there are news regarding the issue.

The issues you have found earlier (filed as WORDSNET-24055) have been fixed in this Aspose.Words for Java 23.6 update.