java.lang.IllegalStateException: Unexpected format of MIME heading. Special chars in parameter name. The document appears to be corrupted and cannot be loaded

Hi ASPOSE team, I am trying to convert E-mail Message (.eml) to PDF using ASPOSE API. Email with ISignature is having image and image links causing issue and not able to convert . If i remove the image it works fine

Below is the code that i use for conversion of email subject to pdf.

byte[] emailBody_byte = emailBody.getBytes();
InputStream targetStream = new ByteArrayInputStream(emailBody_byte);
HtmlLoadOptions options = new HtmlLoadOptions();
Document doc = new Document(targetStream, options);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
doc.save(outputStream, SaveFormat.PDF);
return outputStream.toByteArray();

Please let me know your suggestion

@arulsundarama Could you please zip and attach the problematic input document here for testing? We will check the issue and provide you more information.

Hi Team,
Attached the mail that is causing , please check and let me know for more details
CID268041602.zip (111.3 KB)

Regards
Arul

@arulsundarama Thank you for additional information. Unfortunately, I cannot reproduce the problem on my side using the latest 25.1 version of Aspose.Words and the following simple code:

byte[] emailBody_byte = Files.readAllBytes(Paths.get("C:\\Temp\\in.eml"));
InputStream targetStream = new ByteArrayInputStream(emailBody_byte);
Document doc = new Document(targetStream);
doc.save("C:\\Temp\\out.pdf", SaveFormat.PDF);

Here is the produced output: out.pdf (79.6 KB)

Thank you for your follow-up and update.Let me check and update you

1 Like