Guides
注释工具栏
注释模式下,底部会显示注释工具栏(CAnnotationToolbar),供用户选择注释类型和工具。通过 AnnotationsConfig 可配置可用的注释类型、工具按钮及行为开关。
可用注释类型
availableTypes 控制注释工具栏中显示的注释类型按钮。未在列表中的类型将被隐藏:
json
{
"annotationsConfig": {
"availableTypes": [
"note",
"highlight",
"underline",
"squiggly",
"strikeout",
"ink",
"ink_eraser",
"circle",
"square",
"arrow",
"line",
"freetext",
"signature",
"stamp",
"pictures",
"link",
"sound"
]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
注释类型说明
| 值 | 说明 |
|---|---|
note | 便签注释 |
highlight | 高亮 |
underline | 下划线 |
squiggly | 波浪线 |
strikeout | 删除线 |
ink | 手写/画笔 |
ink_eraser | 橡皮擦 |
circle | 圆形/椭圆 |
square | 矩形 |
arrow | 箭头 |
line | 直线 |
freetext | 文本框 |
signature | 手写签名 |
stamp | 图章 |
pictures | 图片注释 |
link | 链接 |
sound | 音频注释 |
如果只需高亮和手写功能:
json
{
"annotationsConfig": {
"availableTypes": [
"highlight",
"ink"
]
}
}1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
可用工具
availableTools 控制注释工具栏右侧的工具按钮:
json
{
"annotationsConfig": {
"availableTools": [
"setting",
"undo",
"redo"
]
}
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
| 值 | 说明 |
|---|---|
setting | 属性设置按钮,点击打开当前注释类型的属性编辑面板 |
undo | 撤销 |
redo | 重做 |
如果工具列表为空,工具区域 UI 将被隐藏。
注释作者
json
{
"annotationsConfig": {
"annotationAuthor": "Guest"
}
}1
2
3
4
5
2
3
4
5
创建注释时将使用此名称作为注释作者。
行为开关
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
autoShowSignPicker | boolean | true | 选中签名工具后是否自动弹出签名选择器 |
autoShowStampPicker | boolean | true | 选中图章工具后是否自动弹出图章选择器 |
autoShowPicPicker | boolean | true | 选中图片工具后是否自动弹出图片选择器 |
autoShowLinkDialog | boolean | true | 创建链接注释后是否自动弹出链接编辑对话框 |
interceptNoteAction | boolean | false | 是否拦截便签注释的默认点击行为(拦截后可通过回调自定义处理) |
interceptLinkAction | boolean | false | 是否拦截链接注释的默认点击行为 |
json
{
"annotationsConfig": {
"autoShowSignPicker": true,
"autoShowStampPicker": true,
"autoShowPicPicker": true,
"autoShowLinkDialog": true,
"interceptNoteAction": false,
"interceptLinkAction": false
}
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
CAnnotationToolbar 组件
CAnnotationToolbar 是注释工具栏的核心 UI 组件,位于 com.compdfkit.tools.annotation.pdfannotationbar 包中。
相关类:
| 类 | 说明 |
|---|---|
CAnnotationToolbar | 注释工具栏主视图 |
CPDFAnnotationToolListAdapter | 注释类型列表适配器 |
CAnnotToolBean | 注释工具项数据模型 |
CAnnotationToolDatas | 注释工具栏数据源 |
在使用源码集成时,可直接修改这些类以实现更深度的定制。