Преглед изворни кода

PDFTool(iOS) - edit试图+部分功能

chenyu пре 1 година
родитељ
комит
327987c7b8

+ 40 - 8
compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj

@@ -7,6 +7,14 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		4F17C0BE29F5179000445550 /* CPDFTextProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F17C0BC29F5179000445550 /* CPDFTextProperty.h */; };
+		4F17C0BF29F5179000445550 /* CPDFTextProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F17C0BD29F5179000445550 /* CPDFTextProperty.m */; };
+		4F17C0C229F517A200445550 /* CPDFImageProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F17C0C029F517A200445550 /* CPDFImageProperty.h */; };
+		4F17C0C329F517A200445550 /* CPDFImageProperty.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F17C0C129F517A200445550 /* CPDFImageProperty.m */; };
+		4F17C0C629F517B500445550 /* CPDFEditContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F17C0C429F517B500445550 /* CPDFEditContextMenu.h */; };
+		4F17C0C729F517B500445550 /* CPDFEditContextMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F17C0C529F517B500445550 /* CPDFEditContextMenu.m */; };
+		4F17C0CE29F5186A00445550 /* CPDFEditToolBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F17C0CC29F5186A00445550 /* CPDFEditToolBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		4F17C0CF29F5186A00445550 /* CPDFEditToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F17C0CD29F5186A00445550 /* CPDFEditToolBar.m */; };
 		C9AF182629EE8AB600EC4979 /* UtilsColor.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */; };
 		C9AF182C29EFB1FC00EC4979 /* CPDFBookmarkViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C9AF182A29EFB1FC00EC4979 /* CPDFBookmarkViewCell.h */; };
 		C9AF182D29EFB1FC00EC4979 /* CPDFBookmarkViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C9AF182B29EFB1FC00EC4979 /* CPDFBookmarkViewCell.m */; };
