Add link annotation

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Annotation MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-annotation -- dnx GroupDocs.Annotation.Mcp --yes
Folders, licensing and more →

On this page

Link annotation adds a hyperlink to document as shown in the picture below:

You can set the following properties of the  LinkAnnotation class:

  • Url defines link to a web resource
  • Points defines the annotation positions as an array of points.

To add a link annotation, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate the LinkAnnotation class. Specify the appropriate properties (position, page number, etc).
  3. Call the Add method. Specify the LinkAnnotation class.
  4. Call the Save method. Specify the output document path or stream.

The following code snippet shows how to add LinkAnnotation to the document:

//Add link annotation to the document from local disk
using (Annotator annotator = new Annotator("input.pdf"))
{
	LinkAnnotation link= new LinkAnnotation
    {
    	Url = "https://www.groupdocs.com/",
        CreatedOn = DateTime.Now,
        Message = "This is link annotation",
        BackgroundColor = 65535,
        PageNumber = 0,
        Points = new List<Point>
        {
        	new Point(80, 730), new Point(240, 730), new Point(80, 650), new Point(240, 650)
        },
        Replies = new List<Reply>
        {
        	new Reply
            {
            	Comment = "First comment",
                RepliedOn = DateTime.Now
            },
            new Reply
            {
            	Comment = "Second comment",
                RepliedOn = DateTime.Now
            }
        }
    };
    annotator.Add(link);
    annotator.Save("result.pdf");
}

On this page