Unable to apply the link text color for OCR document

Please find the attached documents
For just scanned document : Scanned PDF Document.PDF .
For Scanned and performed OCR using Adobe : Scanned PDF Document - OCR.PDF

We perform the OCR for the scanned document using the Adobe Acrobat to recognizing the text so that we can copy/select the text. So for this document we are creating an link with text colour. But link created and unable to apply the text color.

Note : I just observed that, while creating an link for any text on the OCR - scanned document, the textFragment.TextState.Invisible is coming has true, is that the way its working for scanned document?

Below are the code snip set

/Code start/
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);

// 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;
foreach (TextFragment textFragment in absorber.TextFragments)
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);
System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml(data.linkInfo[i].textcolor);
textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(color1);
{ }
page.Rotate = pageRotation;
pdf.IsLinearized = true;
/Code end/


We could not find the attached files with your post. Can you please share them with us so that we can further proceed accordingly.

Scanned PDF Document - OCR.pdf (195.8 KB)

Scanned PDF Document.pdf (399.8 KB)

Please find the attached document…!


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

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.

Hi Support,

Any updates on this please?


The ticket has recently been logged in our issue management system and it will be investigated on a first come first serve basis. As soon as we make some progress towards its resolution, we will inform you. Please be patient and spare us some time.