Call the save() method. Specify the output document path or stream.
The following code snippet shows how to add LinkAnnotation to the document:
// This example demonstrates adding link annotation.
// Create an instance of Annotator class
Annotatorannotator=newAnnotator("inputPath");try{// Create an instance of Reply class and add comments
Replyreply1=newReply();reply1.setComment("First comment");reply1.setRepliedOn(Calendar.getInstance().getTime());Replyreply2=newReply();reply2.setComment("Second comment");reply2.setRepliedOn(Calendar.getInstance().getTime());java.util.List<Reply>replies=Arrays.asList(reply1,reply2);List<Point>points=Arrays.asList(newPoint(80,730),newPoint(240,730),newPoint(80,650),newPoint(240,650));// Create an instance of LinkAnnotation class and set options
LinkAnnotationlink=newLinkAnnotation();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();}}
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.