Hi, How to Get Hyperlinks Text in PDF?
I am trying this code it search only Text not a hyperlinks text.
Document pdfDocument1 = new Document(pathI);
// Create TextAbsorber object to find all the phrases matching the regular expression
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("ET-NTTYP1485-01-0008.01-E-04-D-01"); // Like 1999-2000
// Set text search option to specify regular expression usage
TextSearchOptions textSearchOptions = new TextSearchOptions(true);
textFragmentAbsorber.TextSearchOptions = textSearchOptions;
// Accept the absorber for all the pages
pdfDocument1.Pages.Accept(textFragmentAbsorber);
// Get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
// Loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
Console.WriteLine("Text : {0} ", textFragment.Text);
Console.WriteLine("Position : {0} ", textFragment.Position);
Console.WriteLine("XIndent : {0} ", textFragment.Position.XIndent);
Console.WriteLine("YIndent : {0} ", textFragment.Position.YIndent);
Console.WriteLine("Font - Name : {0}", textFragment.TextState.Font.FontName);
Console.WriteLine("Font - IsAccessible : {0} ", textFragment.TextState.Font.IsAccessible);
Console.WriteLine("Font - IsEmbedded : {0} ", textFragment.TextState.Font.IsEmbedded);
Console.WriteLine("Font - IsSubset : {0} ", textFragment.TextState.Font.IsSubset);
Console.WriteLine("Font Size : {0} ", textFragment.TextState.FontSize);
Console.WriteLine("Foreground Color : {0} ", textFragment.TextState.ForegroundColor);
}