Versioning of annotated documents
Leave feedback
On this page
When you save a file using the 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 custom version names.
By default, GroupDocs.Annotations names version using a GUID. If needed, you can specify a custom version name.
You can specify a custom version name.
The following code snippet shows how to save version with custom name:
using (Annotator annotator = new Annotator("input.pdf"))
{
annotator.Update(new AreaAnnotation{ Box = new Rectangle(100, 100, 100, 100) });
annotator.Save("result.pdf", new SaveOptions { Version = "CUSTOM_VERSION" });
}
NoteThe Version property is object.
To get the list of version keys, call the GetVersionsList method of the Annotator class.
The following code snippet shows how to get list of versions keys:
using (Annotator annotator = new Annotator("result.pdf")) {
List<object> versionKeys = annotator.GetVersionsList();
}
NoteThe Annotator.GetVersionList() method returns list of objects. If needed, you can convert them to appropriate type.
To get the list of annotations in a specific version, call the Annotator.GetVersion() method of the Annotator class.
The following code snippets shows how to get list of annotations in a specific version:
using (Annotator annotator = new Annotator("result.pdf"))
{
List<AnnotationBase> annotations = annotator.GetVersion("CUSTOM_VERSION");
}
NoteThe GetVersion method returns list of objects. If needed, you can convert them to appropriate type.
To load a specific version of a file, specify the LoadOptions.Version property.
The following code snippets shows how load version using version property:
using (Annotator annotator = new Annotator($"result.{ext}", new LoadOptions { Version = "CUSTOM_VERSION" }))
{
annotator.Save("result_loaded.pdf");
}
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.