Inconsistency between image layout and word layout

Hi,

I noticed a bug : when we remove a space character in an Aspose text Run, and then save the Aspose document, the doc file is correct, but the Jpg file is not correct : the space character is still displayed.

I tried with 9.1 and the new 9.2, it is the same problem.

In attachment, here is an example. And below, the C# code to reproduce the problem :

Document doc = new Document("test.doc");
var runlist = doc.GetChildNodes(NodeType.Run, true);
string text = ((Run)runlist[0]).Text; // = "It is the same as saying "
((Run)runlist[0]).Text = text.Substring(0, text.Length - 1); // Remove last space character
// => "It is the same as saying"
doc.Save("out_auto.doc", SaveFormat.Doc); // "It is the same as sayingthat."
doc.Save("out_auto.jpg", SaveFormat.Jpeg); // It is the same as saying that."

Is it possible to bypass this problem ?

Hi
Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed. As a workaround please try using the following code:

Document doc = new Document("test.doc");
Node[] runlist = doc.GetChildNodes(NodeType.Run, true).ToArray();
foreach (Run run in runlist)
{
    run.Font.ClearFormatting();
}
string text = ((Run)runlist[0]).Text;
((Run)runlist[0]).Text = text.Substring(0, text.Length - 1);
doc.JoinRunsWithSameFormatting();
doc.Save("out_auto.doc");
doc.Save("out_auto.jpg", SaveFormat.Jpeg);

Best regards,

Thanks for your answer.

Your solution is quite good and works, but it erases the formatting, that is quite annoying.

But my problem is not too blocking, so it is not too grave.

Hi

Thanks for your request. You will be notified as soon the original problem is resolved.
Best regards,

Hi,
This is an unlucky combination of font, size, particular characters in a particular combination where GDI+ renders text narrower than corresponding width reported to AW by the True Type font.
If I make font bigger in your document, say 20pt, the problem is far less noticeable.
At this stage I am inclined to mark this issue as “won’t fix” until we get more reports of affected customers because the fix is not going to be trivial.

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


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