We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose converting MSG to PDF without inline images

Hello Aspose Team,


In attachment there is a .msg file which images are failing to be properly converted to PDF, they become red Xs in the resulting file.

The code I’m using is the following:

FileOutputStream foStream = null;
FileInputStream fiStream = null;
File tempDocOut = null;
try {
tempDocOut = File.createTempFile(“mcfile”, null);
foStream = new FileOutputStream(tempDocOut);
MailMessage mail = MailMessage.load(msgFilePath);
mail.save(foStream, SaveOptions.getDefaultMhtml());
foStream.close();
fiStream = new FileInputStream(tempDocOut);

LoadOptions lo = new LoadOptions();
lo.setLoadFormat(LoadFormat.MHTML);
Document doc2 = new Document(fiStream, lo);
doc2.save(pdfFilePath, com.aspose.words.SaveFormat.PDF);
} finally {
try {
IOUtils.closeQuietly(fiStream);
IOUtils.closeQuietly(foStream);
tempDocOut.delete();
} catch (Exception e) {
e.printStackTrace();
}
}

[]'s

A different error happens when trying to convert this other .msg file attached.

But in this case, some images are not shows instead of an red X.

[]'s

Hi Mario,


Thank you for writing to Aspose Support team.

We have examined both your MSG files and found that:

1. When test.msg is opened in MS Outlook, it doesn’t contain any images. These are shown as “X” in MS Outlook as well and the same behavior is replicated in output MHTML as well.

2. When test2.msg is opened in MS Outlook, it fetches images information from internet and images are visible as well in MS Outlook. The same when converted to MHTML using our API, contains the images in output MHTML as well.

This shows that the behavior of API is consistent and we couldn’t observe any anomaly here. Please let us know if you have further concerns about this.

Hello Kashif, thanks for the answer.


1- The email does contain images. But the default behavior of some Outlooks is not to download them. There is a button on the top to download the messages and/or alter this configuration.

2- Some images work fine, but two dont. One in the beginning containing “Olá, sua fatura chegou :)” and other at the end with numbers inside an orange rectangle.


The biggest problem in both scenarios is that both conversion worked fine using a old version of Aspose Emails and Words (email 3.3 and words 13.1). The test.pdf and test2.pdf generated by the this old code below is attached to this message.

So, what can I do to achieve the same results as before?

Old code:

FileOutputStream foStream = null;
FileInputStream fiStream = null;
File tempDocOut = null;
try {
tempDocOut = File.createTempFile(“mcfile”, null);
foStream = new FileOutputStream(tempDocOut);
MailMessage mail = MailMessage.load(filePath);
mail.save(foStream, MailMessageSaveType.getMHtmlFormat());
foStream.close();
fiStream = new FileInputStream(tempDocOut);
Document doc2 = new Document(fiStream);
doc2.save(pdfFilePath, com.aspose.words.SaveFormat.PDF);
} finally {
try {
IOUtils.closeQuietly(fiStream);
IOUtils.closeQuietly(foStream);
tempDocOut.delete();
} catch (Exception e) {
e.printStackTrace();
}
}

Hi Mario,


Thank you for sharing additional information.

We were able to observe the problem with test2.msg file during conversion to MHTML and have logged this problem as EMAILJAVA-34207 for further investigation by our Product team. We’ll update you here once there is some information or a fix version available in this regard.

Regarding test1.msg, we couldn’t reproduce the issue as the output MHTML file loads the images fine. I have attached the output MHTML file here for your reference for further feedback from your side.

Thanks for the answer Kashif.


Could you share the code you used to convert the test1?
Because I understood that in the first try, you got a mhtml file with the red Xs as well.

Wanted to know if you changed something for it to work.

About the ticket: Do you have an estimate time for it to be corrected? Isn’t there any configuration or workaround I can do to make it work with this version?

[]'s

Hi Mario,


We have used the same test code that you shared in the first post on this thread. In the first try, where we faced the issue, we found that it was some internet connectivity issue at our end. As you can see in the attached MHTML file attached in our previous reply, we couldn’t face any such problem with test1.msg.

About the ticket, the issue is pending for analysis by our Product team and it will be investigated upon it’s turn. We are sorry but there is no other way or alternative that we could find to make it work with this version.

Hello,


Any news about this topic?

[]'s

Hi,


There is no ETA available for the logged issue. We’ll notify you here once there is some information or a fix version available for this issue.

The issues you have found earlier (filed as EMAILJAVA-34207) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.