Call the save() method. Specify the output document path or stream.
The following code snippet shows how to add HighlightAnnotation to the document:
// This example demonstrates adding text highlight 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=newArrayList<Reply>();replies.add(reply1);replies.add(reply2);Pointpoint1=newPoint(80,730);Pointpoint2=newPoint(240,730);Pointpoint3=newPoint(80,650);Pointpoint4=newPoint(240,650);List<Point>points=newArrayList<Point>();points.add(point1);points.add(point2);points.add(point3);points.add(point4);// Create an instance of HighlightAnnotation class and set options
HighlightAnnotationhighlight=newHighlightAnnotation();highlight.setBackgroundColor(65535);highlight.setCreatedOn(Calendar.getInstance().getTime());highlight.setFontColor(0);highlight.setMessage("This is highlight annotation");highlight.setOpacity(0.5);highlight.setPageNumber(0);highlight.setPoints(points);highlight.setReplies(replies);// Add annotation and save to file
annotator.add(highlight);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.