Some test text!
It is possible to customize the popup annotation menu on the viewer by adding or removing options when creating, selecting and editing annotations.
The sample code below shows how to replace the Delete button for a custom one by listening to OnShowPopupMenu
and checking the ShowingPopupMenuEventArgs
.
// Subscrive to OnShowPopupMenu event
ToolManager.OnShowPopupMenu += ToolManager_OnShowPopupMenu;
// Raised event
private void ToolManager_OnShowPopupMenu(PopupCommandMenu menu, ToolManager.ShowingPopupMenuEventArgs eventArgs)
{
// Check if tool type is Editing Annotation
if (eventArgs.ToolType == ToolType.e_annot_edit)
{
// Check if annotation type is Square
if (eventArgs.AnnotType == AnnotType.e_Square)
{
// Find Delete button and remove it
menu.MenuItems.Remove(menu.MenuItems.Where(x => x.Tag.ToString() == "delete").FirstOrDefault());
// Create a custom button with a custom event/action
Button button = new Button();
button.Content = "Click Me";
button.Click += Button_Click;
/* It accepts a bool parameter that tells if should use
* default style or not on the newly added button */
menu.AddMenuItem(button, true);
}
}
}
private void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
// my actions
}
Default Menu Options | Customized Menu Options |
---|---|
![]() | ![]() |
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Web
Android
iOS
Windows
Linux
Unlimited usage. No email address required.