# Save only annotated pages The page describes how to save only annotated pages when using GroupDocs.Annotation for Java API. To export the annotated pages only, follow these steps: 1. Instantiate the [Annotator](https://reference.groupdocs.com/java/annotation/com.groupdocs.annotation/Annotator) class. Specify the input document path or stream. 2. Instantiate the [SaveOptions](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.options.export/saveoptions/) class. Call the [setOnlyAnnotatedPages](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.options.export/saveoptions/#setOnlyAnnotatedPages-boolean-) to set the property to `true`. 3. Call the [save()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#save--) method with the output document path or stream. Specify the [SaveOptions](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.options.export/saveoptions/) class as a parameter. The following code snippet shows how to save only annotated pages: {{< tabs "example1">}} {{< tab "Java" >}} ```java // This example demonstrates saving result document with specified pages. // Create an instance of Annotator class Annotator annotator = new Annotator("inputPath"); try { // Create an instance of AreaAnnotation class and set options AreaAnnotation area = new AreaAnnotation(); area.setBox(new Rectangle(100, 100, 100, 100)); area.setBackgroundColor(65535); area.setPageNumber(1); // Create an instance of EllipseAnnotation class and set options EllipseAnnotation ellipse = new EllipseAnnotation(); ellipse.setBox(new Rectangle(100, 100, 100, 100)); ellipse.setBackgroundColor(123456); ellipse.setPageNumber(2); List tmp0 = new ArrayList(); tmp0.add(area); tmp0.add(ellipse); // Add annotation and save to file annotator.add(tmp0); SaveOptions tmp1 = new SaveOptions(); tmp1.setOnlyAnnotatedPages(true); annotator.save(outputPath, tmp1); } finally { if (annotator != null) { annotator.dispose(); } } ``` {{< /tab >}} {{< /tabs >}}