Browse Source

代码优化(iOS) - 代码名更改

dinglingui 1 year ago
parent
commit
c4ce16dd4a

+ 14 - 4
Annotations/Annotations.xcodeproj/project.pbxproj

@@ -375,10 +375,15 @@
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = Annotations/Info.plist;
 				INFOPLIST_KEY_CFBundleDisplayName = Annotations_ComPDFKit;
-				INFOPLIST_KEY_NSCameraUsageDescription = "Enable camera access so that you can create scans with your camera.";
+				INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCalendarsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCameraUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSContactsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSMicrophoneUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "Enable camera access so that you can create scans with your camera.";
-				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Enable photo access so that you can create scans with your photos.";
+				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
 				INFOPLIST_KEY_UIMainStoryboardFile = Main;
@@ -411,10 +416,15 @@
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = Annotations/Info.plist;
 				INFOPLIST_KEY_CFBundleDisplayName = Annotations_ComPDFKit;
-				INFOPLIST_KEY_NSCameraUsageDescription = "Enable camera access so that you can create scans with your camera.";
+				INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCalendarsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCameraUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSContactsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSMicrophoneUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "Enable camera access so that you can create scans with your camera.";
-				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Enable photo access so that you can create scans with your photos.";
+				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
 				INFOPLIST_KEY_UIMainStoryboardFile = Main;

+ 6 - 6
ComPDFKit_Tools/ComPDFKit_Tools.xcodeproj/project.pbxproj

@@ -83,7 +83,7 @@
 		4FD34DFA2A0B9DB2005CEAB6 /* UIViewController+LeftItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FD34DF82A0B9DB2005CEAB6 /* UIViewController+LeftItem.m */; };
 		4FECFF6A2A15FBC7008DE530 /* CPDFEditTextSampleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FECFF682A15FBC7008DE530 /* CPDFEditTextSampleView.h */; };
 		4FECFF6B2A15FBC7008DE530 /* CPDFEditTextSampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FECFF692A15FBC7008DE530 /* CPDFEditTextSampleView.m */; };
-		4FF3E1D12A064A8200C14F91 /* CPDFListView+Edit.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FF3E1CF2A064A8100C14F91 /* CPDFListView+Edit.m */; };
+		4FF3E1D12A064A8200C14F91 /* CPDFListView+ContentEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FF3E1CF2A064A8100C14F91 /* CPDFListView+ContentEditor.m */; };
 		4FF895942A1EF05D0045890F /* CPDFFormToolBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FF895912A1EF05D0045890F /* CPDFFormToolBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		4FF895952A1EF05D0045890F /* CPDFFormToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4FF895922A1EF05D0045890F /* CPDFFormToolBar.m */; };
 		4FF895962A1EF05D0045890F /* CPDFFormImage.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4FF895932A1EF05D0045890F /* CPDFFormImage.xcassets */; };
@@ -406,8 +406,8 @@
 		4FD34DF82A0B9DB2005CEAB6 /* UIViewController+LeftItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+LeftItem.m"; sourceTree = "<group>"; };
 		4FECFF682A15FBC7008DE530 /* CPDFEditTextSampleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFEditTextSampleView.h; sourceTree = "<group>"; };
 		4FECFF692A15FBC7008DE530 /* CPDFEditTextSampleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFEditTextSampleView.m; sourceTree = "<group>"; };
-		4FF3E1CF2A064A8100C14F91 /* CPDFListView+Edit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFListView+Edit.m"; sourceTree = "<group>"; };
-		4FF3E1D02A064A8100C14F91 /* CPDFListView+Edit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFListView+Edit.h"; sourceTree = "<group>"; };
+		4FF3E1CF2A064A8100C14F91 /* CPDFListView+ContentEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFListView+ContentEditor.m"; sourceTree = "<group>"; };
+		4FF3E1D02A064A8100C14F91 /* CPDFListView+ContentEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFListView+ContentEditor.h"; sourceTree = "<group>"; };
 		4FF895912A1EF05D0045890F /* CPDFFormToolBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFFormToolBar.h; sourceTree = "<group>"; };
 		4FF895922A1EF05D0045890F /* CPDFFormToolBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFFormToolBar.m; sourceTree = "<group>"; };
 		4FF895932A1EF05D0045890F /* CPDFFormImage.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = CPDFFormImage.xcassets; sourceTree = "<group>"; };
@@ -1507,8 +1507,8 @@
 				F310DF102A20A8F000A67ABF /* CPDFListView+Form.h */,
 				F310DF112A20A8F000A67ABF /* CPDFListView+Form.m */,
 				F38F5B622A038B0400D0EEFD /* CPDFListView+Private.h */,
