Annotations are commonly used for pointing out observations in documents. These can also be used for providing feedback while discussion. Earlier, we discussed, the Java way to add different annotations to PDF documents. This article discusses how to remove annotations from documents like PDF and Word DOC/DOCX files in Java.

The following topics are discussed below:

Java API for Annotations

GroupDocs have Java API that allows dealing with annotations within various documents and images. It allows adding, deleting, and extraction of annotations from PDF, Word, and many other types of documents. You can visit the documentation for the complete list of supported document formats for annotation.

Download or Configure

Download the JAR file from the downloads section, or just get the latest repository and dependency configurations for the pom.xml of your maven-based Java applications.

<repository>
	<id>GroupDocsJavaAPI</id>
	<name>GroupDocs Java API</name>
	<url>http://repository.groupdocs.com/repo/</url>
</repository>
<dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-annotation</artifactId>
        <version>21.7.2</version> 
</dependency>

Remove All Annotations from PDF & Word documents in Java

There are ways to remove annotations from documents. All the annotations can be removed at once. You can remove specific annotation(s) by providing ID(s), or remove specific annotation by providing the annotation object. For other options, visit the documentation.

The following are the steps to remove all the annotations from PDF and Word DOC/DOCX document(s) in Java.

The following Java code shows how to remove annotations from PDF or Word files.

Remove Annotation by IDs in Java

Likewise, you can provide annotation ID(s) to get rid of the unwanted annotations from the documents. It’s just about preparing and providing the list of IDs to eliminate the listed annotation(s). The following Java code shows how to remove the annotation(s) from PDF or Word documents by providing the ID(s).

Remove Annotation by Annotation Object in Java

You can also get rid of the specific annotation by proving the Annotation object. In order to delete annotations, the following Java code removes the annotation(s) from PDF or Word documents by using annotation objects.

Conclusion

To summarize, you learned to remove annotations from the documents within Java applications. Initially, we removed all the annotations from PDF & Word documents. Later we eliminated annotations by providing IDs and also by proving the annotation objects. Try building your own document annotations remover Java application using GroupDocs.Annotation for Java. Learn more about the API from the documentation and the GitHub repository. For further queries, contact the support on the forum.

See Also