@@ -73,6 +81,14 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		4F17C0BC29F5179000445550 /* CPDFTextProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFTextProperty.h; sourceTree = "<group>"; };
+		4F17C0BD29F5179000445550 /* CPDFTextProperty.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFTextProperty.m; sourceTree = "<group>"; };
+		4F17C0C029F517A200445550 /* CPDFImageProperty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFImageProperty.h; sourceTree = "<group>"; };
+		4F17C0C129F517A200445550 /* CPDFImageProperty.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFImageProperty.m; sourceTree = "<group>"; };
+		4F17C0C429F517B500445550 /* CPDFEditContextMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFEditContextMenu.h; sourceTree = "<group>"; };
+		4F17C0C529F517B500445550 /* CPDFEditContextMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFEditContextMenu.m; sourceTree = "<group>"; };
+		4F17C0CC29F5186A00445550 /* CPDFEditToolBar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFEditToolBar.h; sourceTree = "<group>"; };
+		4F17C0CD29F5186A00445550 /* CPDFEditToolBar.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFEditToolBar.m; sourceTree = "<group>"; };
 		C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = UtilsColor.xcassets; sourceTree = "<group>"; };
 		C9AF182A29EFB1FC00EC4979 /* CPDFBookmarkViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFBookmarkViewCell.h; sourceTree = "<group>"; };
 		C9AF182B29EFB1FC00EC4979 /* CPDFBookmarkViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFBookmarkViewCell.m; sourceTree = "<group>"; };
@@ -152,6 +168,21 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		4F17C0BB29F5168900445550 /* Edit */ = {
+			isa = PBXGroup;
+			children = (
+				4F17C0BC29F5179000445550 /* CPDFTextProperty.h */,
+				4F17C0BD29F5179000445550 /* CPDFTextProperty.m */,
+				4F17C0C029F517A200445550 /* CPDFImageProperty.h */,
+				4F17C0C129F517A200445550 /* CPDFImageProperty.m */,
+				4F17C0C429F517B500445550 /* CPDFEditContextMenu.h */,
+				4F17C0C529F517B500445550 /* CPDFEditContextMenu.m */,
+				4F17C0CC29F5186A00445550 /* CPDFEditToolBar.h */,
+				4F17C0CD29F5186A00445550 /* CPDFEditToolBar.m */,
+			);
+			path = Edit;
+			sourceTree = "<group>";
+		};
 		C949FEE029EE70D000C30A8D /* Utils */ = {
 			isa = PBXGroup;
 			children = (
@@ -279,13 +310,6 @@
 			path = PDFDisplaySetting;
 			sourceTree = "<group>";
 		};
-		F32DA14229ED904300E19ECA /* Edit */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = Edit;
-			sourceTree = "<group>";
-		};
 		F32DA14329ED904300E19ECA /* Annotation */ = {
 			isa = PBXGroup;
 			children = (
@@ -409,7 +433,7 @@
 			children = (
 				F32DA14329ED904300E19ECA /* Annotation */,
 				F32DA14629ED904300E19ECA /* Common */,
-				F32DA14229ED904300E19ECA /* Edit */,
+				4F17C0BB29F5168900445550 /* Edit */,
 				F32DA14529ED904300E19ECA /* Form */,
 				F32DA14429ED904300E19ECA /* PageEdit */,
 				F32DA12029ED904300E19ECA /* Viewer */,
@@ -464,15 +488,19 @@
 			files = (
 				F32DA18129ED904300E19ECA /* CNavigationRightView.h in Headers */,
 				F32DA16A29ED904300E19ECA /* CPDFSearchViewCell.h in Headers */,
+				4F17C0CE29F5186A00445550 /* CPDFEditToolBar.h in Headers */,
 				F32DA18529ED904300E19ECA /* CActivityIndicatorView.h in Headers */,
 				F32DA17E29ED904300E19ECA /* CPDFBOTAViewController.h in Headers */,
 				F32DA16829ED904300E19ECA /* CPDFOutlineViewCell.h in Headers */,
 				F382636E29EFD0D9003F1DFD /* CPDFListView.h in Headers */,
+				4F17C0C229F517A200445550 /* CPDFImageProperty.h in Headers */,
 				F32DA17529ED904300E19ECA /* CPDFInfoTableCell.h in Headers */,
+				4F17C0C629F517B500445550 /* CPDFEditContextMenu.h in Headers */,
 				F32DA18029ED904300E19ECA /* CNavigationController.h in Headers */,
 				F32DA17429ED904300E19ECA /* CPDFInfoViewController.h in Headers */,
 				F382636B29EFD0D9003F1DFD /* CPDFSlider.h in Headers */,
 				C9AF184129F22BBD00EC4979 /* CPDFAnnotationBarButton.h in Headers */,
+				4F17C0BE29F5179000445550 /* CPDFTextProperty.h in Headers */,
 				F32DA16F29ED904300E19ECA /* CSearchToolbar.h in Headers */,
 				F3877E1629E6764E00037D92 /* CPDFDisplayViewController.h in Headers */,
 				F32DA19129ED908800E19ECA /* CPDFMoreListViewController.h in Headers */,
@@ -576,6 +604,7 @@
 				C9AF184229F22BBD00EC4979 /* CPDFAnnotationBarButton.m in Sources */,
 				F32DA17329ED904300E19ECA /* CPDFThumbnailViewController.m in Sources */,
 				F32DA16929ED904300E19ECA /* CPDFSearchResultsViewController.m in Sources */,
+				4F17C0BF29F5179000445550 /* CPDFTextProperty.m in Sources */,
 				F32DA16D29ED904300E19ECA /* CPDFSearchViewCell.m in Sources */,
 				F32DA16429ED904300E19ECA /* CPDFOutlineViewCell.m in Sources */,
 				F382636A29EFD0D9003F1DFD /* CPDFSlider.m in Sources */,
@@ -586,12 +615,15 @@
 				F32DA17A29ED904300E19ECA /* CPDFDisplayTableViewCell.m in Sources */,
 				F32DA17D29ED904300E19ECA /* CPDFBOTAViewController.m in Sources */,
 				F32DA19229ED908800E19ECA /* CPDFMoreListViewController.m in Sources */,
+				4F17C0C729F517B500445550 /* CPDFEditContextMenu.m in Sources */,
 				F382636929EFD0D9003F1DFD /* CPDFPageIndicatorView.m in Sources */,
 				F32DA17229ED904300E19ECA /* CPDFThumbnailViewCell.m in Sources */,
 				F32DA18429ED904300E19ECA /* CActivityIndicatorView.m in Sources */,
 				F32DA18329ED904300E19ECA /* CNavigationRightView.m in Sources */,
 				F32DA17729ED904300E19ECA /* CPDFInfoTableCell.m in Sources */,
 				F32DA16B29ED904300E19ECA /* CSearchToolbar.m in Sources */,
+				4F17C0CF29F5186A00445550 /* CPDFEditToolBar.m in Sources */,
+				4F17C0C329F517A200445550 /* CPDFImageProperty.m in Sources */,
 				C9AF183129EFB23C00EC4979 /* CPDFBookmarkViewController.m in Sources */,
 				F32DA17629ED904300E19ECA /* CPDFInfoViewController.m in Sources */,
 				C9AF182D29EFB1FC00EC4979 /* CPDFBookmarkViewCell.m in Sources */,

+ 20 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFEditContextMenu.h

@@ -0,0 +1,20 @@
+//
+//  CPDFEditContextMenu.h
+//  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.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CPDFEditContextMenu : NSObject
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 16 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFEditContextMenu.m

@@ -0,0 +1,16 @@
+//
+//  CPDFEditContextMenu.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.
+//
+
+#import "CPDFEditContextMenu.h"
+
+@implementation CPDFEditContextMenu
+
+@end

+ 30 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFEditToolBar.h

@@ -0,0 +1,30 @@
+//
+//  CPDFEditToolBar.h
+//  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.
+//
+
+#import <UIKit/UIKit.h>
+
+@class CPDFView,CPDFEditToolBar;
+NS_ASSUME_NONNULL_BEGIN
+@protocol CPDFEditToolBarDelegate <NSObject>
+
+@optional
+
+- (void)boomarkViewController:(CPDFEditToolBar *)toolBar pageIndex:(NSInteger)pageIndex;
+
+@end
+
+@interface CPDFEditToolBar : UIView
+
+@property (nonatomic, readonly) CPDFView *pdfView;
+- (instancetype)initWithPDFView:(CPDFView *)pdfView;
+
+@end
+NS_ASSUME_NONNULL_END

+ 114 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFEditToolBar.m

@@ -0,0 +1,114 @@
+//
+//  CPDFEditToolBar.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.
+//
+
+#import "CPDFEditToolBar.h"
+#import <ComPDFKit/ComPDFKit.h>
+
+
+@interface CPDFEditToolBar()
+
+@property(nonatomic,strong) UIButton * undoButton;
+@property(nonatomic,strong) UIButton * redoButton;
+@property(nonatomic,strong) UIButton * propertyButton;
+
+@property(nonatomic,strong) UIButton * textEditButton;
+@property(nonatomic,strong) UIButton * imageEditButton;
+
+@property(nonatomic,strong) UIView * leftView;
+@property(nonatomic,strong) UIView * rightView;
+
+
+@end
+
+@implementation CPDFEditToolBar
+
+- (instancetype)initWithPDFView:(CPDFView *)pdfView {
+    if (self = [super init]) {
+        _pdfView = pdfView;
+        [self setUp];
+    }
+    return self;
+}
+
+- (void)setUp {
+    //imagButton
+    self.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height - 60, [UIScreen mainScreen].bounds.size.width,60);
+    self.backgroundColor = [UIColor redColor];
+    
+    self.textEditButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    [self.textEditButton setTitle:@"Edit Text" forState:UIControlStateNormal];
+    [self.textEditButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+    [self.textEditButton sizeToFit];
+    [self.textEditButton addTarget:self action:@selector(textEditAction:) forControlEvents:UIControlEventTouchUpInside];
+    self.textEditButton.frame = CGRectMake(10, 10, self.textEditButton.frame.size.width  + 20, 40);
+    
+    self.imageEditButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    [self.imageEditButton setTitle:@"Edit image" forState:UIControlStateNormal];
+    [self.imageEditButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
+    [self.imageEditButton sizeToFit];
+    [self.imageEditButton addTarget:self action:@selector(imageEditAction:) forControlEvents:UIControlEventTouchUpInside];
+    self.imageEditButton.frame = CGRectMake(CGRectGetMaxX(self.textEditButton.frame) + 10, 10, self.imageEditButton.frame.size.width  + 20, 40);
+    
+    self.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width * 0.6, 60)];
+    self.leftView.backgroundColor = [UIColor colorWithRed:240./255. green:240./255. blue:240./255. alpha:1.0];
+    [self addSubview:self.leftView];
+    [self.leftView addSubview:self.textEditButton];
+    [self.leftView addSubview:self.imageEditButton];
+    
+    
+    self.rightView = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.leftView.frame), 0, self.frame.size.width - self.leftView.frame.size.width, 60)];
+    self.rightView.backgroundColor = [UIColor blueColor];
+    [self addSubview:self.self.rightView];
+    
+    self.redoButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    self.redoButton.backgroundColor = [UIColor greenColor];
+    self.redoButton.frame = CGRectMake(self.rightView.frame.size.width - 50, 10, 40, 40);
+    [self.redoButton addTarget:self action:@selector(redoAction:) forControlEvents:UIControlEventTouchUpInside];
+    
+    self.undoButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    self.undoButton.backgroundColor = [UIColor greenColor];
+    self.undoButton.frame = CGRectMake(self.rightView.frame.size.width - 110, 10,40, 40);
+    [self.undoButton addTarget:self action:@selector(undoAction:) forControlEvents:UIControlEventTouchUpInside];
+    
+    self.propertyButton = [UIButton buttonWithType:UIButtonTypeCustom];
+    self.propertyButton.backgroundColor = [UIColor greenColor];
+    self.propertyButton.frame = CGRectMake(self.rightView.frame.size.width - 170, 10, 40, 40);
+    [self.propertyButton addTarget:self action:@selector(propertyAction:) forControlEvents:UIControlEventTouchUpInside];
+    
+    [self.rightView addSubview:self.redoButton];
+    [self.rightView addSubview:self.undoButton];
+    [self.rightView addSubview:self.propertyButton];
+    
+}
+
+#pragma mark - Action
+
+- (void)textEditAction:(UIButton*)sender {
+    [self.pdfView beginEditingLoadType:CEditingLoadTypeText];
+}
+
+- (void)imageEditAction:(UIButton*)sender {
+    [self.pdfView beginEditingLoadType:CEditingLoadTypeImage];
+}
+
+- (void)redoAction:(UIButton*)sender {
+    [self.pdfView editTextRedo];
+}
+
+- (void)undoAction:(UIButton*)sender {
+    [self.pdfView editTextUndo];
+}
+
+- (void)propertyAction:(UIButton*)sender {
+    
+}
+
+@end

+ 20 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFImageProperty.h

@@ -0,0 +1,20 @@
+//
+//  CPDFImageProperty.h
+//  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.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CPDFImageProperty : NSObject
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 16 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFImageProperty.m

@@ -0,0 +1,16 @@
+//
+//  CPDFImageProperty.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.
+//
+
+#import "CPDFImageProperty.h"
+
+@implementation CPDFImageProperty
+
+@end

+ 20 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFTextProperty.h

@@ -0,0 +1,20 @@
+//
+//  CPDFTextProperty.h
+//  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.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CPDFTextProperty : NSObject
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 16 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFTextProperty.m

@@ -0,0 +1,16 @@
+//
+//  CPDFTextProperty.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.
+//
+
+#import "CPDFTextProperty.h"
+
+@implementation CPDFTextProperty
+
+@end

+ 2 - 0
compdfkit-tools/compdfkit-tools/compdfkit_tools.h

@@ -48,3 +48,5 @@
 //More
 #import <compdfkit_tools/CPDFMoreListViewController.h>
 
+//Edit
+#import <compdfkit_tools/CPDFEditToolBar.h>