-				4FF3E1D02A064A8100C14F91 /* CPDFListView+Edit.h */,
-				4FF3E1CF2A064A8100C14F91 /* CPDFListView+Edit.m */,
+				4FF3E1D02A064A8100C14F91 /* CPDFListView+ContentEditor.h */,
+				4FF3E1CF2A064A8100C14F91 /* CPDFListView+ContentEditor.m */,
 			);
 			path = PDFListView;
 			sourceTree = "<group>";
@@ -1770,7 +1770,7 @@
 				F3DF83DE2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.m in Sources */,
 				F3A2DA552A2DC56F00120C61 /* CPDFTextWidgetAnnotation+PDFListView.m in Sources */,
 				F377CB432A135BAF00C543BD /* CPDFAnnotionColorDrawView.m in Sources */,
-				4FF3E1D12A064A8200C14F91 /* CPDFListView+Edit.m in Sources */,
+				4FF3E1D12A064A8200C14F91 /* CPDFListView+ContentEditor.m in Sources */,
 				C91BE7CA2A0347770038F2BC /* CPDFFontStyleTableView.m in Sources */,
 				C918CE9329F7C3FB00D43974 /* CAnnotationManage.m in Sources */,
 				4F1781712A20413E00795BDF /* CPDFFontAlignView.m in Sources */,

+ 1 - 1
ComPDFKit_Tools/ComPDFKit_Tools/Common/Views/PDFView/PDFListView/CPDFListView+Edit.h

@@ -13,7 +13,7 @@
 #import <ComPDFKit_Tools/CPDFListView.h>
 #import <ComPDFKit/ComPDFKit.h>
 
-@interface CPDFListView (Edit)<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
+@interface CPDFListView (ContentEditor)<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
 
 @end
 

+ 372 - 0
ComPDFKit_Tools/ComPDFKit_Tools/Common/Views/PDFView/PDFListView/CPDFListView+ContentEditor.m

