Incorrect formatting when convert msg/eml message to PDF

Hi,


I have a situation where Aspose.Email & Words for .NET the message body is not correct converted to PDF.

Please take a look at the attached PDF. I included the original messages as wel.

Is there a way to improve de formating ins standard way (that works on all message bodies not only this one)?

I’m using version 6.9.0 (9/9/2016) to Aspose.Email and Aspose.Words for .NET 16.8.0 (9/10/2016).

The following code is used.

theMessage = MailMessage.Load(inputFileName);
MemoryStream stream = new MemoryStream();
theMessage.Save(stream, Aspose.Email.Mail.SaveOptions.DefaultMhtml);
stream.Seek(0, SeekOrigin.Begin);

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;

Aspose.Words.Document doc = new Aspose.Words.Document(stream, loadOptions);

Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.Compliance = PdfCompliance.Pdf15;

<span style=“color: rgb(51, 51, 51); font-family: “Courier New”; font-size: small;”>doc.Save(outputFileName, options);
<span style=“color: rgb(51, 51, 51); font-family: “Courier New”; font-size: small;”>
Best regards,
Andreas Ruge

Hi Andreas,


Thank you for contacting support. We managed to replicate the problem of cut off body text from both left and right sides. It has been logged under ticket ID WORDSNET-14287 in our bug tracking system. Your post has also been linked to this ticket. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

Hi Andreas,

Thanks for your patience. As a workaround of this issue, please enable Document.CompatibilityOptions.GrowAutofit property before saving the document. Moreover, please disable Table.AllowAutoFit property for the root table in the document to fit the table on page.

Please check the highlighted code snippet below. We have attached the output Pdf with this post for your kind reference. Hope this helps you.

Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;

Aspose.Words.Document doc = new Aspose.Words.Document(stream, loadOptions);

var table1 = doc.GetChildNodes(NodeType.Table, true)[0] as Table;
table1.AllowAutoFit = false;

Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.Compliance = PdfCompliance.Pdf15;

doc.CompatibilityOptions.GrowAutofit = true;

doc.Save(MyDir + "17.2.0.pdf", options);

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

Yes, ze hebben deze issue uit 2016 al gefixed :blush:

image250574.png (13 KB)