Mail to PDF - inline images shown as Red Cross

@vedjaipraful Sure, we will let you know once 22.5 version of Aspose.Words for java is available.
The second question is also related to Aspose.Words, because Aspose.Words does not support embedded objects in PDF. So even if Aspose.Email will export them somehow into MHTML, Aspose.Words will not export them to PDF. This feature request is logged as WORDSNET-14001 and is currently postponed.

@alexey.noskov
SO as of today if the external attached image is displayed in the converted PDF, you mean to say that the new release for the ASPOSE.words will definitely not support it.
Today in the version 20.12 that we use, it is shown as the output, is really a bug and will be fixed in the coming releases. Is this true :slight_smile:
I wonder how will I explain this to the QA team as in the specification I already committed that none of the attachments are going to be converted for the PDF output, but I am already dead in the first test result…And the moment we will upgrade the WORDS JAR, we will have a new behaviour :slight_smile:

Please clarify this point so that I define the spec based on the WORDS version we use in our production.
Thanks for all the support.

@vedjaipraful

No, this is not what I said. In new version LoadOptions.ResourceLoadingCallback will be no longer invoked for resources that are embedded as data URLs (for example, data:image/gif;base64,R0lGODlhEAAQAMQAAORH…). The reason is that these URLs do not reference external resources and are decoded in place.

Regarding attachments: In MS Word analog of attachments are Embedded OLE objects. They are fully supported by Aspose.Words model. however, such objects are not supported when you export document to PDF. So in PDF these embedded objects will be lost.
Images are actually not embedded objects in MS Word documents and are simple shapes either with imbedded image (like in your case) or external image.

Ouch…
Sorry for the misunderstanding.
So reiterate my question. On the documentation page for msg to pdf, it is written that all attachments cannot be part of the output. So i believe that if an image is attached to the mail, it would also not be part of the conversion. Similarly if any other type of data is attached like pdf, doc, xls, ppt, anything, it would not be part of the output pdf. However my observation is that in my sample, I see the image as an attachment being part of the output pdf. As per doc this should not be the case as this image is an attachment and not inline.
So I ask again that is image attachment an exception to this case ? Because the intermediate mhtml created from msg also has the information of the attached image.
@tahir.manzoor @alexey.noskov

@vedjaipraful I Will move your request back into Aspose.Email forum. @tahir.manzoor will help you with this question soon.

@vedjaipraful

Could you please share the expected MHTML output of ‘Mail_InlineImage_Attachment.msg’ here for our reference? If there are multiple attachments e.g. image, Excel or Word documents, how would you want to render them in output MHTML. We will then provide you more information on it.

Hello @tahir.manzoor
I had already shared the details in the above thread. Re-sharing that here -
zipped1004757_161211731.zip (557.3 KB)
This zip has the intermediate mhtml, doc, docx, pdf and the original msg files.

What I really want to know is that based on the statement at Saving A MSG as PDF|Documentation

An email message can contain attachments as well. Since each attachment can be of different media type, Aspose.Email ignores these attachments while converting to MHTML i.e. only inline images in a message will be part of MHTML and any regular attachments will be ignored.

Here it clearly says that Aspose.Email ignores these attachments while converting to MHTML. So we are wondering how the attachment “Aspose Image 1.png” is part of the output mhtml and output pdf. Of course there is another attachment which is an image too, but perhaps ignored as we are using the evaluation version of Aspose.email

Is this expected behavior that if there is an attachment which is an image, it would be part of the conversion. If any other format, it will be skipped ?

@vedjaipraful

In your case, we suggest you following solution:

  1. Save the MSG file to MHTML using Aspose.Email.
  2. Extract the attachments from the MSG file using Aspose.Email.
  3. Please use Aspose.Words to insert the extracted images into MHTML.

If you have more queries about inserting images into MHTML, please post your query in Aspose.Words’ forum.

Hello @tahir.manzoor
I still believe the question is misunderstood.
I am not looking to carry forward the attachments. I am defining the specification of my conversion. Based on the article, I declared that none of the attachments (be it images, pdf, word, ppt, anything) to the mail, will be part of the conversion to PDF. This specification is purely based on the article “Saving A MSG as PDF|Documentation”.
But now the issue is that the attachment which is a png file is part of the conversion to pdf. This means that what is said in the article - Saving A MSG as PDF|Documentation, does not hold true.

So I reframe my question - Will image attachments be converted ? So I can modify my specification of the functionality accordingly. If images are going to be part of the conversion, then I will say that all attachments except type of images will be ignored and only images will be converted.

@vedjaipraful

We have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as EMAILJAVA-35055. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@tahir.manzoor
thanks for the update…
for the moment I will make the specification to say that attachment images are converted. But that will be fixed in the next versions of Aspose.Email that will be deployed.

@vedjaipraful

We will check this issue and update the documentation according to APIs.

@vedjaipraful

Please use MhtSaveOptions.setSaveAttachments method as shown below to avoid attachment export in output MTHML.

MsgLoadOptions mlo = new MsgLoadOptions();
MailMessage eml = MailMessage.load(MyDir + "Mail_InlineImage_Attachment.msg", mlo);

MhtSaveOptions saveOptions = new MhtSaveOptions();
saveOptions.setSaveAttachments(false);
eml.save(MyDir + "22.4.mhtml", saveOptions);

The issues you have found earlier (filed as WORDSNET-14001) have been fixed in this Aspose.Words for .NET 22.11 update also available on NuGet.