import com.groupdocs.annotation.Annotator; import com.groupdocs.annotation.licenses.License; import com.groupdocs.annotation.models.Rectangle; import com.groupdocs.annotation.models.Reply; import com.groupdocs.annotation.models.annotationmodels.PointAnnotation; import java.util.ArrayList; import java.util.Calendar; public class AddPointAnnotationinPDFusingJava { public static void main(String[] args) { // Set License to avoid the limitations of Annotation library License license = new License(); license.setLicense("GroupDocs.Annotation.lic"); // Create an instance of Annotator class Annotator annotator = new Annotator("input.pdf"); // 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<Reply> replies = new ArrayList<Reply>(); replies.add(reply1); replies.add(reply2); // Create an instance of PointAnnotation class and set options PointAnnotation point = new PointAnnotation(); point.setBox(new Rectangle(100, 100, 0, 0)); point.setCreatedOn(Calendar.getInstance().getTime()); point.setMessage("This is point annotation"); point.setPageNumber(0); point.setReplies(replies); // Add point annotation annotator.add(point); // Save the final PDF to disk annotator.save("result.pdf"); } }