<dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-annotation</artifactId>
    <version>23.8</version>
</dependency>
copied!  
compile(group: 'com.groupdocs', name: 'groupdocs-annotation', version: '23.8')
copied!  
<dependency org="com.groupdocs" name="groupdocs-annotation" rev="23.8">
    <artifact name="groupdocs-annotation" ext="jar"/>
</dependency>
copied!  
libraryDependencies += "com.groupdocs" % "groupdocs-annotation" % "23.8"
copied!  

Product Docs Demos API Ref Examples Blog Support License

What’s new in the GroupDocs.Annotation for Java 23.8

Overview

The 23.8 release of GroupDocs.Annotation for Java brings a valuable new feature along with crucial bug fixes. This update enhances the usability and interactivity of your documents and ensures that the documentation and API references are up-to-date.

Major Features

Add Component to Document

  • Button Component: Interactive buttons can now be embedded within your documents, enhancing user interaction.
  • Dropdown Component: Create dropdown lists for better data collection and user customization.
  • Checkbox Component: Introduce checkboxes for task tracking or conditional interactions within documents.

Fixes

  • Squiggly Annotation Documentation: The missing squiggly annotation article has been restored in the documentation, providing users with detailed guidance on its usage.
  • API References Updated: All API references have been actualized to ensure users have access to the latest information.

Code Samples

Adding a Button Component

The following code snippet demonstrates how to add a button component to a PDF document. The button can be customized with various properties like position, border style, color, and even include comments.

try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
    // Instantiate a ButtonComponent and set its properties
    ButtonComponent buttonComponent = new ButtonComponent();
    buttonComponent.setCreatedOn(new Date()); // Set the creation date
    buttonComponent.setStyle(BorderStyle.DASHED); // Set border style to dashed
    buttonComponent.setMessage("This is button component"); // Set the button's label text
    buttonComponent.setBorderColor(1422623); // Set the border color
    buttonComponent.setPenColor(14527697); // Set the pen (frame) color
    buttonComponent.setButtonColor(10832612); // Set the button's fill color
    buttonComponent.setPageNumber(0); // Specify the page number where the button will be placed
    buttonComponent.setBorderWidth(12); // Set the width of the button border
    buttonComponent.setBox(new Rectangle(100, 300, 90, 30)); // Set the position and size of the button

    // Add comments (replies) to the button
    Reply reply1 = new Reply();
    reply1.setComment("First comment");
    reply1.setRepliedOn(new Date());

    Reply reply2 = new Reply();
    reply2.setComment("Second comment");
    reply2.setRepliedOn(new Date());

    List<Reply> replies = new ArrayList<>();
    replies.add(reply1);
    replies.add(reply2);

    buttonComponent.setReplies(replies); // Attach the replies to the button

    // Add the button component to the document
    annotator.add(buttonComponent);

    // Save the modified document with the button component
    annotator.save("result_button_component.pdf");
}

Source*

Adding a Checkbox Component

This code snippet shows how to add a checkbox component to a PDF document. The checkbox can be customized with properties such as whether it is checked, its color, and style.

try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
    // Instantiate a CheckBoxComponent and set its properties
    CheckBoxComponent checkbox = new CheckBoxComponent();
    checkbox.setChecked(true); // Set the checkbox as checked
    checkbox.setBox(new Rectangle(100, 100, 100, 100)); // Set the position and size of the checkbox
    checkbox.setPenColor(65535); // Set the pen (frame) color
    checkbox.setStyle(BoxStyle.STAR); // Set the checkbox style (e.g., star-shaped)

    // Add comments (replies) to the checkbox
    Reply reply1 = new Reply();
    reply1.setComment("First comment");
    reply1.setRepliedOn(new Date());

    Reply reply2 = new Reply();
    reply2.setComment("Second comment");
    reply2.setRepliedOn(new Date());

    List<Reply> replies = new ArrayList<>();
    replies.add(reply1);
    replies.add(reply2);

    checkbox.setReplies(replies); // Attach the replies to the checkbox

    // Add the checkbox component to the document
    annotator.add(checkbox);

    // Save the modified document with the checkbox component
    annotator.save("result_checkbox_component.pdf");
}

Source*

Adding a Dropdown Component

The following code demonstrates how to add a dropdown (combo box) component to a PDF document. This component can hold a list of selectable options, and its appearance can be customized with properties like border style and color.

try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
    // Instantiate a DropdownComponent and set its properties
    DropdownComponent dropdownComponent = new DropdownComponent();
    dropdownComponent.setOptions(new ArrayList<>(Arrays.asList("Item1", "Item2", "Item3"))); // Set dropdown options
    dropdownComponent.setSelectedOption(null); // No option selected by default
    dropdownComponent.setPlaceholder("Choose option"); // Set placeholder text
    dropdownComponent.setBox(new Rectangle(100, 100, 100, 100)); // Set the position and size of the dropdown
    dropdownComponent.setCreatedOn(new Date()); // Set the creation date
    dropdownComponent.setMessage("This is dropdown component"); // Set the dropdown's label text
    dropdownComponent.setPageNumber(0); // Specify the page number
    dropdownComponent.setPenColor(65535); // Set the pen (frame) color
    dropdownComponent.setPenStyle(PenStyle.DOT); // Set the frame line style (dotted)
    dropdownComponent.setPenWidth((byte) 3); // Set the frame line width in pixels

    // Add comments (replies) to the dropdown
    List<Reply> replies = new ArrayList<>();
    Reply reply1 = new Reply();
    reply1.setComment("First comment");
    reply1.setRepliedOn(new Date());

    Reply reply2 = new Reply();
    reply2.setComment("Second comment");
    reply2.setRepliedOn(new Date());

    replies.add(reply1);
    replies.add(reply2);

    dropdownComponent.setReplies(replies); // Attach the replies to the dropdown

    // Add the dropdown component to the document
    annotator.add(dropdownComponent);

    // Save the modified document with the dropdown component
    annotator.save("result_dropdown_component.pdf");
}

Source*

🔍 Explore the Full Release Details

To view the complete list of all new features, enhancements, and bug fixes introduced in this release, please visit the GroupDocs.Annotation for Java 23.8 Release Notes.

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