Skip to content
ComPDF
DemoFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub
Guides

Custom Toolbar Menu

The SDK supports custom top-toolbar items and custom More-menu items, with callback support for user interaction.

For information on how to configure and add custom toolbar menu items, please refer to Main Toolbar.

Listen to Custom Toolbar Menu Item Click Events

When creating CPDFReaderWidget, you can set the onCustomToolbarItemTappedCallback callback to listen to custom toolbar menu item click events. For example:

dart
CPDFReaderWidget(
  document: documentPath,
  configuration: configuration,
  onCreated: (controller) {},
  onCustomToolbarItemTappedCallback: (String identifier) {
    debugPrint('Custom toolbar menu item tapped: $identifier');
    // Handle custom toolbar menu item click logic here
  },
);

Note: Only custom top-toolbar and More-menu items trigger this callback. Clicks on ComPDF's built-in toolbar items do not trigger it.