ParserGetHyperlinks Method
Extracts hyperlinks from the document.

Namespace: GroupDocs.Parser
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 20.8.0
Syntax
public IEnumerable<PageHyperlinkArea> GetHyperlinks()

Return Value

Type: IEnumerablePageHyperlinkArea
A collection of PageHyperlinkArea objects; null if hyperlinks extraction isn't supported.
Examples

The following example shows how to extract all hyperlinks from the whole document:

C#
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
    // Check if the document supports hyperlink extraction
    if (!parser.Features.Hyperlinks)
    {
        Console.WriteLine("Document isn't supports hyperlink extraction.");
        return;
    }
    // Extract hyperlinks from the document
    IEnumerable<PageHyperlinkArea> hyperlinks = parser.GetHyperlinks();
    // Iterate over hyperlinks
    foreach (PageHyperlinkArea h in hyperlinks)
    {
        // Print the hyperlink text
        Console.WriteLine(h.Text);
        // Print the hyperlink URL
        Console.WriteLine(h.Url);
        Console.WriteLine();
    }
}
See Also