PDF 生成模板编辑器
开源可视化 PDF 生成引擎,支持自定义模板,并提供面向开发者的 API,灵活构建文档生成流程。
CPDFView查看器支持右击菜单功能,在CPDFView区域内右击鼠标会弹出自定义菜单,您可以为用户在不同的情境下设置不同的自定义菜单,例如右击空白区域设置页面缩放比例,右击文字、图片或注释进行复制等。
以下是设置自定义菜单的步骤:
CPDFViewerTool 上创建上下文菜单并添加菜单项(复制、剪切、粘贴、删除)。以下是设置自定义菜单的示例代码:
// 注册自定义菜单事件
toolManager.MouseRightButtonDownHandler += ToolManager_MouseRightButtonDownHandler;
private void ToolManager_MouseRightButtonDownHandler(object sender, MouseEventObject e)
{
// 在 CPDFViewerTool 创建上下文菜单, 并添加菜单项(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;
}