Call the save() method. Specify the output document path or stream.
The following code snippet shows how to add UnderlineAnnotation to the document:
// This example demonstrates adding text underline 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 AreaAnnotation class and set options
UnderlineAnnotationunderline=newUnderlineAnnotation();underline.setCreatedOn(Calendar.getInstance().getTime());underline.setFontColor(65535);underline.setMessage("This is underline annotation");underline.setOpacity(0.1);underline.setPageNumber(0);underline.setPoints(points);underline.setReplies(replies);// Add annotation and save to file
annotator.add(underline);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.