ParserGetHyperlinks Method (PageAreaOptions)
Extracts hyperlinks from the document using customization options (to set the rectangular area that contains hyperlinks).

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

Parameters

options
Type: GroupDocs.Parser.OptionsPageAreaOptions
The options for hyperlinks extraction.

Return Value

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

The following example shows how to extract hyperlinks from the document page area:

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;
    }
    // Create the options which are used for hyperlink extraction
    PageAreaOptions options = new PageAreaOptions(new Rectangle(new Point(380, 90), new Size(150, 50)));
    // Extract hyperlinks from the document page area
    IEnumerable<PageHyperlinkArea> hyperlinks = parser.GetHyperlinks(options);
    // 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