Hi Aspose,
Is there any way to get both link text and color with one time visit or Accept to TextFragmentAbsorber or TextAbsorber.
Reason: When we run on 50000 plus links using below 1 and 2 code to get link text and color. its giving an performance issue.
-
We are using below code to get link text as
Aspose.Pdf.Text.TextAbsorber absorber = new Aspose.Pdf.Text.TextAbsorber();
Aspose.Pdf.Rectangle newRect = rect;
pdfpage.Accept(absorber);
LinkText = absorber.Text; -
We are using below code to get link text color
Aspose.Pdf.Text.TextFragmentAbsorber textFragmentAbsorbernew = new Aspose.Pdf.Text.TextFragmentAbsorber();
textFragmentAbsorbernew.TextSearchOptions = new Aspose.Pdf.Text.TextSearchOptions(newRect);
textFragmentAbsorbernew.Visit(PDFPage);
int FragmentTextlength = 0;
foreach (Aspose.Pdf.Text.TextFragment TextFrag in textFragmentAbsorbernew.TextFragments)
{
if (FragmentTextlength < TextFrag.Text.Length)
{
TextColor = TextFrag.TextState.ForegroundColor.ToString();
FragmentTextlength = TextFrag.Text.Length;
}
}