A fairly major bug has been introduced into Aspose PDF 20.7 and above. 20.6 and below work fine. This is a bug as we have iterated through each package since 19.x successfully and written code against this feature - which is also documented on this site.
If a TextFragment has any TextState attributed to it (For example setting it to a normal font style or specific color), and then you add or append any TextSegments which have their own TextStyles defined, these are then ignored and the entire fragment renders using the parent style.
This means that it is now impossible to have a Text Fragment and alter the style of a subset of it (For our usage we iterate over paragraphs and make certain words bold)
The code for this is below to replicate
Document pdfDocument = new Document();
Page pdfPage = (Page)pdfDocument.Pages.Add();
var t = new TextFragment();
t.TextState.FontStyle = FontStyles.Regular;
t.TextState.ForegroundColor = Color.Blue;
var boldText = new TextSegment("I am red bold text.");
boldText.TextState.FontStyle = FontStyles.Bold;
boldText.TextState.ForegroundColor = Color.Red;
var normalText = new TextSegment("I am normal text.");
t.Segments.Add(boldText);
t.Segments.Add(normalText);
pdfPage.Paragraphs.Add(t);
pdfDocument.Save(@"C:\TEMP\ASPOSE.PDF");
In a working scenario this would yield
I am red bold text.I am normal text. (In red and blue)
Since 20.7 this yields
I am red bold text.I am normal text. , (all in blue)
As we have built a rather extensive tagging library around this feature for a large enterprise application this is fairly critical, and given that we have just renewed our licence and are unable to upgrade to accept other bug fixes this is now a blocker.
As a temporary measure I can stay on 20.7 but would need Aspose to fix this ASAP or refund part of the newly upgraded licence as we are unable to upgrade to the latest software due to this bug - Unless another workaround can be provided.
We really apologize for the inconvenience you have been facing due to this issue. We were able to replicate the bug in our environment and logged it as PDFNET-48777 in our issue management system. We have also recorded your concerns and will keep them in view during investigation against the ticket. We will inform you as soon as we make some certain progress towards its resolution. Please give us some time.
We are afraid that earlier logged ticket is not yet resolved. We will surely investigate and resolve it on first come first serve basis. Once the investigation against it is completed, we will be able to share some updates with you regarding its resolution ETA. Please be patient and give us some time.
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.
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 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.
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.
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.
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?
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?
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