PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
The CPDFView supports a right-click menu feature. Right-clicking within the CPDFView area will trigger a custom menu.
You can set different custom menus for users in various contexts. For instance, setting the page zoom level when right-clicking in a blank area, enabling copy options when right-clicking on text, images, or annotations, etc.
The steps for setting up a custom menu are as follows:
CPDFViewerTool and add menu items (Copy, Cut, Paste, Delete).This example shows how to create a custom menu:
// Register custom menu event
toolManager.MouseRightButtonDownHandler += ToolManager_MouseRightButtonDownHandler;
private void ToolManager_MouseRightButtonDownHandler(object sender, MouseEventObject e)
{
// Create a context menu on CPDFViewerTool and add menu items (Copy, Cut, Paste, Delete).
ContextMenu contextMenu = new ContextMenu();
contextMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
contextMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
contextMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
contextMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
CPDFViewerTool tool = sender as CPDFViewerTool;
tool.ContextMenu = contextMenu;
}