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();}}
Note
Hyperlinks are read from the document as text — GroupDocs.Parser never resolves, follows, or requests them. See Network access and data privacy for the complete list of operations that do and do not generate network traffic.
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: