<dependency>
<groupId>com.groupdocs</groupId>
<artifactId>groupdocs-annotation</artifactId>
<version>23.8</version>
</dependency>
compile(group: 'com.groupdocs', name: 'groupdocs-annotation', version: '23.8')
<dependency org="com.groupdocs" name="groupdocs-annotation" rev="23.8">
<artifact name="groupdocs-annotation" ext="jar"/>
</dependency>
libraryDependencies += "com.groupdocs" % "groupdocs-annotation" % "23.8"
GroupDocs.Annotation for Java 23.8 中的新功能
概览
GroupDocs.Annotation for Java 的 23.8 版本带来了一个重要的新功能以及关键的错误修复。本次更新增强了文档的可用性和交互性,并确保文档和 API 参考是最新的。
主要功能
向文档添加组件
- 按钮组件: 现在可以在文档中嵌入交互式按钮,增强用户互动。
- 下拉列表组件: 创建下拉列表,以便更好地收集数据和用户自定义。
- 复选框组件: 在文档中引入复选框,用于任务跟踪或条件互动。
修复
- 波浪线注释文档: 缺少的波浪线注释文章已恢复到文档中,为用户提供了详细的使用指南。
- API 参考更新: 所有 API 参考都已更新,确保用户可以访问最新信息。
代码示例
添加按钮组件
以下代码片段演示了如何向 PDF 文档添加一个按钮组件。按钮可以通过位置、边框样式、颜色等各种属性进行自定义,还可以包含评论。
try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
// 实例化一个 ButtonComponent 并设置其属性
ButtonComponent buttonComponent = new ButtonComponent();
buttonComponent.setCreatedOn(new Date()); // 设置创建日期
buttonComponent.setStyle(BorderStyle.DASHED); // 将边框样式设置为虚线
buttonComponent.setMessage("这是一个按钮组件"); // 设置按钮的标签文本
buttonComponent.setBorderColor(1422623); // 设置边框颜色
buttonComponent.setPenColor(14527697); // 设置笔(框架)颜色
buttonComponent.setButtonColor(10832612); // 设置按钮的填充颜色
buttonComponent.setPageNumber(0); // 指定按钮将放置在哪一页
buttonComponent.setBorderWidth(12); // 设置按钮边框的宽度
buttonComponent.setBox(new Rectangle(100, 300, 90, 30)); // 设置按钮的位置和大小
// 向按钮添加评论(回复)
Reply reply1 = new Reply();
reply1.setComment("第一条评论");
reply1.setRepliedOn(new Date());
Reply reply2 = new Reply();
reply2.setComment("第二条评论");
reply2.setRepliedOn(new Date());
List<Reply> replies = new ArrayList<>();
replies.add(reply1);
replies.add(reply2);
buttonComponent.setReplies(replies); // 将回复附加到按钮上
// 将按钮组件添加到文档中
annotator.add(buttonComponent);
// 保存包含按钮组件的修改后的文档
annotator.save("result_button_component.pdf");
}
添加复选框组件
此代码片段显示了如何向 PDF 文档添加一个复选框组件。复选框可以通过是否选中、颜色和样式等属性进行自定义。
try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
// 实例化一个 CheckBoxComponent 并设置其属性
CheckBoxComponent checkbox = new CheckBoxComponent();
checkbox.setChecked(true); // 将复选框设置为选中
checkbox.setBox(new Rectangle(100, 100, 100, 100)); // 设置复选框的位置和大小
checkbox.setPenColor(65535); // 设置笔(框架)颜色
checkbox.setStyle(BoxStyle.STAR); // 设置复选框样式(例如,星形)
// 向复选框添加评论(回复)
Reply reply1 = new Reply();
reply1.setComment("第一条评论");
reply1.setRepliedOn(new Date());
Reply reply2 = new Reply();
reply2.setComment("第二条评论");
reply2.setRepliedOn(new Date());
List<Reply> replies = new ArrayList<>();
replies.add(reply1);
replies.add(reply2);
checkbox.setReplies(replies); // 将回复附加到复选框上
// 将复选框组件添加到文档中
annotator.add(checkbox);
// 保存包含复选框组件的修改后的文档
annotator.save("result_checkbox_component.pdf");
}
添加下拉组件
以下代码展示了如何向 PDF 文档添加一个下拉(组合框)组件。该组件可以包含可选项列表,其外观可以通过边框样式和颜色等属性进行自定义。
try(final Annotator annotator = new Annotator(Constants.INPUT_PDF)) {
// 实例化一个 DropdownComponent 并设置其属性
DropdownComponent dropdownComponent = new DropdownComponent();
dropdownComponent.setOptions(new ArrayList<>(Arrays.asList("选项1", "选项2", "选项3"))); // 设置下拉选项
dropdownComponent.setSelectedOption(null); // 默认情况下未选择任何选项
dropdownComponent.setPlaceholder("选择选项"); // 设置占位符文本
dropdownComponent.setBox(new Rectangle(100, 100, 100, 100)); // 设置下拉的位置和大小
dropdownComponent.setCreatedOn(new Date()); // 设置创建日期
dropdownComponent.setMessage("这是一个下拉组件"); // 设置下拉的标签文本
dropdownComponent.setPageNumber(0); // 指定页码
dropdownComponent.setPenColor(65535); // 设置笔(框架)颜色
dropdownComponent.setPenStyle(PenStyle.DOT); // 将框架线样式设置为点状
dropdownComponent.setPenWidth((byte) 3); // 将框架线宽度设置为像素
// 向下拉菜单添加评论(回复)
List<Reply> replies = new ArrayList<>();
Reply reply1 = new Reply();
reply1.setComment("第一条评论");
reply1.setRepliedOn(new Date());
Reply reply2 = new Reply();
reply2.setComment("第二条评论");
reply2.setRepliedOn(new Date());
replies.add(reply1);
replies.add(reply2);
dropdownComponent.setReplies(replies); // 将回复附加到下拉菜单上
// 将下拉组件添加到文档中
annotator.add(dropdownComponent);
// 保存包含下拉组件的修改后的文档
annotator.save("result_dropdown_component.pdf");
}
🔍 探索完整的发布详情
要查看此版本中引入的所有新功能、增强功能和错误修复的完整列表,请访问 **[GroupDocs.Annotation for Java
23.8 发布说明](https://releases.groupdocs.com/annotation/java/release-notes/2023/groupdocs-annotation-for-java-23-8-release-notes/)** 页面。
Version | Release Date |
---|---|
24.6 | 2024年6月30日 |
23.10 | 2023年10月9日 |
23.8 | 2023年8月28日 |
23.6 | 2023年6月23日 |
23.4 | 2023年4月17日 |
23.2 | 2023年4月16日 |
21.7.2 | 2022年1月25日 |
21.7.1 | 2022年1月25日 |
2.0.0 | 2022年1月25日 |
19.2 | 2022年1月25日 |
17.10 | 2022年1月25日 |
17.10.3 | 2022年1月25日 |
1.5.0 | 2022年1月25日 |
21.7 | 2021年7月21日 |
19.7 | 2020年2月19日 |
20.2 | 2020年2月13日 |
19.5 | 2019年5月30日 |
19.4 | 2019年4月15日 |
18.1 | 2018年10月16日 |
18.10 | 2018年10月16日 |
1.4.0 | 2018年4月18日 |
1.6.0 | 2018年4月18日 |
1.7.0 | 2018年4月18日 |
1.7.1 | 2018年4月18日 |
1.8.0 | 2018年4月18日 |
1.8.1 | 2018年4月18日 |
1.8.2 | 2018年4月18日 |
1.9.0 | 2018年4月18日 |
17.1.0 | 2018年4月18日 |
17.10.1 | 2018年4月18日 |
17.10.2 | 2018年4月18日 |
17.5.0 | 2018年4月18日 |
17.6.0 | 2018年4月18日 |
18.4 | 2018年4月18日 |
3.1.0 | 2018年4月18日 |
File | Classifier | Size |
---|---|---|
groupdocs-annotation-23.8-javadoc.jar | javadoc | 616 KB |
groupdocs-annotation-23.8.jar | 218 MB | |
groupdocs-annotation-23.8.pom | 3 KB |
GroupDocs.Annotation Java API 文档注释 水印 文档管理 PDF 注释 Word 注释 Excel 注释 PowerPoint 注释 图像注释 OLE 支持 元数据管理 跨平台兼容性 文本注释 区域注释 标记注释 距离测量 涂黑 自定义注释外观 协作文档审查 文档安全 元数据保护 批处理 高性能 可扩展性 跨平台 打印注释 Microsoft Word Microsoft Excel Microsoft PowerPoint PDF JPG PNG BMP DWG DXF Visio Adobe 便携文档格式 超文本标记语言 电子邮件 注释工具 Java Maven API 集成 本地 API 文档比较 文档完整性