<repositories>
   <repository>
      <id>repository.groupdocs.com</id>
      <name>GroupDocs Repository</name>
      <url>https://releases.groupdocs.com/java/repo/</url>
   </repository>
</repositories>

<dependencies>
   <dependency>
      <groupId>com.groupdocs</groupId>
      <artifactId>groupdocs-annotation</artifactId>
      <version>24.6</version>
   </dependency>
</dependencies>
copied!  
repositories {
    maven {
        url 'https://releases.groupdocs.com/java/repo/'
    }
}

compile(group: 'com.groupdocs', name: 'groupdocs-annotation', version: '24.6')
copied!  
<ivysettings>
    <settings defaultResolver="chain"/>
    <resolvers>
        <chain name="chain">
            <ibiblio name="GroupDocs Repository" m2compatible="true" root="https://releases.groupdocs.com/java/repo/"/>
        </chain>
    </resolvers>
</ivysettings>

<dependency org="com.groupdocs" name="groupdocs-annotation" rev="24.6">
   <artifact name="groupdocs-annotation" ext="jar"/>
</dependency>
copied!  
resolvers += Resolver.url("GroupDocs Repository", url("https://releases.groupdocs.com/java/repo/"))

libraryDependencies += "com.groupdocs" % "groupdocs-annotation" % "24.6"
copied!  

Document Annotator Java High Code API

Product Docs Demos API Ref Examples Blog Support License

GroupDocs.Annotation for Java is a robust on-premise API designed for Java developers to annotate, watermark, and manage documents in various formats like PDF, Word®, Excel®, PowerPoint®, and images. It offers advanced features including text, area, and image annotations, OLE support, metadata management, and cross-platform compatibility.

Document Annotation Java On-Premise API Features

Document and Format Support

  • Support for Multiple Document Formats: Annotate various document formats including PDF, Word®, Excel®, PowerPoint®, Visio®, and images (JPG, PNG, BMP, etc.).
  • PDF-Specific Annotations: Support for sticky notes, text fields, and other PDF-specific annotation types.
  • Support for Image Formats: Annotate popular image formats including JPG, PNG, BMP, and more.
  • Annotation Export Formats: Export annotations in different formats for interoperability.
  • OLE Support: Support for OLE objects within annotated documents.
  • Compatibility with Other GroupDocs APIs: Seamless integration with other GroupDocs products for extended functionality.

Annotation Types and Tools

  • Text Annotations: Add text annotations such as highlights, underlines, and strike-throughs.
  • Area Annotations: Highlight and comment on specific areas using rectangle, polygon, and point annotations.
  • Markup Annotations: Apply markup annotations like redaction to hide sensitive content.
  • Distance Measurement: Measure distances within documents, useful for technical drawings and CAD files.
  • Watermarking: Add text and image watermarks for branding or security purposes.
  • Image Annotations: Annotate image files, with support for multiple image formats.

Annotation Management

  • Annotation Replies: Allow multiple users to reply to annotations, enabling collaborative document review.
  • Custom Annotation Appearance: Customize annotation appearance including color, font, and opacity settings.
  • Export/Import Annotations: Export annotations to external files and import them back for sharing or collaboration.
  • Annotation Layering: Control the layering of annotations, enabling annotations to overlap or remain separate.
  • Annotation Handling: Ability to create, edit, and delete annotations programmatically.
  • Annotation Metadata: Annotate documents while preserving metadata integrity.
  • Undo/Redo Support: Implement undo/redo functionality for annotation operations.

Collaboration and Review

  • Collaborative Features: Allow multiple users to annotate, comment, and collaborate on the same document.
  • Document Comparison: Compare documents or images side by side to highlight differences.
  • Annotation Replies: Allow multiple users to reply to annotations, enabling collaborative document review.

Security and Document Integrity

  • Document Security: Apply annotations that can obscure sensitive information, like redactions.
  • Metadata Management: Manage and preserve metadata within annotated documents.

Search and Navigation

  • Advanced Search Capabilities: Search within annotated documents, including the ability to search within annotations.

Performance and Scalability

  • Batch Processing: Handle annotations on multiple documents at once for increased efficiency.
  • Scalability: Designed to handle large volumes of documents and annotations efficiently.
  • High Performance: Optimized for fast processing of annotations and document handling.

Cross-Platform Compatibility and Integration

  • Cross-Platform Compatibility: Use on multiple operating systems, including Windows, macOS, and Linux.
  • Flexible Integration: Easily integrate into Java applications with a rich set of API functionalities.

Output and Presentation

  • Printing and Saving Annotations: Include or exclude annotations when printing or saving documents.

Supported Document Formats

For some file types, GroupDocs.Annotation saves the result in a different format. In this case, the output file type is specified after *. If no such symbol is specified, GroupDocs.Annotation saves the result in the original file type.

FormatDescriptionAnnotate
DOCMicrosoft Word® 97-2003 Document
DOCXMicrosoft Word® Document
DOCMMicrosoft Word® Macro-Enabled Document
DOTMicrosoft Word® 97-2003 Template
DOTXMicrosoft Word® Template
DOTMMicrosoft Word® Macro-Enabled Template
RTFRich Text Document
ODTOpenDocument Text
XLSMicrosoft Excel® 97-2003 Worksheet
XLSXMicrosoft Excel® Worksheet
XLSM (*xlsx)Microsoft Excel® Macro-Enabled Worksheet
XLSB (*xlsx)Microsoft Excel® Binary Worksheet
ODS (*xlsx)OpenDocument Spreadsheet
PPTMicrosoft PowerPoint® 97-2003 Presentation
PPTXMicrosoft PowerPoint® Presentation
PPSMicrosoft PowerPoint® 97-2003 Slide Show
PPSX (*pptx)Microsoft PowerPoint® Slide Show
ODPOpenDocument Presentation
TIF, TIFFTagged Image File Format (TIFF)
JPG, JPEGJoint Photographic Experts Group (JPEG)
PNGPortable Network Graphics (PNG)
BMPBitmap Picture (BMP)
DWG (*png)Autodesk® Design Data Formats
DXF (*png)Drawing Interchange Format
PDF (PDF/A-1a,PDF/A-1b,PDF/A-2a)Adobe Portable Document Format (PDF)
HTM (*html)HyperText Markup Language (HTM)
HTMLHyperText Markup Language (HTML)
EMLE-mail Message (EML)
EMLX (*eml)E-mail Message (EMLX)
VSD (*vsdx)Microsoft Visio® 2003-2010 Drawing
VSDXMicrosoft Visio® Drawing
VSDM (*vsdx)Microsoft Visio® Drawing File Format
VSS (*vsdx)Microsoft Visio® 2003-2010 Stencil
VSSX (*vsdx)Visio® Stencil File Format
VST (*vsdx)Microsoft Visio® 2013 Stencil
VSTM (*vsdx)Microsoft Visio® Template File Format

Supported Annotation Types

Graphic Annotations

  • Area: Marks an area with a rectangle and adds notes to it.
  • Arrow: Draws an arrow in a document.
  • Distance: Measures the distance between objects in a document.
  • Ellipse: Draws an elliptical annotation in a document.
  • Point: Sticks comments to any point in a document.
  • Polyline: Draws shapes and freehand lines.
  • Redaction: Fills a black rectangle with a fixed position (used to hide text).
  • Text Field: Adds a rectangle with text inside.

Text Annotations

  • Highlight: Highlights and comments on selected text.
  • Replacement: Replaces the original text with the user’s text.
  • Strikeout: Marks text with a strike-through styling.
  • Underline: Marks text with an underline styling.

Watermark Annotations

  • Horizontal Watermark: Adds a horizontal text watermark.
  • Diagonal Watermark: Adds a diagonal text watermark.

System Requirements

GroupDocs.Annotation for Java supports following Operating Systems, Frameworks & Package Managers:

Supported Options
Operating SystemsMicrosoft Windows® Desktop
Microsoft Windows® Server
Linux
MacOS
Supported FrameworksJava 7 (1.7) and above
Development EnvironmentsNetBeans
IntelliJ IDEA
Eclipse
Build Automation ToolMaven

GroupDocs.Annotation for Java does not require any external software or third party tool to be installed. Just follow one of the ways as described in Installation and Configuration.

Get Started

GroupDocs hosts all Java APIs at the GroupDocs Repository. You can easily use GroupDocs.Annotation for Java API directly in your Maven projects with simple configurations.

Step 1: Specify GroupDocs Repository Configuration

To start, you need to specify the GroupDocs repository configuration in your Maven pom.xml file as follows:

<repositories>
    <repository>
        <id>GroupDocs Artifact Repository</id>
        <name>GroupDocs Artifact Repository</name>
        <url>https://releases.groupdocs.com/java/repo/</url>
    </repository>
</repositories>

Step 2: Define GroupDocs.Annotation for Java API Dependency

Next, define the GroupDocs.Annotation for Java API dependency in your pom.xml file as follows:

<dependencies>
    <dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-annotation</artifactId>
        <version>23.10</version> 
    </dependency>
</dependencies>

Code Samples

Code Sample 1: Adding a Text Annotation to a PDF Document

This code snippet demonstrates how to use GroupDocs.Annotation for Java to add a text annotation to a PDF document. The text annotation includes a comment or note that appears as a pop-up when the user hovers over the annotated area. This feature is particularly useful for reviewing and commenting on PDF documents.

// Import necessary classes
import com.groupdocs.annotation.Annotator;
import com.groupdocs.annotation.models.Annotation;
import com.groupdocs.annotation.models.annotationtypes.TextAnnotation;
import com.groupdocs.annotation.options.export.AnnotationOptions;

import java.awt.Color;
import java.nio.file.Paths;

public class AddTextAnnotationToPDF {
    public static void main(String[] args) {
        // Path to the input PDF document
        String inputFilePath = "input.pdf";
        
        // Path to the output PDF document
        String outputFilePath = "output.pdf";
        
        // Initialize Annotator object for the PDF document
        Annotator annotator = new Annotator(inputFilePath);
        
        // Create a new text annotation
        TextAnnotation textAnnotation = new TextAnnotation();
        textAnnotation.setPageNumber(1); // Set page number
        textAnnotation.setMessage("This is a text annotation"); // Set annotation message
        textAnnotation.setBox(new Rectangle(100, 100, 200, 50)); // Set position and size of the annotation
        textAnnotation.setBackgroundColor(Color.yellow); // Set background color of the annotation
        textAnnotation.setFontColor(Color.black); // Set font color for the annotation text
        
        // Add the text annotation to the document
        annotator.add(textAnnotation);
        
        // Save the annotated PDF document
        annotator.save(outputFilePath, new AnnotationOptions());
        
        // Close the annotator
        annotator.dispose();
        
        System.out.println("Text annotation added successfully to the PDF document.");
    }
}

Code Sample 2: Removing Annotations from a Word Document

This code snippet illustrates how to remove all annotations from a Microsoft Word document (DOCX) using GroupDocs.Annotation for Java. This is especially useful when you need to clean up a document by removing comments, notes, or other types of annotations.

// Import necessary classes
import com.groupdocs.annotation.Annotator;
import com.groupdocs.annotation.options.remove.RemoveOptions;

public class RemoveAnnotationsFromWordDocument {
    public static void main(String[] args) {
        // Path to the input Word document
        String inputFilePath = "input.docx";
        
        // Path to the output Word document
        String outputFilePath = "output.docx";
        
        // Initialize Annotator object for the Word document
        Annotator annotator = new Annotator(inputFilePath);
        
        // Define remove options to remove all annotations
        RemoveOptions removeOptions = new RemoveOptions();
        
        // Remove all annotations from the document
        annotator.remove(removeOptions);
        
        // Save the cleaned Word document
        annotator.save(outputFilePath);
        
        // Close the annotator
        annotator.dispose();
        
        System.out.println("All annotations removed successfully from the Word document.");
    }
}

Code Sample 3: Extracting Comments from an Excel Spreadsheet

This code snippet showcases how to extract comments and annotations from an Excel spreadsheet (XLSX) using GroupDocs.Annotation for Java. This feature is beneficial for reviewing and summarizing feedback or notes left in an Excel document.

// Import necessary classes
import com.groupdocs.annotation.Annotator;
import com.groupdocs.annotation.models.AnnotationBase;
import com.groupdocs.annotation.options.export.AnnotationOptions;

import java.util.List;

public class ExtractCommentsFromExcel {
    public static void main(String[] args) {
        // Path to the input Excel document
        String inputFilePath = "input.xlsx";
        
        // Initialize Annotator object for the Excel document
        Annotator annotator = new Annotator(inputFilePath);
        
        // Extract all annotations from the document
        List<AnnotationBase> annotations = annotator.get();
        
        // Iterate through the extracted annotations and print their messages
        for (AnnotationBase annotation : annotations) {
            System.out.println("Annotation Type: " + annotation.getAnnotationType());
            System.out.println("Annotation Message: " + annotation.getMessage());
        }
        
        // Close the annotator
        annotator.dispose();
        
        System.out.println("Comments extracted successfully from the Excel spreadsheet.");
    }
}

Product Docs Demos API Ref Examples Blog Support License

VersionRelease Date
24.6June 30, 2024
23.10October 9, 2023
23.8August 28, 2023
23.6June 23, 2023
23.4April 17, 2023
23.2April 16, 2023
21.7.2January 25, 2022
21.7.1January 25, 2022
2.0.0January 25, 2022
19.2January 25, 2022
17.10January 25, 2022
17.10.3January 25, 2022
1.5.0January 25, 2022
21.7July 21, 2021
19.7February 19, 2020
20.2February 13, 2020
19.5May 30, 2019
19.4April 15, 2019
18.1October 16, 2018
18.10October 16, 2018
1.4.0April 18, 2018
1.6.0April 18, 2018
1.7.0April 18, 2018
1.7.1April 18, 2018
1.8.0April 18, 2018
1.8.1April 18, 2018
1.8.2April 18, 2018
1.9.0April 18, 2018
17.1.0April 18, 2018
17.10.1April 18, 2018
17.10.2April 18, 2018
17.5.0April 18, 2018
17.6.0April 18, 2018
18.4April 18, 2018
3.1.0April 18, 2018