We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extract links from PDF document using Aspose.PDF for .NET in C#

Hi,

I am try to fetch the more than 2000 links text in a pdf.

case 1. By using TextFragmentAbsorber, it requires 60 seconds to fetch all 2000 link text

//Code snipset
Aspose.Pdf.Text.TextFragmentAbsorber textFragmentAbsorbernew = new Aspose.Pdf.Text.TextFragmentAbsorber();
textFragmentAbsorbernew.TextSearchOptions = new Aspose.Pdf.Text.TextSearchOptions(linkAnno.Rect);
textFragmentAbsorbernew.Visit(page);
foreach (Aspose.Pdf.Text.TextFragment TextFrag in textFragmentAbsorbernew.TextFragments)
{
Linktext += TextFrag.Text;
}

Case 2 : By using TextAbsorber, it requires 90 seconds to fetch all 2000 link text
//Code snipset
Aspose.Pdf.Rectangle rect = linkAnno.Rect;
TextAbsorber absorber = new TextAbsorber();
absorber.TextSearchOptions.Rectangle = rect;
absorber.TextSearchOptions.LimitToPageBounds = true;
page.Accept(absorber);
res = absorber.Text;

This is not good, Can you please provide the more details about, fastest way to fetch link text.

@punithkumar

Thanks for contacting support.

Can you please share source files along with version details to further investigate this issue.