# Add link annotation The page describes how to add link annotation to a document using GroupDocs.Annotation for Java. Link annotation adds a hyperlink to document as shown in the picture below: ![](https://docs.groupdocs.com/annotation/java/images/add-link-annotation.png) You can use the following methods to set the properties of the [LinkAnnotation](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.models.annotationmodels/linkannotation) class: * [setUrl()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.models.annotationmodels/linkannotation/#setUrl-java.lang.String-) defines link to a web resource * [setPoints()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.models.annotationmodels/linkannotation/#setPoints-java.util.List-com.groupdocs.annotation.models.Point--) defines the annotation positions as an array of points. To add a link annotation, follow these steps: 1. Instantiate the [Annotator](https://reference.groupdocs.com/java/annotation/com.groupdocs.annotation/Annotator) class. Specify the input document path or stream. 2. Instantiate the [LinkAnnotation](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.models.annotationmodels/linkannotation) class. Specify the appropriate properties (position, page number, etc). 3. Call the [add()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#add-com.groupdocs.annotation.models.annotationmodels.AnnotationBase-) method. Specify the [LinkAnnotation](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.models.annotationmodels/linkannotation) class. 4. Call the [save()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#save--) method. Specify the output document path or stream. The following code snippet shows how to add [LinkAnnotation](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.models.annotationmodels/linkannotation) to the document: {{< tabs "example1">}} {{< tab "Java" >}} ```java // This example demonstrates adding link annotation. // Create an instance of Annotator class Annotator annotator = new Annotator("inputPath"); try { // Create an instance of Reply class and add comments Reply reply1 = new Reply(); reply1.setComment("First comment"); reply1.setRepliedOn(Calendar.getInstance().getTime()); Reply reply2 = new Reply(); reply2.setComment("Second comment"); reply2.setRepliedOn(Calendar.getInstance().getTime()); java.util.List replies = Arrays.asList(reply1, reply2); List points = Arrays.asList(new Point(80, 730), new Point(240, 730), new Point(80, 650), new Point(240, 650)); // Create an instance of LinkAnnotation class and set options LinkAnnotation link = new LinkAnnotation(); link.setCreatedOn(Calendar.getInstance().getTime()); link.setMessage("This is link annotation"); link.setOpacity(0.7); link.setPageNumber(0); link.setPoints(points); link.setReplies(replies); link.setUrl("https://www.google.com"); // Add annotation and save to file annotator.add(link); annotator.save("outputPath"); } finally { if (annotator != null) { annotator.dispose(); } } ``` {{< /tab >}} {{< /tabs >}}