Major issue introduced in 20.7 - Text Segment TextState ignored

@Red192

Yes, we tested it in our system and could not notice the issue. Please try to do following in a sample console application or existing application:

  • uninstall both Aspose.PDF and Aspose.Pdf.Drawing Packages
  • re-install only Aspose.Pdf.Drawing Package using NuGet
  • add Aspose.Pdf and Aspose.Pdf.Text namespaces on the top of your class
  • it should work

i don’t see it working, to be sure i will give all the information needed:

the current code i’m using:

using var doc = new Document();

using var page = doc.Pages.Add();


var box = new FloatingBox()
{
	Border = new BorderInfo(BorderSide.All, 1.5f, Color.DarkGreen),
	Width = page.PageInfo.Width - (page.PageInfo.Margin.Left + page.PageInfo.Margin.Right)
};
var text = "wadaawdwadawfw2fes";
box.Paragraphs.Add(new TextFragment(text));

var box2 = new FloatingBox()
{
	Border = new BorderInfo(BorderSide.All, 1.5f, Color.Red),
	Padding = new MarginInfo(0, 10, 0, 10),
	Width = page.PageInfo.Width - (page.PageInfo.Margin.Left + page.PageInfo.Margin.Right)
};
var text2 = "Test";

var Innerbox1 = new FloatingBox()
{
	Border = new BorderInfo(BorderSide.All, 1.5f, Color.Red),
	Padding = new MarginInfo(0, 10, 0, 10),
};

var Innerbox2 = new FloatingBox()
{
	Border = new BorderInfo(BorderSide.All, 1.5f, Color.Red),
	Padding = new MarginInfo(0, 10, 0, 10),
	IsFirstParagraphInColumn = true
};

Innerbox1.Paragraphs.Add(new TextFragment(text2));

TabStops ts = new TabStops();


TabStop ts1 = ts.Add(0);
ts1.AlignmentType = TabAlignmentType.Left;
ts1.LeaderType = TabLeaderType.None;

TabStop ts2 = ts.Add(70);
ts2.AlignmentType = TabAlignmentType.Left;
ts2.LeaderType = TabLeaderType.None;

TabStop ts3 = ts.Add(220);
ts3.AlignmentType = TabAlignmentType.Left;
ts3.LeaderType = TabLeaderType.None;

TabStop ts4 = ts.Add(290);
ts4.AlignmentType = TabAlignmentType.Left;
ts4.LeaderType = TabLeaderType.None;
var segm = new[] {
	new[]{"First", "Second", "third", "fourth"},
	new[]{"First", "Second"},
};
foreach (var i in segm)
{
	TextFragment text0 = new TextFragment(ts);
	text0.HorizontalAlignment = HorizontalAlignment.Left;
	var jj = true;
	foreach (var x in i)
	{
		var seg = new TextSegment(x + "#$TAB");
		seg.TextState = new TextState()
		{
			FontStyle = jj ? FontStyles.Bold : FontStyles.Regular,
			FontSize = jj ? 15 : 8,
		};
		jj = jj != true;
		text0.Segments.Add(seg);
	}
	Innerbox2.Paragraphs.Add(text0);
}

box2.ColumnInfo = new ColumnInfo() { ColumnCount = 2, ColumnWidths = "100 315", ColumnSpacing = "5" };
box2.Paragraphs.Add(Innerbox1);
box2.Paragraphs.Add(Innerbox2);

page.Paragraphs.Add(box);
page.Paragraphs.Add(box2);

doc.Save("C:\\Users\\xxxxxxx\\InvoiceTest34.pdf");

the current LinqPad configuration:
image.jpg (189.5 KB)

image.png (73.7 KB)

The current output:
image.png (7.8 KB)

The expected result:
image.png (159.6 KB)

image.png (159.2 KB)

@Red192

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-58394

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.