iOS
ComPDFKit PDF SDK
Guides

Customize the Context Menu

 

You can rewrite the menuItemsEditingAtPoint:forPage: of CPDFView in the opened PDF preview to set the options of the context menu, which returns to copy, delete, paste, etc. by default. After completing these options, you can copy, paste, cut, or delete text as in Microsoft Word. The following code will show you how to do this.

 

- (NSArray *)menuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page {
    NSArray * items = [super menuItemsEditingAtPoint:point forPage:page];
    NSMutableArray *menuItems = [NSMutableArray array];
    if (items)
        [menuItems addObjectsFromArray:items];
    
    return menuItems;
}