Example of Context Menu in React PDF Viewer Component

/
/
CustomContextMenu

Explore how to tailor context menus for PDF pages, annotations, and form fields in this sample.

More Details...

Loading....
Description

This customization empowers users to add new context menus on PDF pages, annotations, and form fields. In this sample:

  • Selecting text on pages reveals a custom context menu, enabling users to search for the selected text on Google.
  • Annotations and Form fields can be locked directly from the context menu.
  • Customization is achieved using the following APIs:
    • Customize the context menu by selectively displaying custom options, hiding existing menu items, controlled by boolean parameters in the addCustomMenu() method.
    • Position custom menu items either above or below existing ones, adjusting boolean parameters in the addCustomMenu() method.
    • Tailor the visibility of custom menu items using the customContextMenuBeforeOpen event.
    • Implement specific functionalities for custom options through the customContextMenuSelect event.

More information on the PDF Viewer instantiation can be found in this documentation section .