Skip to content

Context Menu

When creating a CPDFReaderView, 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”:

AndroidiOS
flutter_android_3.4.7-7flutter_android_3.4.7-7

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:

tsx
<CPDFReaderView
  ref={pdfReaderRef}
  document={samplePDF}
  configuration={ComPDFKit.getDefaultConfig({
    contextMenuConfig:{
      annotationMode: {
        markupContent: menus('properties', 'delete')
      }
    }
  })} />
AndroidiOS
flutter_android_3.4.7-7flutter_android_3.4.7-7

For full customization details, refer to the official documentation: CONFIGURATION.md - contextMenuConfig