Overview
Use events and notifications to synchronize application state, trigger custom workflows, or replace selected built-in UI behaviors.
The Flutter SDK exposes events in two ways:
- Reader callbacks: Pass callbacks directly to
CPDFReaderWidgetwhen creating the reader. Use these for reader lifecycle, viewer UI, style dialog, custom menu, annotation action, and form widget action callbacks. - Listener events: Register events with
CPDFReaderWidgetController.addEventListener()after the reader is created. Use these for annotation, form, and content editor object lifecycle events.
Event Summary
| Category | API | Trigger Timing |
|---|---|---|
| Viewer | onPageChanged | Current page changes |
| Viewer | onSaveCallback | Document save completes |
| Viewer | onFillScreenChanged | Fullscreen state changes |
| Viewer | onTapMainDocAreaCallback | Main PDF page area is tapped |
| Viewer | onPageEditDialogBackPress | Back button in page edit dialog is tapped |
| Viewer | onIOSClickBackPressed | iOS top-left reader back button is tapped |
| Viewer | onSearchBackButtonTappedCallback | Search view back button is tapped |
| Viewer | onAddWatermarkDialogDismissedCallback | Add watermark dialog is dismissed |
| Annotations | onAnnotationCreationPreparedCallback | Signature, stamp, link, image, or Note creation is prepared |
| Annotations | onAnnotationStyleDialogDismissedCallback | Annotation style dialog is dismissed |
| Annotations | onInterceptAnnotationActionCallback | Existing Note or Link annotation is tapped and interception is enabled |
| Annotations | CPDFEvent.annotationsCreated | Annotation is created |
| Annotations | CPDFEvent.annotationsSelected | Annotation is selected |
| Annotations | CPDFEvent.annotationsDeselected | Annotation is deselected |
| Annotations | CPDFEvent.pencilDrawingCompleted | iOS Pencil drawing is completed |
| Annotations | CPDFEvent.pencilDrawingDiscarded | iOS Pencil drawing is discarded |
| Forms | onFormStyleDialogDismissedCallback | Form style dialog is dismissed |
| Forms | onInterceptWidgetActionCallback | A configured form widget is tapped and interception is enabled |
| Forms | CPDFEvent.formFieldsCreated | Form field is created |
| Forms | CPDFEvent.formFieldsSelected | Form field is selected |
| Forms | CPDFEvent.formFieldsDeselected | Form field is deselected |
| Content Editor | onContentEditorStyleDialogDismissedCallback | Content editor style dialog is dismissed |
| Content Editor | CPDFEvent.editorSelectionSelected | Editable content is selected |
| Content Editor | CPDFEvent.editorSelectionDeselected | Editable content is deselected |
| Custom Context Menu | onCustomContextMenuItemTappedCallback | Custom context menu item is tapped |
| Custom Toolbar Menu | onCustomToolbarItemTappedCallback | Custom toolbar item is tapped |
Guides
Viewer Listen to page changes, document saves, fullscreen toggles, back button clicks, and related viewer UI events.
Annotations Listen to annotation creation, style dialog, action interception, selection, and iOS Pencil drawing events.
Forms Listen to form field style dialog, creation, selection, and deselection events.
Content Editor Listen to content editor style dialog and editable content selection events.
Custom Context Menu Listen to custom context menu item tap events.
Custom Toolbar Menu Listen to custom top toolbar menu item tap events.
Custom Note Annotation Creation Dialog Disable the default Note edit dialog after creation and present your own Flutter editing UI.