Problem converting MTHML to PDF


I’m trying to convert an eml file to Pdf, but I’m running into some problems.
When following the instructions to the post here, I can convert the eml to an MHTML file, which shows correctly in Internet Explorer, but when I load it as a Document and save it to Pdf, the background vanishes.

Here is my code:

// Part of Aspose.Network
MailMessage mail = MailMessage.Load("test.eml");

MemoryStream mhtStream = new MemoryStream();
mail.Save(mhtStream, MailMessageSaveType.MHtmlFromat);

// Use Aspose.Words for MHT --> PDF
Document doc = new Document(mhtStream);
doc.Save("test.pdf", SaveFormat.Pdf);

Attached is a zip containing the original eml file, the MTHML file and the PDF result that I get.

Can anyone please advice me in what I’m doing wrong?



Thanks for your request. Unfortunately, Aspose.Words does not support importing/exporting document image background from/to HTML. Your request has been linked to the appropriate issue. We will let you know once it is resolved.
Best regards,

Hi Alexey,

Thanks for your response.
I’m looking for a workaround and I may have found an option, but I need a little help with this.

Using a Regular Expression, I’m looking if the background property of the body element is set in the HtmlBody property of the MailMessage class.

Which will look like this: background = "cid:220A7C3D-E10C-497D-BC2F-6F63EF93E4E2"

Next, I will look for the correpsonding LinkedResource in the MailMessage and extract the stream to a Shape class.
In de document I will set the BackgroundShape property to the shape that I just created.
This wil work for PDF documents, not for doc or docx documents.

The problem that I’m encountering now is that the background shape is stretched out over the whole page.

Is there any way for the image to contain it’s original dimensions?



Thanks for your request. Unfortunately, currently there is no way to specify texture fill of shape using Aspose.Words. I logged this feature request into our defect database. We will let you know once it is resolved.
Best regards,

Hi Alexey,

Thank you for your swift reply.
I wil await further notification of this issue.



The issues you have found earlier (filed as WORDSNET-5409) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.