Iterate through the collection and get a hyperlink text and URL.
The following example shows how to extract all hyperlinks from the whole document:
// Create an instance of Parser classusing(Parserparser=newParser(filePath)){// Check if the document supports hyperlink extractionif(!parser.Features.Hyperlinks){Console.WriteLine("Document isn't supports hyperlink extraction.");return;}// Extract hyperlinks from the documentIEnumerable<PageHyperlinkArea>hyperlinks=parser.GetHyperlinks();// Iterate over hyperlinksforeach(PageHyperlinkAreahinhyperlinks){// Print the hyperlink textConsole.WriteLine(h.Text);// Print the hyperlink URLConsole.WriteLine(h.Url);Console.WriteLine();}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: