The link misplaced when create link with text colour change

I noticed an issue when changing color of text within link rectangle using AsposePDF v23.12.0.0
Please see attached “input.pdf” and “output.pdf”.

input.pdf : Before changing color of text within link rectangle
output.pdf: After changing color of text using AsposePDF.net v23.12.0.0

Description : Created a link with text color blue by selecting the rectangle exactly the text area of “10 DATA QUALITY ASSURANCE” in the input.pdf document. But if you observed that output.pdf document, the link created with diffirent places not exactly what we selected the coordinates that covers the text “10 DATA QUALITY ASSURANCE”.

Aspose.Pdf.Page page = pdf.Pages[Int32.Parse(data.linkInfo[i].sourcepage)];

double llx = double.Parse(data.linkInfo[i].llx);
double lly = page.MediaBox.Height - double.Parse(data.linkInfo[i].lly) - double.Parse(data.linkInfo[i].height);
double urx = llx + double.Parse(data.linkInfo[i].width);
double ury = lly + double.Parse(data.linkInfo[i].height);
Aspose.Pdf.Rectangle AnnotRect = new Aspose.Pdf.Rectangle(llx, lly, urx, ury);

LinkAnnotation link = new LinkAnnotation(page, AnnotRect);

double pageHeight = destpage.MediaBox.Height;
XYZExplicitDestination mag = new XYZExplicitDestination( pdf.Pages[Int32.Parse(1)], 0, pageHeight, 0);
link.Action = new GoToAction(mag);
page.Annotations.Add(link);

// Apply Link Text color
foreach (Annotation annotation in page.Annotations)
{
    if (annotation is LinkAnnotation)
    {
        Aspose.Pdf.Rectangle rect = annotation.Rect;
        if (rect.LLX == AnnotRect.LLX && rect.LLY == AnnotRect.LLY && rect.URX == AnnotRect.URX && rect.URY == AnnotRect.URY)
        {
            TextFragmentAbsorber absorber = new TextFragmentAbsorber();
            absorber.TextSearchOptions.Rectangle = rect;
            Rotation pageRotation = page.Rotate;
            page.Rotate = Rotation.None;
            page.Accept(absorber);
            foreach (TextFragment textFragment in absorber.TextFragments)
            {
                try
                {
                    if (data.linkInfo[i].textcolor == null)
                    {
                        System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml(textFragment.TextState.ForegroundColor.ToString());
                        textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(color1);
                    }
                    else
                    {
                        System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml(data.linkInfo[i].textcolor);
                        textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(color1);
                    }
                }
                catch(NullReferenceException)
                { }
            }
            page.Rotate = pageRotation;
        }
    }
}
pdf.IsLinearized = true;
pdf.Save("output.pdf");
pdf.Dispose();

Please let me know if you need any more information on this.

@KumarPunith

Would you kindly re-attach your documents as we could not find them in your post. Also, please try using 24.3 version of the API before sharing the sample files. We will further proceed accordingly.

The issue replicated in 24.3 version also.
Please find the attached document.
input.pdf (880.7 KB)

Output.pdf (880.9 KB)

@KumarPunith

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-56990

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.