Call the save() method with the output document path or stream. Specify the SaveOptions class as a parameter.
The following code snippet shows how to save only annotated pages:
// This example demonstrates saving result document with specified pages.
// Create an instance of Annotator class
Annotatorannotator=newAnnotator("inputPath");try{// Create an instance of AreaAnnotation class and set options
AreaAnnotationarea=newAreaAnnotation();area.setBox(newRectangle(100,100,100,100));area.setBackgroundColor(65535);area.setPageNumber(1);// Create an instance of EllipseAnnotation class and set options
EllipseAnnotationellipse=newEllipseAnnotation();ellipse.setBox(newRectangle(100,100,100,100));ellipse.setBackgroundColor(123456);ellipse.setPageNumber(2);List<AnnotationBase>tmp0=newArrayList<AnnotationBase>();tmp0.add(area);tmp0.add(ellipse);// Add annotation and save to file
annotator.add(tmp0);SaveOptionstmp1=newSaveOptions();tmp1.setOnlyAnnotatedPages(true);annotator.save(outputPath,tmp1);}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.