On this page
Context Menu
When creating a CPDFReaderWidget, you can customize the context menus that appear when annotations, text, images, or form fields are selected. This is done via the CPDFConfiguration object using the contextMenuConfig field.
Default Context Menu
By default, when a user selects a highlight annotation, ComPDFKit displays a context menu with common options such as “Note”, “Delete”, and “Properties”:
Android | iOS |
---|---|
![]() | ![]() |
Customizing Menu Items
You can customize the context menu by specifying which menu items to include. The following example only keeps the Properties and Delete options for highlight annotations:
dart
CPDFReaderWidget(
document: widget.documentPath,
password: widget.password,
configuration: CPDFConfiguration(
contextMenuConfig: const CPDFContextMenuConfig(
annotationMode: CPDFAnnotationModeContextMenu(
markup: [
CPDFContextMenuItem(CPDFAnnotationMarkupMenuKey.properties),
CPDFContextMenuItem(CPDFAnnotationMarkupMenuKey.delete),
]
)
)
),
onCreated: (controller) {
},
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Android | iOS |
---|---|
![]() | ![]() |
For full customization details, refer to the documentation: CONFIGURATION.md - contextMenuConfig