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

Free Support Forum - aspose.com

Email in Mhtml format shows disarranged layout when converted to pdf

Hi,

i try to convert an email to pdf. At first the email is saved in mhtml format via Aspose.Email.dll. After that the mhtml artefact is converted to pdf via Aspose.Words.dll.

The layout of the result document is corrupted. The grey box at the right side is to big, it squeezes the text to a very small margin at the left side.

I contacted the Aspsoe.Email team before and they told me, that the problem arises from the mhtml to pdf conversion. The mhtml file generated from Aspose.Email.dll is correct (see attachment).

Aspsoe.Email.dll 2.0.0.0
Aspose.Words.dll 11.6.0.0
internal bugid#4635

Thanks for help, Martin

==== Example code =================

public static void ConvertHtmlMail2Pdf(string strSourceFN)
{

string strTempFN = Path.GetDirectoryName(strSourceFN) + “\”+ Path.GetFileNameWithoutExtension(strSourceFN) + “.mht”;
string strDestFN = Path.GetDirectoryName(strSourceFN) + “\” + Path.GetFileNameWithoutExtension(strSourceFN) + “.pdf”;

MailMessage mail = MailMessage.Load( strSourceFN);

MhtMessageFormatter mailFormatter = new MhtMessageFormatter();
mailFormatter.FromFormat = "<span class=“headerLineTitle”>Von:<span class=“headerLineText”> {0} "; //Wichtig: korrekte Anführungszeichen " benutzen
mailFormatter.DateTimeFormat = “dd.MM.yyyy HH:mm”;
mailFormatter.SentFormat = “<span class=“headerLineTitle”>Gesendet:<span class=“headerLineText”> {0}
”;
mailFormatter.ToFormat = “<span class=“headerLineTitle”>An:<span class=“headerLineText”> {0}
”;
mailFormatter.SubjectFormat = “<span class=“headerLineTitle”>Betreff:<span class=“headerLineText”> {0}
”;
mailFormatter.BccFormat = “<span class=“headerLineTitle”>Bcc:<span class=“headerLineText”> {0}
”;
mailFormatter.CcFormat = “<span class=“headerLineTitle”>Cc:<span class=“headerLineText”> {0}
”;
mailFormatter.AttachmentFormat = “<span class=“headerLineTitle”>Anlagen:<span class=“headerLineText”> {0}
”;

mailFormatter.Format(mail);

mail.Save(strTempFN, MessageFormat.Mht, MailMessageSaveOptions.None);

LoadOptions loadOpt = new LoadOptions();
loadOpt.LoadFormat = LoadFormat.Mhtml;

Document wordDoc = new Document(strTempFN, loadOpt);

PdfSaveOptions saveOpt = new PdfSaveOptions();
wordDoc.Save(strDestFN, saveOpt);
}

Hi Martin,

Sorry for the inconvenience faced. While using the latest version of Aspose.Words i.e. v11.6.0, I have managed to reproduce this issue on my side. I have logged the issue in our bug tracking system, the issue ID is WORDSNET-6695. I have also linked your request to this issue and you will be notified as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Calibri","sans-serif"; mso-bidi-font-family:"Times New Roman";}

<![endif]–>

Hello,



i tested the new Aspose.Words.dll 11.10.0.0 und the problem still exist.



Martin

Hi Martin,


Thanks for your inquiry. Unfortunately, this issue is not resolved yet. This issue has been postponed till a later date and I am afraid, we cannot push it into production right now because there are many other important issues we have to work on. Rest assured, we will inform you as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

I just tested the Aspose.Email.dll 2.6.0.0 and it’s stillnot working.

Hi Martin,

Thanks for your inquiry. Unfortunately, WORDSNET-6695 is not resolved yet and there is no further news about this issue. This issue has been postponed for now. We will inform you as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

I just tested the Aspose.Email.dll 2.7.0.0 and it’s stillnot working.

Hi Martin,


Thanks for your inquiry. Just to clarify here that the problem linked to this thread is actually related to Aspose.Words’ API but not to the Aspose.Email. I am afraid, your issue (WORDSNET-6695) is still unresolved and I will be sure to inform you as soon as this issue is resolved. I apologize for any inconvenience.

Best regards,

I just tested the Aspose.Email.dll 2.9.0.0 and it’s still not working.

Hi Martin,


Thanks for your inquiry. I am afraid, the following issue is still unresolved.

WORDSNET-6695: Incorrect table cell width on importing MHTML file

We will inform you as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,

I just tested the Aspose.Email.dll 3.0.0.0 and it’s still not working.

Hi Martin,

Thanks for your inquiry. I am afraid, your issue is still unresolved. I have asked the ETA from our development team and will provide you some further feedback once I have an estimate. I apologize for any inconvenience.

Best regards,

I just tested the Aspose.Email.dll 3.2.1.0 and it’s still not working.

Hi Martin,

Thanks for your inquiry. I am afraid, the implementation of WORDSNET-6695 is still postponed. As mentioned [here](https://forum.aspose.com/t/65198), if you would like to purchase priory support in order to escalate your issues, please let us know. We apologize for your inconvenience.

Best regards,