# Versioning of annotated documents The page describes how to manage different versions of document using GroupDocs.Annotation for Java API. When you save a file using the [Annotator.save()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#save--) method, the GroupDocs.Annotations creates a version of the annotated file. Versions list keeps annotations that you add, remove, and change. You can swap between different changes made with GroupDocs.Annotation. If needed, you can set your version names. By default, GroupDocs.Annotations names version using a GUID. You can specify a custom version name. ### Add version with custom name You can specify a custom version name. The following code snippet shows how to save version with custom name: {{< tabs "example1">}} {{< tab "Java" >}} ```java // This example demonstrates how to add version. // Create an instance of Annotator class try (Annotator annotator = new Annotator("input.pdf")) { // Create an instance of AreaAnnotation class and set options AreaAnnotation areaAnnotation = new AreaAnnotation(); areaAnnotation.setBox(new Rectangle(100, 100, 100, 100)); annotator.update(areaAnnotation); SaveOptions saveOptions = new SaveOptions(); saveOptions.setVersion("CUSTOM_VERSION"); // Save to file annotator.save("result.pdf", saveOptions); } ``` {{< /tab >}} {{< /tabs >}} {{< alert style="info" >}} The [Version](https://reference.groupdocs.com/java/annotation/com.groupdocs.annotation.options/saveoptions/) property is object. {{< /alert >}} ## Get the list of version keys of a file To get the list of version keys, call the [Annotator.getVersionsList()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#getVersionsList--) method of the [Annotator](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/) class. The following code snippet shows how to get list of versions keys: {{< tabs "example2">}} {{< tab "Java" >}} ```java // This example demonstrates how to get list of all version keys on a document. // Create an instance of Annotator class try (Annotator annotator = new Annotator("input.pdf")) { // Get versions list from annotated file List versionKeys = annotator.getVersionsList(); } ``` {{< /tab >}} {{< /tabs >}} {{< alert style="info" >}} The [Annotator.getVersionsList()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#getVersionsList--) method returns list of objects. If needed, you can convert them to appropriate type. {{< /alert >}} ## Get the list of annotations using version key To get the list of annotations in a specific version, call the [Annotator.getVersion()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#getVersion-java.lang.Object-) method of the [Annotator](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/) class. The following code snippets shows how to get list of annotations in a specific version: {{< tabs "example3">}} {{< tab "Java" >}} ```java // This example demonstrates how get list of annotations using version key. // Create an instance of Annotator class try (Annotator annotator = new Annotator("input.pdf")) { // Get versions list from annotated file by CUSTOM_VERSION List annotations = annotator.getVersion("CUSTOM_VERSION"); } ``` {{< /tab >}} {{< /tabs >}} {{< alert style="info" >}} The [Annotator.getVersion](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation/annotator/#getVersion-java.lang.Object-) method returns list of objects. If needed, you can convert them to appropriate type. {{< /alert >}} ## Load a specific file version To load a specific version of a file, call the [LoadOptions.version()](https://reference.groupdocs.com/annotation/java/com.groupdocs.annotation.options/loadoptions/#setVersion-java.lang.Object-) method and specify the version key. The following code snippets shows how load version using version property: {{< tabs "example4">}} {{< tab "Java" >}} ```java // This example demonstrates how to load document of custom version. // Create an instance of Annotator class and set custom version LoadOptions loadOptions = new LoadOptions(); loadOptions.setVersion("CUSTOM_VERSION"); // Create an instance of Annotator class try (Annotator annotator = new Annotator("input.pdf", loadOptions)) { // Save to file annotator.save("result_loaded.pdf"); } ``` {{< /tab >}} {{< /tabs >}}