Free Support Forum - aspose.com

Text - Segments - colours go outside segment

I have the text 'red, green , blue' across 5 segments. I have set it up so each word is its colour and the commas are black. When this is output, the first comma (which doesn't have a leading space) is red, whereas the second comma (has a leading space) is black. I was wanting both commas to be black. I was wondering if there are any other characters or circumstances that would cause segment styles to flow on?

Pdf pdf = new Pdf();
Section section = pdf.Sections.Add();
Text text = new Text();
section.Paragraphs.Add(text);

// 'red' in red
Segment red = text.Segments.Add();
red.Content = "red";
red.TextInfo.Color = new Color("red");

// comma, no leading space
text.Segments.Add(", ");

// 'green' in green
Segment green = text.Segments.Add();
green.Content = "green";
green.TextInfo.Color = new Color("green");

// comma, leading space
text.Segments.Add(" , ");

// 'blue' in blue
Segment blue = text.Segments.Add();
blue.Content = "blue";
blue.TextInfo.Color = new Color("blue");

Hi,

Thank you for considering Aspose.

I was not able to reproduce this error with Aspose.Pdf 3.6.1. The resulting Pdf is attached.

Hi,

Thank you for your quick reply. I am not using that verison, I will update and post again if I can reproduce it.