Major issue introduced in 20.7 - Text Segment TextState ignored

Is there any indication of the position in the queue for this?

As Aspose introduced this bug in 20.7 it means that we cannot update our system to use the latest versions
This means that we cannot make use of other fixes since 20.7, and more frustratingly we are paying a licence to cover 12 months of upgrades that we cannot accept

If this was an obscure issue I would understand having to wait, but as Aspose introduced this bug due to lack of testing this should be prioritized or a license renegotiation should occur - which your sales team don’t seem to understand.

@R_C_D_T

We are collecting the information regarding investigation results against the logged ticket and will soon try to share some ETA with you. We do understand the severity of the issue for you and humbly apologize for the inconvenience being faced. We have raised the issue priority to next level while considering your concerns. We will let you know soon about further updates. Please give us little time.

We are sorry for the delay and inconvenience.

@R_C_D_T

We would like to inform you that issue has been scheduled for investigation during next week and as soon as the analysis is completed, we will share updates about its ETA with you.

1 Like

I see that the item has been resolved, am I correct in thinking this will be in the 20.12 release which is imminent?

@R_C_D_T

Yes, you are right. The ticket has been fixed and will be included in upcoming release 20.12. We will update within this forum thread as soon as new release is available.

The issues you have found earlier (filed as PDFNET-48777) have been fixed in Aspose.PDF for .NET 20.12.

This issue appeared again in v24.9.0 (aspose pdf - C#),

it is supposed to work or is it a dismissed feature?

As a (sadly) veteran of this software I am not shocked. We went almost a year before we could update as Aspose do not test their software which is disgusting for the price we pay.
Even this year we cannot upgrade past 24.5.1 as there are random issues with text getting underlined at random

So much so that I am currently mid-proposal for ditching almost 20k of licences for Aspose for another platform. Its genuinely ridiculous.

@R_C_D_T @Red192

We sincerely apologize for the inconvenience caused. Please note that many times issues are related to specific PDF document and they are resolved only for those particular files. Also, the regression issues are taken seriously and we try our best to resolve them at our earliest. The API has a lot of modules and they can sometimes produce unexpected results due to other modules on which they are dependent. The detailed investigation is carried out in such cases and we fix the issues.

Nevertheless, are you facing this issue with .NET Core or .NET Framework?

Thanks @asad.ali, i’m experiecing the issue in .net 8.
If you are confirming it was still an expected behavior, should i open a bug for it?

@Red192

Please try using Aspose.Pdf.Drawing instead of Aspose.PDF for .NET and see if this issue still persists.

It’s not possible to use pdf.Drawing alone

@Red192

Can you please share why you cannot use Aspose.Pdf.Drawing alone? It has all the features and Classes that Aspose.PDF for .NET has. Is there some kind of limitation at your end?

using var doc = new Document();

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

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);
	}
	page.Paragraphs.Add(text0);
}

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

for example. To use this you have to reference

Aspose.Pdf
Aspose.Pdf.Text

@Red192

There should be no issue with these namespaces. Please note that Aspose.Pdf.Drawing is a version of Aspose.PDF for .NET that has all Classes of the original API except it does not have any dependency upon System.Drawing.Common Assembly (other than the printing features). Therefore, you can easily uninstall existing package and install Aspose.Pdf.Drawing package from NuGet Gallery and your above code will not give any error.

I did @asad.ali, using Aspose.Pdf.Drawing it’s equivalent on using Aspose.Pdf in mater of it’s namespaces, since it’s a referenced package. The problem persist. You can try it yourself using the snippet i sent you

@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.

The issues you have found earlier (filed as PDFNET-58394) have been fixed in Aspose.PDF for .NET 24.11.