@@ -0,0 +1,372 @@
+//
+//  PDFListView+ContentEditor.m
+//  ComPDFKit_Tools
+//
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
+//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+//  This notice may not be removed from this file.
+//
+
+#import "CPDFListView+ContentEditor.h"
+#import "CPDFListView+Private.h"
+
+@implementation CPDFListView (ContentEditor)
+ 
+- (NSArray<UIMenuItem *> *)menuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page{
+    
+    NSArray *menuItem = [super menuItemsEditingAtPoint:point forPage:page];
+    
+    self.menuPoint = point;
+    self.menuPage = page;
+
+    NSMutableArray *menuItems =[NSMutableArray array];
+    if (menuItem) {
+        [menuItems addObjectsFromArray:menuItem];
+    }
+    
+    BOOL isCropMode = NO;
+    if (self.editingArea.IsImageArea) {
+        isCropMode = [(CPDFEditImageArea *)self.editingArea isCropMode];
+    }
+    
+    UIMenuItem *editItem;
+    UIMenuItem *copyItem;
+    UIMenuItem *cutItem;
+    UIMenuItem *deleteItem;
+    UIMenuItem *pasteItem;
+    UIMenuItem *pasteMatchStyleItem;
+    
+    for (UIMenuItem * item in menuItem) {
+        if ([NSStringFromSelector(item.action) isEqualToString:@"editEditingItemAction:"]){
+            editItem = item;
+        } else  if ([NSStringFromSelector(item.action) isEqualToString:@"copyEditingItemAction:"]){
+            copyItem = item;
+        } else if([NSStringFromSelector(item.action) isEqualToString:@"cutEditingItemAction:"]){
+            cutItem = item;
+        } else if([NSStringFromSelector(item.action) isEqualToString:@"deleteEditingItemAction:"]){
+            deleteItem = item;
+        } else if ([NSStringFromSelector(item.action) isEqualToString:@"pastEditingItemAction:"]) {
+            pasteItem = item;
+        } else if ([NSStringFromSelector(item.action) isEqualToString:@"pasteMatchStyleEditingItemAction:"]) {
+            pasteMatchStyleItem = item;
+        }
+    }
+        
+    if(self.editStatus == CEditingSelectStateEmpty){
+        [menuItems removeAllObjects];
+        if(self.editingLoadType == CEditingLoadTypeText){
+            UIMenuItem *addTextItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Add Text", nil)
+                                                                  action:@selector(addTextEditingItemAction:)];
+            [menuItems addObject:addTextItem];
+        }else if(self.editingLoadType == CEditingLoadTypeImage){
+            UIMenuItem *addImageItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Add Image", nil)
+                                                                   action:@selector(addImageEditingItemAction:)];
+            [menuItems addObject:addImageItem];
+        }
+        
+        if(pasteItem)
+            [menuItems addObject:pasteItem];
+        
+        if(pasteMatchStyleItem)
+            [menuItems addObject:pasteMatchStyleItem];
+    }
+    
+    if(isCropMode){
+        UIMenuItem * doneItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Done", nil) action:@selector(doneActionClick:)];
+        UIMenuItem * cancelItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Cancel", nil) action:@selector(cancelActionClick:)];
+        
+        [menuItems addObject:doneItem];
+        [menuItems addObject:cancelItem];
+    }else{
+        UIMenuItem * propertyItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Properties", nil) action:@selector(propertyEditingItemAction:)];
+
+        if(self.editingArea){
+            if (self.editingArea.IsImageArea) {
+                
+                [menuItems removeAllObjects];
+                
+                UIMenuItem * leftRotateItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Rotate", nil) action:@selector(leftRotateCropActionClick:)];
+                
+                UIMenuItem * rPlaceItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Replace", nil) action:@selector(replaceActionClick:)];
+                
+                UIMenuItem * cropItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Crop", nil) action:@selector(enterCropActionClick:)];
+                
+                UIMenuItem * opacityItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Opacity", nil) action:@selector(opacityEditingItemAction:)];
+                
+                UIMenuItem * hMirrorItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Flip horizontal", nil) action:@selector(horizontalMirrorClick:)];
+                UIMenuItem * vMirrorItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Flip vertical", nil) action:@selector(verticalMirrorClick:)];
+                
+                UIMenuItem * extractItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Export", nil) action:@selector(extractActionClick:)];
+                
+                if(propertyItem)
+                    [menuItems addObject:propertyItem];
+                
+                [menuItems addObject:leftRotateItem];
+                [menuItems addObject:rPlaceItem];
+                [menuItems addObject:extractItem];
+                [menuItems addObject:opacityItem];
+                [menuItems addObject:hMirrorItem];
+                [menuItems addObject:vMirrorItem];
+                if(cropItem)
+                    [menuItems addObject:cropItem];
+                if(cutItem)
+                    [menuItems addObject:cutItem];
+                if(copyItem)
+                    [menuItems addObject:copyItem];
+                if(deleteItem)
+                    [menuItems addObject:deleteItem];
+            }else if(self.editingArea.IsTextArea){
+                CEditingSelectState state = self.editStatus;
+                if (state == CEditingSelectStateEditSelectText) {
+                    [menuItems removeAllObjects];
+                    UIMenuItem * opacityItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Opacity", nil) action:@selector(opacityEditingItemAction:)];
+
+                    if(propertyItem)
+                        [menuItems addObject:propertyItem];
+                    if(opacityItem)
+                        [menuItems addObject:opacityItem];
+                    if(cutItem)
+                        [menuItems addObject:cutItem];
+                    if(copyItem)
+                        [menuItems addObject:copyItem];
+                    if(deleteItem)
+                        [menuItems addObject:deleteItem];
+                } else if(state == CEditingSelectStateEditTextArea) {
+                    [menuItems removeAllObjects];
+
+                    if(propertyItem)
+                        [menuItems addObject:propertyItem];
+                    if(editItem)
+                        [menuItems addObject:editItem];
+                    if(cutItem)
+                        [menuItems addObject:cutItem];
+                    if(copyItem)
+                        [menuItems addObject:copyItem];
+                    if(deleteItem)
+                        [menuItems addObject:deleteItem];
+                }
+            }
+        }
+    }
+    
+    if([self.performDelegate respondsToSelector:@selector(PDFListView:customizeMenuItems:forPage:forPagePoint:)])
+        return [self.performDelegate PDFListView:self customizeMenuItems:menuItems forPage:page forPagePoint:point];
+    return menuItems;
+}
+
+- (void)leftRotateCropActionClick:(UIMenuItem*)menuItem {
+    if([self.editingArea IsImageArea]) {
+        [self rotateEditArea:(CPDFEditImageArea *)self.editingArea rotateAngle:-90];
+    }
+}
+
+- (void)addTextEditingItemAction:(UIMenuItem*)menuItem{
+    CPDFPage *page = self.menuPage;
+    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
+    [style setAlignment:NSTextAlignmentCenter];
+    CGRect rect = CGRectMake(self.menuPoint.x, self.menuPoint.y, 60.0, 20);
+    
+    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+    [dic setValue:style forKey:NSParagraphStyleAttributeName];
+    [dic setValue:[UIColor blueColor] forKey:NSForegroundColorAttributeName];
+    [dic setValue:[UIFont fontWithName:@"Helvetica-Bold" size:18.0] forKey:NSFontAttributeName];
+    
+    [self createEmptyStringBounds:rect withAttributes:dic page:page];
+}
+- (void)addImageEditingItemAction:(UIMenuItem*)menuItem{
+    
+    UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
+    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
+    imagePicker.delegate = self;
+    [self.window.rootViewController presentViewController:imagePicker animated:YES completion:nil];
+}
+
+- (void)doneActionClick:(UIMenuItem*)menuItem{
+    CPDFEditImageArea * editArea = (CPDFEditImageArea *)self.editingArea;
+    [self cropEditArea:editArea withRect:editArea.cropRect];
+    [self endCropEditArea:editArea];
+}
+
+- (void)cancelActionClick:(UIMenuItem*)menuItem{
+    [self endCropEditArea:(CPDFEditImageArea*)self.editingArea];
+}
+
+- (void)deleteActionClick:(UIMenuItem*)menuItem{
+    [self deleteEditingArea:self.editingArea];
+}
+
+- (void)replaceActionClick:(UIMenuItem*)menuItem{
+    UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
+    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
+    imagePicker.delegate = self;
+    [self.window.rootViewController presentViewController:imagePicker animated:YES completion:nil];
+}
+
+- (void)propertyEditingItemAction:(UIMenuItem*)menuItem {
+    if(self.performDelegate && [self.performDelegate respondsToSelector:@selector(PDFListViewContentEditProperty:point:)]){
+        [self.performDelegate PDFListViewContentEditProperty:self point:self.menuPoint];
+    }
+}
+
+- (void)opacityEditingItemAction:(UIMenuItem*)menuItem{
+    NSMutableArray *menuItems = [NSMutableArray array];
+    UIMenuItem *opacity25Item = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"25%", nil)
+                                                            action:@selector(opacity25ItemAction:)];
+    UIMenuItem *opacity50Item = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"50%", nil)
+                                                            action:@selector(opacity50ItemAction:)];
+    UIMenuItem *opacity75Item = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"75%", nil)
+                                                            action:@selector(opacity75ItemAction:)];
+    UIMenuItem *opacity100Item = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"100%", nil)
+                                                             action:@selector(opacity100ItemAction:)];
+    [menuItems addObject:opacity25Item];
+    [menuItems addObject:opacity50Item];
+    [menuItems addObject:opacity75Item];
+    [menuItems addObject:opacity100Item];
+    
+    
+    CGRect bounds = self.editingArea.bounds;
+    bounds = CGRectInset(bounds, -15, -15);
+    CGRect rect = [self convertRect:bounds fromPage:self.editingArea.page];
+    [self becomeFirstResponder];
+    [UIMenuController sharedMenuController].menuItems = menuItems;
+    [[UIMenuController sharedMenuController] setTargetRect:rect inView:self];
+    [[UIMenuController sharedMenuController] setMenuVisible:YES animated:YES];
+}
+
+- (void)opacity25ItemAction:(id)sender {
+    [self setCharsFontTransparency:0.25];
+}
+
+- (void)opacity50ItemAction:(id)sender {
+    [self setCharsFontTransparency:0.5];
+}
+
+- (void)opacity75ItemAction:(id)sender {
+    [self setCharsFontTransparency:0.75];
+}
+
+- (void)opacity100ItemAction:(id)sender {
+    [self setCharsFontTransparency:1.0];
+}
+
+#pragma mark - imagePickerDelegate
+-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
+{
+
+    if (@available(iOS 11.0, *)) {
+     NSURL * url = info[UIImagePickerControllerImageURL];
+        if(self.editStatus == CEditingSelectStateEmpty){
+            UIImage * image = [[UIImage alloc] initWithContentsOfFile:url.path];
+            
+            CGFloat img_width = 0;
+            CGFloat img_height = 0;
+            CGFloat scaled_width = 149;
+            CGFloat scaled_height = 210;
+            
+
+            if(image.imageOrientation!=UIImageOrientationUp){
+                // Adjust picture Angle
+                UIGraphicsBeginImageContext(image.size);
+                [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
+                image = UIGraphicsGetImageFromCurrentImageContext();
+                UIGraphicsEndImageContext();
+                img_width = image.size.height;
+                img_height = image.size.width;
+            }else{
+                img_width = image.size.width;
+                img_height = image.size.height;
+            }
+            
+            CGFloat scaled = MIN(scaled_width/img_width, scaled_height/img_height);
+            scaled_height =  img_height*scaled;
+            scaled_width =  img_width*scaled;
+
+            CGRect rect = CGRectMake(self.menuPoint.x, self.menuPoint.y, scaled_width, scaled_height);
+            [self createEmptyImage:rect page:self.menuPage path:url.path];
+        }else{
+            [self replaceEditImageArea:(CPDFEditImageArea *)self.editingArea imagePath:url.path];
+        }
+
+    } else {
+        NSURL * url = info[UIImagePickerControllerMediaURL];
+        if(self.editStatus == CEditingSelectStateEmpty){
+            UIImage * image = [[UIImage alloc] initWithContentsOfFile:url.path];
+            
+            CGFloat img_width = 0;
+            CGFloat img_height = 0;
+            CGFloat scaled_width = 14;
+            CGFloat scaled_height = 0;
+
+            if(image.imageOrientation!=UIImageOrientationUp){
+                        // Adjust picture Angle
+                UIGraphicsBeginImageContext(image.size);
+                [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
+                image = UIGraphicsGetImageFromCurrentImageContext();
+                UIGraphicsEndImageContext();
+                img_width = image.size.height;
+                img_height = image.size.width;
+            }else{
+                img_width = image.size.width;
+                img_height = image.size.height;
+            }
+            scaled_height =  scaled_width*img_height/img_width;
+            
+            CGRect rect = CGRectMake(self.menuPoint.x, self.menuPoint.y, scaled_width, scaled_height);
+            [self createEmptyImage:rect page:self.menuPage path:url.path];
+        }else{
+            [self replaceEditImageArea:(CPDFEditImageArea *)self.editingArea imagePath:url.path];
+        }
+
+    }
+    
+    [picker dismissViewControllerAnimated:YES completion:nil];
+}
+
+
+
+- (void)extractActionClick:(UIMenuItem*)menuItem{
+    BOOL saved = [self extractImageWithEditImageArea:(CPDFEditImageArea*)self.editingArea];
+    
+    if(saved){
+        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"Export Successfully!", nil) preferredStyle:UIAlertControllerStyleAlert];
+
+        [alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK!", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        }]];
+        
+        UIViewController *tRootViewControl = [UIApplication sharedApplication].keyWindow.rootViewController;
+        if ([tRootViewControl presentedViewController]) {
+            tRootViewControl = [tRootViewControl presentedViewController];
+        }
+
+        [tRootViewControl presentViewController:alertController animated:YES completion:nil];
+    }else{
+        UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"Export Failed!", nil) preferredStyle:UIAlertControllerStyleAlert];
+
+        [alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK!", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        }]];
+        
+        UIViewController *tRootViewControl = [UIApplication sharedApplication].keyWindow.rootViewController;
+        if ([tRootViewControl presentedViewController]) {
+            tRootViewControl = [tRootViewControl presentedViewController];
+        }
+        [tRootViewControl presentViewController:alertController animated:YES completion:nil];
+    }
+}
+
+- (void)horizontalMirrorClick:(UIMenuItem*)menuItem{
+    [self horizontalMirrorEditArea:(CPDFEditImageArea*)self.editingArea];
+}
+
+- (void)verticalMirrorClick:(UIMenuItem*)menuItem{
+    [self verticalMirrorEditArea:(CPDFEditImageArea*)self.editingArea];
+}
+
+
+- (void)enterCropActionClick:(UIMenuItem*)menuItem{
+    [self beginCropEditArea:(CPDFEditImageArea*)self.editingArea];
+}
+
+@end

