I am trying to convert a mail message to PDF using the following example: https://docs.aspose.com/display/emailjava/Save+Email+Message+As+PDF
MailMessage eml = MailMessage.load(inputStream);
ByteArrayOutputStream emlStream = new ByteArrayOutputStream();
eml.save(emlStream, SaveOptions.getDefaultMhtml());
LoadOptions lo = new MhtLoadOptions();
InputStream bis = new ByteArrayInputStream(emlStream.toByteArray());
Document doc = new Document(bis, lo);
doc.save(response.getOutputStream(), SaveFormat.PDF);
First, the message is converted to MHTML. That seems to work ok. But when I convert this MHTML to PDF, a NullPointerException is thrown:
Caused by: java.lang.NullPointerException
at com.aspose.pdf.internal.html.rendering.MhtmlRenderer.render(Unknown Source)
at com.aspose.pdf.internal.html.rendering.MhtmlRenderer.render(Unknown Source)
at com.aspose.pdf.internal.html.rendering.MhtmlRenderer.render(Unknown Source)
at com.aspose.pdf.l10j.lI(Unknown Source)
at com.aspose.pdf.ADocument.lI(Unknown Source)
at com.aspose.pdf.ADocument.<init>(Unknown Source)
at com.aspose.pdf.Document.<init>(Unknown Source)