+ 3 - 3
ComPDFKit_Tools/ComPDFKit_Tools/Common/Views/PDFView/PDFListView/CPDFListView+Edit.m

@@ -1,5 +1,5 @@
 //
-//  PDFListView+Event.m
+//  PDFListView+ContentEditor.m
 //  ComPDFKit_Tools
 //
 //  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
@@ -10,10 +10,10 @@
 //  This notice may not be removed from this file.
 //
 
-#import "CPDFListView+Edit.h"
+#import "CPDFListView+ContentEditor.h"
 #import "CPDFListView+Private.h"
 
-@implementation CPDFListView (Edit)
+@implementation CPDFListView (ContentEditor)
  
 - (NSArray<UIMenuItem *> *)menuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page{
     

+ 14 - 4
PDFViewer/PDFViewer.xcodeproj/project.pbxproj

@@ -374,10 +374,15 @@
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = PDFViewer/Info.plist;
 				INFOPLIST_KEY_CFBundleDisplayName = ComPDFKit;
-				INFOPLIST_KEY_NSCameraUsageDescription = "Enable camera access so that you can create scans with your camera.";
+				INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCalendarsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCameraUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSContactsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSMicrophoneUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "Enable camera access so that you can create scans with your camera.";
-				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Enable photo access so that you can create scans with your photos.";
+				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
 				INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
@@ -408,10 +413,15 @@
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = PDFViewer/Info.plist;
 				INFOPLIST_KEY_CFBundleDisplayName = ComPDFKit;
-				INFOPLIST_KEY_NSCameraUsageDescription = "Enable camera access so that you can create scans with your camera.";
+				INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCalendarsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSCameraUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSContactsUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationAlwaysUsageDescription = "Your consent is required before you could access the function.";
+				INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSMicrophoneUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "Enable camera access so that you can create scans with your camera.";
-				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Enable photo access so that you can create scans with your photos.";
+				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Your consent is required before you could access the function.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
 				INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";