瀏覽代碼

PDFTools(iOS) - 签名注释优化

yangliuhua 1 年之前
父節點
當前提交
aa19c06246
共有 30 個文件被更改,包括 1020 次插入148 次删除
  1. 32 8
      compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj
  2. 6 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.h
  3. 150 64
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.m
  4. 12 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewCell.h
  5. 20 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewCell.m
  6. 2 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.h
  7. 70 21
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.m
  8. 11 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureDrawView.h
  9. 22 10
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureDrawView.m
  10. 1 7
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureTopBar.h
  11. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureTopBar.m
  12. 1 2
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/Contents.json
  13. 79 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/add.pdf
  14. 二進制
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/signature_icon_add.png
  15. 二進制
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/signature_icon_add@2x.png
  16. 21 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageDelete.imageset/Contents.json
  17. 103 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageDelete.imageset/delete.pdf
  18. 31 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.h
  19. 26 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.m
  20. 21 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampCollectionViewCell.h
  21. 17 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampCollectionViewCell.m
  22. 50 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampFileManger.h
  23. 307 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampFileManger.m
  24. 2 2
      compdfkit-tools/compdfkit-tools/Common/Controls/BOTA/CPDFBOTAViewController.m
  25. 15 11
      compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m
  26. 2 0
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.h
  27. 0 14
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.m
  28. 2 0
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView.h
  29. 16 0
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView.m
  30. 0 6
      compdfkit-tools/compdfkit-tools/Viewer/PDFBookmark/CPDFBookmarkViewCell.m

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

@@ -94,8 +94,6 @@
 		C91BE7DF2A03CF080038F2BC /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C91BE7DE2A03CF080038F2BC /* Image.xcassets */; };
 		C91BE7E22A048F1A0038F2BC /* CSignatureManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7E02A048F1A0038F2BC /* CSignatureManager.h */; };
 		C91BE7E32A048F1A0038F2BC /* CSignatureManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C91BE7E12A048F1A0038F2BC /* CSignatureManager.m */; };
-		C91BE7E62A04AD880038F2BC /* CSignatureTopBar.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7E42A04AD880038F2BC /* CSignatureTopBar.h */; };
-		C91BE7E72A04AD880038F2BC /* CSignatureTopBar.m in Sources */ = {isa = PBXBuildFile; fileRef = C91BE7E52A04AD880038F2BC /* CSignatureTopBar.m */; };
 		C91BE7EE2A04AED50038F2BC /* CSignatureDrawView.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7EC2A04AED50038F2BC /* CSignatureDrawView.h */; };
 		C91BE7EF2A04AED50038F2BC /* CSignatureDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = C91BE7ED2A04AED50038F2BC /* CSignatureDrawView.m */; };
 		C9AF182629EE8AB600EC4979 /* UtilsColor.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */; };
@@ -123,6 +121,12 @@
 		C9B9EC5029F52DCC00C6A5D2 /* AAPLCustomPresentationController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B9EC4F29F52DCC00C6A5D2 /* AAPLCustomPresentationController.m */; };
 		C9B9EC5929F54E9600C6A5D2 /* CAnnotStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = C9B9EC5729F54E9600C6A5D2 /* CAnnotStyle.h */; };
 		C9B9EC5A29F54E9600C6A5D2 /* CAnnotStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B9EC5829F54E9600C6A5D2 /* CAnnotStyle.m */; };
+		C9FBA20E2A0D1119003FABEC /* CPDFStampViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C9FBA20C2A0D1119003FABEC /* CPDFStampViewController.h */; };
+		C9FBA20F2A0D1119003FABEC /* CPDFStampViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FBA20D2A0D1119003FABEC /* CPDFStampViewController.m */; };
+		C9FBA2122A0D1172003FABEC /* CStampCollectionViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C9FBA2102A0D1172003FABEC /* CStampCollectionViewCell.h */; };
+		C9FBA2132A0D1172003FABEC /* CStampCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FBA2112A0D1172003FABEC /* CStampCollectionViewCell.m */; };
+		C9FBA2162A0D11C7003FABEC /* CStampFileManger.h in Headers */ = {isa = PBXBuildFile; fileRef = C9FBA2142A0D11C7003FABEC /* CStampFileManger.h */; };
+		C9FBA2172A0D11C7003FABEC /* CStampFileManger.m in Sources */ = {isa = PBXBuildFile; fileRef = C9FBA2152A0D11C7003FABEC /* CStampFileManger.m */; };
 		F32DA16229ED904300E19ECA /* CPDFOutlineModel.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DA12229ED904300E19ECA /* CPDFOutlineModel.h */; };
 		F32DA16329ED904300E19ECA /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F32DA12329ED904300E19ECA /* Image.xcassets */; };
 		F32DA16429ED904300E19ECA /* CPDFOutlineViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F32DA12429ED904300E19ECA /* CPDFOutlineViewCell.m */; };
@@ -303,8 +307,6 @@
 		C91BE7DE2A03CF080038F2BC /* Image.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Image.xcassets; sourceTree = "<group>"; };
 		C91BE7E02A048F1A0038F2BC /* CSignatureManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSignatureManager.h; sourceTree = "<group>"; };
 		C91BE7E12A048F1A0038F2BC /* CSignatureManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CSignatureManager.m; sourceTree = "<group>"; };
-		C91BE7E42A04AD880038F2BC /* CSignatureTopBar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSignatureTopBar.h; sourceTree = "<group>"; };
-		C91BE7E52A04AD880038F2BC /* CSignatureTopBar.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CSignatureTopBar.m; sourceTree = "<group>"; };
 		C91BE7EC2A04AED50038F2BC /* CSignatureDrawView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSignatureDrawView.h; sourceTree = "<group>"; };
 		C91BE7ED2A04AED50038F2BC /* CSignatureDrawView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CSignatureDrawView.m; sourceTree = "<group>"; };
 		C9AF182529EE8AB600EC4979 /* UtilsColor.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = UtilsColor.xcassets; sourceTree = "<group>"; };
@@ -333,6 +335,12 @@
 		C9B9EC4F29F52DCC00C6A5D2 /* AAPLCustomPresentationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AAPLCustomPresentationController.m; sourceTree = "<group>"; };
 		C9B9EC5729F54E9600C6A5D2 /* CAnnotStyle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CAnnotStyle.h; sourceTree = "<group>"; };
 		C9B9EC5829F54E9600C6A5D2 /* CAnnotStyle.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CAnnotStyle.m; sourceTree = "<group>"; };
+		C9FBA20C2A0D1119003FABEC /* CPDFStampViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFStampViewController.h; sourceTree = "<group>"; };
+		C9FBA20D2A0D1119003FABEC /* CPDFStampViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFStampViewController.m; sourceTree = "<group>"; };
+		C9FBA2102A0D1172003FABEC /* CStampCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CStampCollectionViewCell.h; sourceTree = "<group>"; };
+		C9FBA2112A0D1172003FABEC /* CStampCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CStampCollectionViewCell.m; sourceTree = "<group>"; };
+		C9FBA2142A0D11C7003FABEC /* CStampFileManger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CStampFileManger.h; sourceTree = "<group>"; };
+		C9FBA2152A0D11C7003FABEC /* CStampFileManger.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CStampFileManger.m; sourceTree = "<group>"; };
 		F313657129E4367A00EE6BBB /* ComPDFKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ComPDFKit.xcframework; path = ../Lib/ComPDFKit.xcframework; sourceTree = "<group>"; };
 		F32DA12229ED904300E19ECA /* CPDFOutlineModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFOutlineModel.h; sourceTree = "<group>"; };
 		F32DA12329ED904300E19ECA /* Image.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Image.xcassets; sourceTree = "<group>"; };
@@ -620,8 +628,6 @@
 				C91BE7DB2A039E900038F2BC /* CPDFSignatureEditViewController.m */,
 				C91BE7E02A048F1A0038F2BC /* CSignatureManager.h */,
 				C91BE7E12A048F1A0038F2BC /* CSignatureManager.m */,
-				C91BE7E42A04AD880038F2BC /* CSignatureTopBar.h */,
-				C91BE7E52A04AD880038F2BC /* CSignatureTopBar.m */,
 				C91BE7EC2A04AED50038F2BC /* CSignatureDrawView.h */,
 				C91BE7ED2A04AED50038F2BC /* CSignatureDrawView.m */,
 				C91BE7DE2A03CF080038F2BC /* Image.xcassets */,
@@ -688,6 +694,7 @@
 		C9AF188A29F4C7C900EC4979 /* PDFProperties */ = {
 			isa = PBXGroup;
 			children = (
+				C9FBA20B2A0D10C3003FABEC /* PDFStamp */,
 				F350B3472A09EAD400B4FC8F /* PDFSound */,
 				C91BE7D12A0399F40038F2BC /* PDFSignature */,
 				C91BE7C02A0234CB0038F2BC /* PDFFreeText */,
@@ -754,6 +761,19 @@
 			path = Model;
 			sourceTree = "<group>";
 		};
+		C9FBA20B2A0D10C3003FABEC /* PDFStamp */ = {
+			isa = PBXGroup;
+			children = (
+				C9FBA20C2A0D1119003FABEC /* CPDFStampViewController.h */,
+				C9FBA20D2A0D1119003FABEC /* CPDFStampViewController.m */,
+				C9FBA2102A0D1172003FABEC /* CStampCollectionViewCell.h */,
+				C9FBA2112A0D1172003FABEC /* CStampCollectionViewCell.m */,
+				C9FBA2142A0D11C7003FABEC /* CStampFileManger.h */,
+				C9FBA2152A0D11C7003FABEC /* CStampFileManger.m */,
+			);
+			path = PDFStamp;
+			sourceTree = "<group>";
+		};
 		F313657029E4367A00EE6BBB /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
@@ -1138,12 +1158,13 @@
 				C9AF182C29EFB1FC00EC4979 /* CPDFBookmarkViewCell.h in Headers */,
 				4F1131AF29F8EEA800950564 /* CPDFEditViewController.h in Headers */,
 				F32DA16529ED904300E19ECA /* CPDFOutlineViewController.h in Headers */,
+				C9FBA2162A0D11C7003FABEC /* CStampFileManger.h in Headers */,
 				4F06AB5729F6792E007797E4 /* CPDFImageProperty.h in Headers */,
 				F35DD19D2A06850700B57F5B /* CPDFLineAnnotation+PDFListView.h in Headers */,
 				F3DF83D42A0BB9BA00D4F3AF /* CStringConstants.h in Headers */,
 				C918CEA029F8F74000D43974 /* CPDFStrikeoutViewController.h in Headers */,
-				C91BE7E62A04AD880038F2BC /* CSignatureTopBar.h in Headers */,
 				F38F60C629EFF0C2008098F8 /* CPDFColorUtils.h in Headers */,
+				C9FBA20E2A0D1119003FABEC /* CPDFStampViewController.h in Headers */,
 				C9AF189B29F4DBF800EC4979 /* CPDFOpacitySliderView.h in Headers */,
 				C918CE9229F7C3FB00D43974 /* CAnnotationManage.h in Headers */,
 				4F1131B429F90E7200950564 /* CPDFImagePropertyCell.h in Headers */,
@@ -1162,6 +1183,7 @@
 				4F1131BA29F911A800950564 /* CPDFTextPropertyCell.h in Headers */,
 				C9AF188E29F4C8A900EC4979 /* CPDFAnnotationBaseViewController.h in Headers */,
 				F335EE4B29E430C800ACC72A /* compdfkit_tools.h in Headers */,
+				C9FBA2122A0D1172003FABEC /* CStampCollectionViewCell.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1266,6 +1288,7 @@
 				4F1131BB29F911A800950564 /* CPDFTextPropertyCell.m in Sources */,
 				F35DD1A02A06850700B57F5B /* CPDFAnnotation+PDFListView.m in Sources */,
 				F350B34A2A09EAF100B4FC8F /* CPDFMediaManager.m in Sources */,
+				C9FBA2172A0D11C7003FABEC /* CStampFileManger.m in Sources */,
 				F32DA17F29ED904300E19ECA /* CNavigationController.m in Sources */,
 				F382636D29EFD0D9003F1DFD /* CPDFListView.m in Sources */,
 				F38F5B672A03D68100D0EEFD /* CPDFListMagnifierView.m in Sources */,
@@ -1286,6 +1309,8 @@
 				4F5986922A03411700F06A1B /* CPDFDropDownMenu.m in Sources */,
 				4FD34DD12A0B3F51005CEAB6 /* CPDFPopMenu.m in Sources */,
 				F32DA16429ED904300E19ECA /* CPDFOutlineViewCell.m in Sources */,
+				C9FBA2132A0D1172003FABEC /* CStampCollectionViewCell.m in Sources */,
+				C9FBA20F2A0D1119003FABEC /* CPDFStampViewController.m in Sources */,
 				F35DD1992A06850700B57F5B /* CPDFCircleAnnotation+PDFListView.m in Sources */,
 				F382636A29EFD0D9003F1DFD /* CPDFSlider.m in Sources */,
 				4F06AB5029F6792E007797E4 /* CPDFTextProperty.m in Sources */,
@@ -1315,7 +1340,6 @@
 				C91BE7DD2A039E900038F2BC /* CPDFSignatureEditViewController.m in Sources */,
 				F32DA17229ED904300E19ECA /* CPDFThumbnailViewCell.m in Sources */,
 				F32DA18429ED904300E19ECA /* CActivityIndicatorView.m in Sources */,
-				C91BE7E72A04AD880038F2BC /* CSignatureTopBar.m in Sources */,
 				4F6C796B29FBD532008C9501 /* CPDFEditFontNameSelectView.m in Sources */,
 				F32DA18329ED904300E19ECA /* CNavigationRightView.m in Sources */,
 				F35DD1A12A06850700B57F5B /* CPDFSquareAnnotation+PDFListView.m in Sources */,

+ 6 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.h

@@ -14,6 +14,12 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef NS_ENUM(NSInteger, CSignatureTopBarSelectedIndex) {
+    CSignatureTopBarDefault = 0,
+    CSignatureTopBarText,
+    CSignatureTopBarImage
+};
+
 @class CPDFSignatureEditViewController;
 
 @protocol CPDFSignatureEditViewControllerDelegate <NSObject>
@@ -22,8 +28,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)signatureEditViewController:(CPDFSignatureEditViewController *)signatureEditViewController image:(UIImage *)image;
 
-- (void)signatureEditViewController:(CPDFSignatureEditViewController *)signatureEditViewController text:(NSString *)text;
-
 @end
 
 @interface CPDFSignatureEditViewController : UIViewController

+ 150 - 64
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureEditViewController.m

@@ -16,7 +16,7 @@
 #import "CSignatureTopBar.h"
 #import "CSignatureDrawView.h"
 
-@interface CPDFSignatureEditViewController () <CSignatureTopBarDelegate, CPDFColorSelectViewDelegate, UIPopoverPresentationControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
+@interface CPDFSignatureEditViewController () <UIPopoverPresentationControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, CPDFColorSelectViewDelegate, CPDFColorPickerViewDelegate>
 
 @property (nonatomic, strong) CPDFColorSelectView *colorSelectView;
 
@@ -24,14 +24,20 @@
 
 @property (nonatomic, strong) UIButton *saveButton;
 
-@property (nonatomic, strong) CSignatureTopBar *topBar;
+@property (nonatomic, strong) UISegmentedControl *segmentedControl;
 
-@property (nonatomic, strong) CSignatureDrawView *signatureDrawView;
+@property (nonatomic, strong) CSignatureDrawView *signatureDrawTextView;
+
+@property (nonatomic, strong) CSignatureDrawView *signatureDrawImageView;
+
+@property (nonatomic, strong) CPDFColorPickerView *colorPicker;
 
 @property (nonatomic, strong) UITextField *textField;
 
 @property (nonatomic, strong) CALayer *bottomBorder;
 
+@property (nonatomic, strong) UIButton *createButton;
+
 @property (nonatomic, assign) CSignatureTopBarSelectedIndex selecIndex;
 
 @end
@@ -45,14 +51,24 @@
     // Do any additional setup after loading the view.
     self.title = NSLocalizedString(@"Add Signature", nil);
     
-    self.topBar = [[CSignatureTopBar alloc] init];
-    self.topBar.delegate = self;
-    [self.view addSubview:self.topBar];
+    NSArray *segmmentArray = [NSArray arrayWithObjects:NSLocalizedString(@"Draw", nil), NSLocalizedString(@"Text", nil), NSLocalizedString(@"Image", nil),nil];
+    _segmentedControl = [[UISegmentedControl alloc] initWithItems:segmmentArray];
+    _segmentedControl.selectedSegmentIndex = 0;
+    _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    [_segmentedControl addTarget:self action:@selector(segmentedControlValueChanged_singature:) forControlEvents:UIControlEventValueChanged];
+    self.navigationItem.titleView = self.segmentedControl;
     
-    self.signatureDrawView = [[CSignatureDrawView alloc] init];
-    self.signatureDrawView.color = [UIColor blackColor];
-    self.signatureDrawView.lineWidth = 4;
-    [self.view addSubview:self.signatureDrawView];
+    self.signatureDrawTextView = [[CSignatureDrawView alloc] init];
+    self.signatureDrawTextView.color = [UIColor blackColor];
+    self.signatureDrawTextView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
+    self.signatureDrawTextView.lineWidth = 4;
+    [self.view addSubview:self.signatureDrawTextView];
+    
+    self.signatureDrawImageView = [[CSignatureDrawView alloc] init];
+    self.signatureDrawImageView.color = [UIColor blackColor];
+    self.signatureDrawImageView.lineWidth = 4;
+    [self.view addSubview:self.signatureDrawImageView];
+    self.signatureDrawImageView.hidden = YES;
     
     self.colorSelectView = [[CPDFColorSelectView alloc] initWithFrame:CGRectMake(0, 550, self.view.frame.size.width, 90)];
     self.colorSelectView.delegate = self;
@@ -61,23 +77,17 @@
     
     self.cacelButon = [[UIButton alloc] init];
     [self.cacelButon setTitle:NSLocalizedString(@"Cancel", nil) forState:UIControlStateNormal];
-    self.cacelButon.layer.borderColor = [UIColor purpleColor].CGColor;
-    self.cacelButon.layer.borderWidth = 1.0;
-    self.cacelButon.layer.cornerRadius = 10.0;
-    self.cacelButon.layer.masksToBounds = YES;
     [self.cacelButon setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
     [self.cacelButon addTarget:self action:@selector(buttonItemClicked_Cancel:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.cacelButon];
+    UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithCustomView:self.cacelButon];
+    self.navigationItem.leftBarButtonItem = cancelItem;
     
     self.saveButton = [[UIButton alloc] init];
-    [self.saveButton setTitle:NSLocalizedString(@"Save", nil) forState:UIControlStateNormal];
-    self.saveButton.layer.borderColor = [UIColor purpleColor].CGColor;
-    self.saveButton.layer.borderWidth = 1.0;
-    self.saveButton.layer.cornerRadius = 10.0;
-    self.saveButton.layer.masksToBounds = YES;
+    [self.saveButton setTitle:NSLocalizedString(@"Done", nil) forState:UIControlStateNormal];
     [self.saveButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
     [self.saveButton addTarget:self action:@selector(buttonItemClicked_Save:) forControlEvents:UIControlEventTouchUpInside];
-    [self.view addSubview:self.saveButton];
+    UIBarButtonItem *doneItem = [[UIBarButtonItem alloc] initWithCustomView:self.saveButton];
+    self.navigationItem.rightBarButtonItem = doneItem;
     
     self.bottomBorder = [CALayer layer];
     self.bottomBorder.backgroundColor = [UIColor blackColor].CGColor;
@@ -88,70 +98,89 @@
     [self.textField.layer addSublayer:self.bottomBorder];
     self.textField.hidden = YES;
     
+    self.createButton = [[UIButton alloc] init];
+    self.createButton.layer.cornerRadius = 25.0;
+    self.createButton.clipsToBounds = YES;
+    [self.createButton setImage:[UIImage imageNamed:@"CPDFSignatureImageAdd" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
+    self.createButton.backgroundColor = [UIColor blueColor];
+    [self.createButton addTarget:self action:@selector(buttonItemClicked_create:) forControlEvents:UIControlEventTouchUpInside];
+    [self.view addSubview:self.createButton];
+    self.createButton.hidden = YES;
+    
     self.selecIndex = CSignatureTopBarDefault;
+    [self createGestureRecognizer];
 }
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
+    self.colorPicker.frame = CGRectMake(0, self.view.frame.size.height/2, self.view.frame.size.width, self.view.frame.size.height/2);
     if (@available(iOS 11.0, *)) {
-        self.topBar.frame = CGRectMake(0, self.view.safeAreaInsets.top, self.view.frame.size.width, 50);
+        self.colorSelectView.frame = CGRectMake(0, self.view.safeAreaInsets.top, self.view.frame.size.width, 90);
+        self.signatureDrawTextView.frame = CGRectMake(self.view.safeAreaInsets.left, self.view.safeAreaInsets.top + 90, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height/2);
+        self.signatureDrawImageView.frame = self.signatureDrawTextView.frame;
+        self.createButton.frame = CGRectMake(self.view.frame.size.width - 70 - self.view.safeAreaInsets.right, self.view.frame.size.height - 100 - self.view.safeAreaInsets.bottom, 50, 50);
     } else {
-        self.topBar.frame = CGRectMake(0, 64, self.view.frame.size.width, 50);
+        self.colorSelectView.frame = CGRectMake(0, 64, self.view.frame.size.width, 90);
+        self.signatureDrawTextView.frame = CGRectMake(0, 190, self.view.frame.size.width, self.view.frame.size.height/2);
+        self.signatureDrawImageView.frame = self.signatureDrawTextView.frame;
+        self.createButton.frame = CGRectMake(self.view.frame.size.width - 70, self.view.frame.size.height - 100, 50, 50);
     }
-    self.signatureDrawView.frame = CGRectMake(0, 150, self.view.frame.size.width, self.view.frame.size.height/2);
-    self.cacelButon.frame = CGRectMake(80, 700, 90, 50);
-    self.saveButton.frame = CGRectMake(self.view.frame.size.width - 170, 700, 90, 50);
+    
     self.textField.frame = CGRectMake((self.view.frame.size.width - 300)/2, 200, 300, 100);
     self.bottomBorder.frame = CGRectMake(0, self.textField.frame.size.height - 1, self.textField.frame.size.width, 1.0);
 }
 
-#pragma mark - CSignatureTopBarDelegate
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
+    [self.signatureDrawTextView signatureClear];
+}
 
-- (void)signatureTopBar:(CSignatureTopBar *)signatureTopBar selectIndex:(CSignatureTopBarSelectedIndex)selectIndex {
-    switch (selectIndex) {
-        case CSignatureTopBarDefault:
-        {
-            self.colorSelectView.hidden = NO;
-            self.signatureDrawView.hidden = NO;
-            self.textField.hidden = YES;
-            self.selecIndex = CSignatureTopBarDefault;
-        }
-            break;
-        case CSignatureTopBarText:
-        {
-            self.colorSelectView.hidden = NO;
-            self.signatureDrawView.hidden = YES;
-            self.textField.hidden = NO;
-            self.selecIndex = CSignatureTopBarText;
-        }
-            break;
-        case CSignatureTopBarImage:
-        {
-            self.colorSelectView.hidden = YES;
-            self.signatureDrawView.hidden = NO;
-            self.textField.hidden = YES;
-            self.selecIndex = CSignatureTopBarImage;
-            [self createImageSignature];
-        }
-            break;
-            
-        default:
-            break;
+#pragma mark - Private Methods
+
+- (void)createGestureRecognizer {
+    [self.createButton setUserInteractionEnabled:YES];
+
+    UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panaddBookmarkBtn:)];
+    [self.createButton addGestureRecognizer:panRecognizer];
+}
+
+- (void)panaddBookmarkBtn:(UIPanGestureRecognizer *)gestureRecognizer {
+    CGPoint point = [gestureRecognizer translationInView:self.view];
+    CGFloat newX = self.createButton.center.x + point.x;
+    CGFloat newY = self.createButton.center.y + point.y;
+    if (CGRectContainsPoint(self.view.frame, CGPointMake(newX, newY))) {
+        self.createButton.center = CGPointMake(newX, newY);
     }
+    [gestureRecognizer setTranslation:CGPointZero inView:self.view];
+}
+
+- (UIImage *)captureScreenshotOfTextField:(UITextField *)textField {
+    textField.tintColor = [UIColor whiteColor];
+    CGRect textRect = [textField textRectForBounds:CGRectInset(textField.bounds, 0, 1)];
+    UIGraphicsBeginImageContextWithOptions(textRect.size, NO, 0.0);
+    [textField drawViewHierarchyInRect:textField.bounds afterScreenUpdates:YES];
+    UIImage *textFieldImage = UIGraphicsGetImageFromCurrentImageContext();
+    UIGraphicsEndImageContext();
+    return textFieldImage;
 }
 
 #pragma mark - Action
 
 - (void)buttonItemClicked_Save:(id)sender {
-    if ((CSignatureTopBarDefault == self.selecIndex) || (CSignatureTopBarImage == self.selecIndex)) {
-        UIImage *image = [self.signatureDrawView signatureImage];
+    if (CSignatureTopBarDefault == self.selecIndex) {
+        UIImage *image = [self.signatureDrawTextView signatureImage];
         if (self.delegate && [self.delegate respondsToSelector:@selector(signatureEditViewController:image:)]) {
             [self.delegate signatureEditViewController:self image:image];
         }
-    } else if (CSignatureTopBarText == self.selecIndex) {
+    } else if (CSignatureTopBarImage == self.selecIndex) {
+        UIImage *image = [self.signatureDrawImageView signatureImage];
+        if (self.delegate && [self.delegate respondsToSelector:@selector(signatureEditViewController:image:)]) {
+            [self.delegate signatureEditViewController:self image:image];
+        }
+    }else if (CSignatureTopBarText == self.selecIndex) {
+        UIImage *image = [self captureScreenshotOfTextField:self.textField];
         if (self.textField.text) {
-            if(self.delegate && [self.delegate respondsToSelector:@selector(signatureEditViewController:text:)]) {
-                [self.delegate signatureEditViewController:self text:self.textField.text];
+            if(self.delegate && [self.delegate respondsToSelector:@selector(signatureEditViewController:image:)]) {
+                [self.delegate signatureEditViewController:self image:image];
             }
         }
     }
@@ -162,6 +191,41 @@
     [self.navigationController popViewControllerAnimated:YES];
 }
 
+- (void)buttonItemClicked_create:(id)sender {
+    [self createImageSignature];
+}
+
+- (void)segmentedControlValueChanged_singature:(id)sender {
+    if (self.segmentedControl.selectedSegmentIndex == 0) {
+        self.colorSelectView.hidden = NO;
+        self.signatureDrawTextView.hidden = NO;
+        self.signatureDrawImageView.hidden = YES;
+        self.textField.hidden = YES;
+        self.selecIndex = CSignatureTopBarDefault;
+        self.colorSelectView.hidden = NO;
+        self.createButton.hidden = YES;
+        self.signatureDrawTextView.selectIndex = CSignatureDrawText;
+    } else if (self.segmentedControl.selectedSegmentIndex == 1) {
+        self.colorSelectView.hidden = NO;
+        self.signatureDrawTextView.hidden = YES;
+        self.signatureDrawImageView.hidden = YES;
+        self.textField.hidden = NO;
+        self.selecIndex = CSignatureTopBarText;
+        self.colorSelectView.hidden = NO;
+        self.createButton.hidden = YES;
+    } else if (self.segmentedControl.selectedSegmentIndex == 2) {
+        self.colorSelectView.hidden = YES;
+        self.signatureDrawTextView.hidden = YES;
+        self.signatureDrawImageView.hidden = NO;
+        self.textField.hidden = YES;
+        self.selecIndex = CSignatureTopBarImage;
+        self.createButton.hidden = NO;
+        self.colorSelectView.hidden = YES;
+        self.signatureDrawImageView.selectIndex = CSignatureDrawImage;
+        [self.signatureDrawImageView setNeedsDisplay];
+    }
+}
+
 #pragma mark - Private Methods
 
 - (void)createImageSignature {
@@ -223,12 +287,34 @@
         CGImageRelease(imageRef);
     }
     
-    self.signatureDrawView.image = image;
-    [self.signatureDrawView setNeedsDisplay];
+    self.signatureDrawImageView.image = image;
+    [self.signatureDrawImageView setNeedsDisplay];
 }
 
 - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
     [picker dismissViewControllerAnimated:YES completion:nil];
 }
 
+#pragma mark - CPDFColorSelectViewDelegate
+
+- (void)selectColorView:(CPDFColorSelectView *)select color:(UIColor *)color {
+    self.textField.textColor = color;
+    self.signatureDrawTextView.color = color;
+}
+
+- (void)selectColorView:(CPDFColorSelectView *)select {
+    _colorPicker = [[CPDFColorPickerView alloc] initWithFrame:self.view.frame];
+    _colorPicker.delegate = self;
+    _colorPicker.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+    _colorPicker.backgroundColor = [UIColor whiteColor];
+    [self.view addSubview:self.colorPicker];
+}
+
+#pragma mark - CPDFColorPickerViewDelegate
+
+- (void)pickerView:(CPDFColorPickerView *)colorPickerView color:(UIColor *)color {
+    self.signatureDrawTextView.color = color;
+    self.textField.textColor = color;
+}
+
 @end

+ 12 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewCell.h

@@ -14,10 +14,22 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class CPDFSignatureViewCell;
+
+@protocol CPDFSignatureViewCellDelegate <NSObject>
+
+@optional
+
+- (void)signatureViewCell:(CPDFSignatureViewCell *)signatureViewCell;
+
+@end
+
 @interface CPDFSignatureViewCell : UITableViewCell
 
 @property (nonatomic, strong) UIImageView *signatureImageView;
 
+@property (nonatomic, weak) id<CPDFSignatureViewCellDelegate> deleteDelegate;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 20 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewCell.m

@@ -12,12 +12,23 @@
 
 #import "CPDFSignatureViewCell.h"
 
+@interface CPDFSignatureViewCell ()
+
+@property (nonatomic, strong) UIButton *deleteButton;
+
+@end
+
 @implementation CPDFSignatureViewCell
 
 - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
     if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
         self.signatureImageView = [[UIImageView alloc] init];
         [self.contentView addSubview:self.signatureImageView];
+        
+        self.deleteButton = [[UIButton alloc] init];
+        [self.deleteButton setImage:[UIImage imageNamed:@"CPDFSignatureImageDelete" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
+        [self.deleteButton addTarget:self action:@selector(buttonItemClicked_delete:) forControlEvents:UIControlEventTouchUpInside];
+        [self.contentView addSubview:self.deleteButton];
     }
     return self;
 }
@@ -29,6 +40,15 @@
     width = MIN(width, self.contentView.bounds.size.width - 80.0);
     [self.signatureImageView setFrame:CGRectMake((self.bounds.size.width - width)/2.0, 0.0, width, height)];
     self.signatureImageView.center = self.contentView.center;
+    self.deleteButton.frame = CGRectMake(self.bounds.size.width - 50, 0.0, 50, 50);
+}
+
+#pragma mark - Action
+
+- (void)buttonItemClicked_delete:(id)sender {
+    if (self.deleteDelegate && [self.deleteDelegate respondsToSelector:@selector(signatureViewCell:)]) {
+        [self.deleteDelegate signatureViewCell:self];
+    }
 }
 
 - (void)awakeFromNib {

+ 2 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.h

@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController;
 
+- (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController image:(UIImage *)image;
+
 @end
 
 @interface CPDFSignatureViewController : UIViewController

+ 70 - 21
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.m

@@ -16,7 +16,7 @@
 #import "CSignatureManager.h"
 #import "CPDFSignatureEditViewController.h"
 
-@interface CPDFSignatureViewController () <UITableViewDelegate, UITableViewDataSource>
+@interface CPDFSignatureViewController () <UITableViewDelegate, UITableViewDataSource, CPDFSignatureViewCellDelegate>
 
 @property (nonatomic, strong) UIButton *backBtn;
 
@@ -24,7 +24,7 @@
 
 @property (nonatomic, strong) CAnnotStyle *annotStyle;
 
-@property (nonatomic, strong) UIImageView *emptyImageView;
+@property (nonatomic, strong) UILabel *emptyLabel;
 
 @property (nonatomic, strong) UIButton *createButton;
 
@@ -66,31 +66,35 @@
     self.tableView.rowHeight = 120;
     [self.view addSubview:self.tableView];
     
-    self.emptyImageView = [[UIImageView alloc] init];
-    self.emptyImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
-    self.emptyImageView.image = [UIImage imageNamed:@"CPDFSignatureImageEmpty" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
-    [self.view addSubview:self.emptyImageView];
+    self.emptyLabel = [[UILabel alloc] init];
+    self.emptyLabel.text = NSLocalizedString(@"NO Signature", nil);
+    [self.view addSubview:self.emptyLabel];
     
     self.createButton = [[UIButton alloc] init];
-    self.createButton.layer.cornerRadius = 10.0;
+    self.createButton.layer.cornerRadius = 25.0;
     self.createButton.clipsToBounds = YES;
     [self.createButton setImage:[UIImage imageNamed:@"CPDFSignatureImageAdd" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
-    [self.createButton setTitle:NSLocalizedString(@"Add Signature", nil) forState:UIControlStateNormal];
-    self.createButton.titleLabel.adjustsFontSizeToFitWidth = YES;
-    [self.createButton setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
+    self.createButton.backgroundColor = [UIColor blueColor];
     [self.createButton addTarget:self action:@selector(buttonItemClicked_create:) forControlEvents:UIControlEventTouchUpInside];
     [self.view addSubview:self.createButton];
     
     self.view.backgroundColor = [UIColor whiteColor];
-    [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];;
+    [self updatePreferredContentSizeWithTraitCollection:self.traitCollection];
+    [self createGestureRecognizer];
 }
 
 - (void)viewWillLayoutSubviews {
     [super viewWillLayoutSubviews];
     self.titleLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, 5, 120, 50);
     self.backBtn.frame = CGRectMake(self.view.frame.size.width - 60, 5, 50, 50);
-    self.createButton.frame = CGRectMake((self.view.frame.size.width - 120)/2, self.view.frame.size.height - 70, 120, 50);;
-    self.emptyImageView.frame = self.tableView.frame;
+    
+    self.emptyLabel.frame = CGRectMake((self.view.frame.size.width - 120)/2, (self.view.frame.size.height - 50)/2, 120, 50);
+    
+    if (@available(iOS 11.0, *)) {
+        self.createButton.frame = CGRectMake(self.view.frame.size.width - 70 - self.view.safeAreaInsets.right, self.view.frame.size.height - 100 - self.view.safeAreaInsets.bottom, 50, 50);
+    } else {
+        self.createButton.frame = CGRectMake(self.view.frame.size.width - 70, self.view.frame.size.height - 100, 50, 50);
+    }
 }
 
 - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
@@ -98,10 +102,29 @@
     [self updatePreferredContentSizeWithTraitCollection:newCollection];
 }
 
+#pragma mark - Private Methods
+
+- (void)createGestureRecognizer {
+    [self.createButton setUserInteractionEnabled:YES];
+
+    UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panaddBookmarkBtn:)];
+    [self.createButton addGestureRecognizer:panRecognizer];
+}
+
+- (void)panaddBookmarkBtn:(UIPanGestureRecognizer *)gestureRecognizer {
+    CGPoint point = [gestureRecognizer translationInView:self.view];
+    CGFloat newX = self.createButton.center.x + point.x;
+    CGFloat newY = self.createButton.center.y + point.y;
+    if (CGRectContainsPoint(self.view.frame, CGPointMake(newX, newY))) {
+        self.createButton.center = CGPointMake(newX, newY);
+    }
+    [gestureRecognizer setTranslation:CGPointZero inView:self.view];
+}
+
 #pragma mark - Protect Methods
 
 - (void)updatePreferredContentSizeWithTraitCollection:(UITraitCollection *)traitCollection {
-    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 270 : 420);
+    self.preferredContentSize = CGSizeMake(self.view.bounds.size.width, traitCollection.verticalSizeClass == UIUserInterfaceSizeClassCompact ? 350 : 660);
 }
 
 #pragma mark - Action
@@ -121,10 +144,10 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
     if ([CSignatureManager sharedManager].signatures.count <= 0) {
-        self.emptyImageView.hidden = NO;
+        self.emptyLabel.hidden = NO;
         self.tableView.hidden = YES;
     } else {
-        self.emptyImageView.hidden = YES;
+        self.emptyLabel.hidden = YES;
         self.tableView.hidden = NO;
     }
     return [CSignatureManager sharedManager].signatures.count;
@@ -135,13 +158,39 @@
     if (cell == nil) {
         cell = [[CPDFSignatureViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
     }
-    if ([[UIImage imageWithContentsOfFile:[CSignatureManager sharedManager].signatures[indexPath.row]] isKindOfClass:[UIImage class]]) {
-        cell.signatureImageView.image = [UIImage imageWithContentsOfFile:[CSignatureManager sharedManager].signatures[indexPath.row]];
-    } else if ([[CSignatureManager sharedManager].signatures[indexPath.row] isKindOfClass:[NSString class]]) {
-        cell.textLabel.text = [CSignatureManager sharedManager].signatures[indexPath.row];
-    }
+    cell.signatureImageView.image = [UIImage imageWithContentsOfFile:[CSignatureManager sharedManager].signatures[indexPath.row]];
+
+    cell.deleteDelegate = self;
     
     return cell;
 }
 
+#pragma mark - UITableViewDelegate
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    if (!tableView.isEditing) {
+        [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
+        [self dismissViewControllerAnimated:YES completion:^{
+            if (self.delegate && [self.delegate respondsToSelector:@selector(signatureViewController:image:)]) {
+                UIImage *image = [UIImage imageWithContentsOfFile:[CSignatureManager sharedManager].signatures[indexPath.row]];
+                [self.delegate signatureViewController:self image:image];
+            }
+        }];
+    }
+}
+
+#pragma mark - CPDFSignatureViewCellDelegate
+
+- (void)signatureViewCell:(CPDFSignatureViewCell *)signatureViewCell {
+    NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
+    for (NSIndexPath *indexPath in self.tableView.indexPathsForSelectedRows) {
+        [indexSet addIndex:indexPath.row];
+    }
+    [[CSignatureManager sharedManager] removeSignaturesAtIndexes:indexSet];
+    if ([CSignatureManager sharedManager].signatures.count < 1) {
+        [self setEditing:NO animated:YES];
+    }
+    [self.tableView reloadData];
+}
+
 @end

+ 11 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureDrawView.h

@@ -14,14 +14,25 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef NS_ENUM(NSInteger, CSignatureDrawSelectedIndex) {
+    CSignatureDrawText = 0,
+    CSignatureDrawImage
+};
+
 @interface CSignatureDrawView : UIView
 
 @property (nonatomic, strong) UIColor *color;
+
 @property (nonatomic, assign) CGFloat lineWidth;
+
 @property (nullable, nonatomic, strong) UIImage *image;
 
+@property (nonatomic, assign) CSignatureDrawSelectedIndex selectIndex;
+
 - (UIImage *)signatureImage;
 
+- (void)signatureClear;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 22 - 10
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureDrawView.m

@@ -50,23 +50,27 @@ static NSInteger _index;
 
 - (void)layoutSubviews {
     [super layoutSubviews];
-    [self setNeedsDisplay];
+    [self setNeedsDisplayInRect:self.bounds];
     self.clearButton.frame = CGRectMake(self.frame.size.width - 80, self.frame.size.height - 60, 70, 40);
 }
 
 - (void)drawRect:(CGRect)rect {
     [super drawRect:rect];
     
-    if (self.image) {
-        CGRect imageFrame = [self imageFrameInRect:rect];
-        [self.image drawInRect:imageFrame];
+    if (CSignatureDrawText == self.selectIndex) {
+        [self.color set];
+        [self.bezierPath setLineWidth:self.lineWidth];
+        [self.bezierPath setLineCapStyle:kCGLineCapRound];
+        [self.bezierPath setLineJoinStyle:kCGLineJoinRound];
+        [self.bezierPath stroke];
+    } else if (CSignatureDrawImage) {
+        if (self.image) {
+            CGRect imageFrame = [self imageFrameInRect:rect];
+            [self.image drawInRect:imageFrame];
+        }
+        self.clearButton.hidden = YES;
     }
-    
-    [self.color set];
-    [self.bezierPath setLineWidth:self.lineWidth];
-    [self.bezierPath setLineCapStyle:kCGLineCapRound];
-    [self.bezierPath setLineJoinStyle:kCGLineJoinRound];
-    [self.bezierPath stroke];
+        
 }
 
 #pragma mark - Draw Methods
@@ -138,6 +142,14 @@ static NSInteger _index;
     return image;
 }
 
+#pragma mark - Public Methods
+
+- (void)signatureClear {
+    self.image = nil;
+    [self.bezierPath removeAllPoints];
+    [self setNeedsDisplay];
+}
+
 #pragma mark - Action
 
 - (void)buttonItemClicked_clear:(UIButton *)button {

+ 1 - 7
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureTopBar.h

@@ -14,19 +14,13 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-typedef NS_ENUM(NSInteger, CSignatureTopBarSelectedIndex) {
-    CSignatureTopBarDefault = 0,
-    CSignatureTopBarText,
-    CSignatureTopBarImage
-};
-
 @class CSignatureTopBar;
 
 @protocol CSignatureTopBarDelegate <NSObject>
 
 @optional
 
-- (void)signatureTopBar:(CSignatureTopBar *)signatureTopBar selectIndex:(CSignatureTopBarSelectedIndex)selectIndex;
+//- (void)signatureTopBar:(CSignatureTopBar *)signatureTopBar selectIndex:(CSignatureTopBarSelectedIndex)selectIndex;
 
 @end
 

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CSignatureTopBar.m

@@ -52,7 +52,7 @@
 
 - (void)buttonItemClicked_swith:(UIButton *)button {
     if (self.delegate && [self.delegate respondsToSelector:@selector(signatureTopBar:selectIndex:)]) {
-        [self.delegate signatureTopBar:self selectIndex:button.tag];
+//        [self.delegate signatureTopBar:self selectIndex:button.tag];
     }
 }
 

+ 1 - 2
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/Contents.json

@@ -1,12 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "signature_icon_add.png",
+      "filename" : "add.pdf",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
-      "filename" : "signature_icon_add@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

+ 79 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/add.pdf

@@ -0,0 +1,79 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 2.000000 2.000000 cm
+1.000000 1.000000 1.000000 scn
+8.750000 9.000000 m
+8.750000 16.000000 l
+7.250000 16.000000 l
+7.250000 9.000000 l
+0.000000 9.000000 l
+0.000000 7.500000 l
+7.250000 7.500000 l
+7.250000 0.000000 l
+8.750000 0.000000 l
+8.750000 7.500000 l
+16.000000 7.500000 l
+16.000000 9.000000 l
+8.750000 9.000000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  392
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000482 00000 n
+0000000504 00000 n
+0000000677 00000 n
+0000000751 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+810
+%%EOF

二進制
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/signature_icon_add.png


二進制
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageAdd.imageset/signature_icon_add@2x.png


+ 21 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageDelete.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "delete.pdf",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 103 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/Image.xcassets/CPDFSignatureImageDelete.imageset/delete.pdf

@@ -0,0 +1,103 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 1.000000 1.500000 cm
+1.000000 0.000000 0.000000 scn
+13.000000 17.000000 m
+13.000000 14.000000 l
+18.000000 14.000000 l
+18.000000 13.000000 l
+15.500000 13.000000 l
+15.500000 0.000000 l
+2.500000 0.000000 l
+2.500000 13.000000 l
+0.000000 13.000000 l
+0.000000 14.000000 l
+5.000000 14.000000 l
+5.000000 17.000000 l
+13.000000 17.000000 l
+h
+3.500000 13.000000 m
+3.500000 1.000000 l
+14.500000 1.000000 l
+14.500000 13.000000 l
+3.500000 13.000000 l
+h
+12.000000 16.000000 m
+12.000000 14.000000 l
+6.000000 14.000000 l
+6.000000 16.000000 l
+12.000000 16.000000 l
+h
+7.500000 10.500000 m
+7.500000 3.500000 l
+6.500000 3.500000 l
+6.500000 10.500000 l
+7.500000 10.500000 l
+h
+11.500000 3.500000 m
+11.500000 10.500000 l
+10.500000 10.500000 l
+10.500000 3.500000 l
+11.500000 3.500000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  837
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 20.000000 20.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000927 00000 n
+0000000949 00000 n
+0000001122 00000 n
+0000001196 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1255
+%%EOF

+ 31 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.h

@@ -0,0 +1,31 @@
+//
+//  CPDFStampViewController.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.
+//  This notice may not be removed from this file.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef NSString* const PDFAnnotationStampKey NS_STRING_ENUM;
+
+extern PDFAnnotationStampKey PDFAnnotationStampKeyType;        // NSIntger
+extern PDFAnnotationStampKey PDFAnnotationStampKeyImagePath;   // NSString
+extern PDFAnnotationStampKey PDFAnnotationStampKeyText;        // NSString
+extern PDFAnnotationStampKey PDFAnnotationStampKeyShowDate;    // BOOL
+extern PDFAnnotationStampKey PDFAnnotationStampKeyShowTime;    // BOOL
+extern PDFAnnotationStampKey PDFAnnotationStampKeyStyle;       // NSIntger
+extern PDFAnnotationStampKey PDFAnnotationStampKeyShape;       // NSIntger
+
+@interface CPDFStampViewController : UIViewController
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 26 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CPDFStampViewController.m

@@ -0,0 +1,26 @@
+//
+//  CPDFStampViewController.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 "CPDFStampViewController.h"
+
+@interface CPDFStampViewController ()
+
+@end
+
+@implementation CPDFStampViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+}
+
+@end

+ 21 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampCollectionViewCell.h

@@ -0,0 +1,21 @@
+//
+//  CStampCollectionViewCell.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.
+//  This notice may not be removed from this file.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface CStampCollectionViewCell : UICollectionViewCell
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 17 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampCollectionViewCell.m

@@ -0,0 +1,17 @@
+//
+//  CStampCollectionViewCell.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 "CStampCollectionViewCell.h"
+
+@implementation CStampCollectionViewCell
+
+@end

+ 50 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampFileManger.h

@@ -0,0 +1,50 @@
+//
+//  CStampFileManger.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.
+//  This notice may not be removed from this file.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#define kPDFStampDataFolder [NSHomeDirectory() stringByAppendingPathComponent:@"Library/PDFKitResources/Stamp"]
+#define kPDFStampTextList   [NSHomeDirectory() stringByAppendingPathComponent:@"Library/PDFKitResources/Stamp/stamp_text.plist"]
+#define kPDFStampImageList  [NSHomeDirectory() stringByAppendingPathComponent:@"Library/PDFKitResources/Stamp/stamp_image.plist"]
+
+typedef enum : NSUInteger {
+    PDFStampCustomType_Text,
+    PDFStampCustomType_Image,
+} PDFStampCustomType;
+
+@interface CStampFileManger : NSObject
+
+@property (nonatomic, strong) NSMutableArray *stampTextList;
+
+@property (nonatomic, strong) NSMutableArray *stampImageList;
+
+@property (nonatomic, strong) NSMutableArray *deleteList;
+
+- (void)readStampDataFromFile;
+
+- (NSArray *)getTextStampData;
+
+- (NSArray *)getImageStampData;
+
+- (BOOL)saveStampDataToFile:(PDFStampCustomType)stampType;
+
+- (BOOL)insertStampItem:(NSDictionary *)stampItem type:(PDFStampCustomType)stampType;
+
+- (BOOL)removeStampItem:(NSInteger)index type:(PDFStampCustomType)stampType;
+
+- (NSString *)saveStampWithImage:(UIImage *)image;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 307 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFStamp/CStampFileManger.m

@@ -0,0 +1,307 @@
+//
+//  CStampFileManger.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 "CStampFileManger.h"
+
+@implementation CStampFileManger
+
+#pragma mark - Init Method
+- (id)init
+{
+    self = [super init];
+    if (self) {
+        _deleteList = [[NSMutableArray alloc] init];
+    }
+    
+    return self;
+}
+
+- (NSString *)getDateTime
+{
+    NSTimeZone* timename = [NSTimeZone systemTimeZone];
+    NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init ];
+    [outputFormatter setTimeZone:timename ];
+    
+    NSString *tDate = nil;
+    
+    [outputFormatter setDateFormat:@"YYYYMMddHHmmss"];
+    tDate = [outputFormatter stringFromDate:[NSDate date]];
+    
+    return tDate;
+}
+
+#pragma mark - File Manager
+
+- (void)readStampDataFromFile
+{
+    [self readCustomStamp_TextStamp];
+    [self readCustomStamp_ImageStamp];
+}
+
+- (void)readCustomStamp_TextStamp
+{
+    NSFileManager *tManager = [NSFileManager defaultManager];
+    if (![tManager fileExistsAtPath:kPDFStampTextList])
+    {
+        _stampTextList = [[NSMutableArray alloc] init];
+    }
+    else
+    {
+        if (_stampTextList)
+        {
+            _stampTextList = nil;
+        }
+        
+        _stampTextList = [NSMutableArray arrayWithContentsOfFile:kPDFStampTextList];
+        if (_stampTextList == nil) {
+            _stampTextList = [[NSMutableArray alloc] init];
+        }
+    }
+}
+
+- (void)readCustomStamp_ImageStamp
+{
+    NSFileManager *tManager = [NSFileManager defaultManager];
+    if (![tManager fileExistsAtPath:kPDFStampImageList])
+    {
+        _stampImageList = [[NSMutableArray alloc] init];
+    }
+    else
+    {
+        if (_stampImageList)
+        {
+            _stampImageList = nil;
+        }
+        
+        _stampImageList = [NSMutableArray arrayWithContentsOfFile:kPDFStampImageList];
+        if (_stampImageList == nil) {
+            _stampImageList = [[NSMutableArray alloc] init];
+        }
+    }
+}
+
+- (NSArray *)getTextStampData
+{
+    return _stampTextList;
+}
+
+- (NSArray *)getImageStampData
+{
+    return _stampImageList;
+}
+
+- (NSString *)saveStampWithImage:(UIImage *)image
+{
+    NSFileManager *tManager = [NSFileManager defaultManager];
+    NSData *imageData = UIImagePNGRepresentation(image);
+    
+    if (imageData == nil || [imageData length] <= 0)
+        return nil;
+    
+    NSString *tName = [self getDateTime];
+    NSString *tPath = [kPDFStampDataFolder stringByAppendingFormat:@"/%@.png",tName];
+    
+    if ([imageData writeToFile:tPath atomically:NO]) {
+        return tPath;
+    }
+    else
+    {
+        NSString *tPath_dic = kPDFStampDataFolder;
+        BOOL tIsDirectory = NO;
+        while (1)
+        {
+            if ([tManager fileExistsAtPath:tPath_dic isDirectory:&tIsDirectory]) {
+                if (tIsDirectory)
+                    break;
+            }
+            else
+            {
+                [tManager createDirectoryAtPath:tPath_dic withIntermediateDirectories:NO attributes:nil error:nil];
+            }
+            tPath_dic = [tPath_dic stringByDeletingLastPathComponent];
+        }
+        if ([imageData writeToFile:tPath atomically:NO]) {
+            return tPath;
+        }
+    }
+    
+    return nil;
+}
+
+- (void)removeStampImage
+{
+    for (NSDictionary *tDict in _deleteList)
+    {
+        NSString *tPath = [tDict objectForKey:@"path"];
+        NSFileManager *tFileManager = [NSFileManager defaultManager];
+        [tFileManager removeItemAtPath:tPath error:nil];
+    }
+}
+
+- (BOOL)saveStampDataToFile:(PDFStampCustomType)stampType
+{
+    NSFileManager *tManager = [NSFileManager defaultManager];
+    
+    switch (stampType)
+    {
+        case PDFStampCustomType_Text:
+            if ([_stampTextList writeToFile:kPDFStampTextList atomically:NO])
+            {
+                return YES;
+            }
+            else
+            {
+                NSString *tPath_dic = kPDFStampTextList;
+                BOOL tIsDirectory = NO;
+                while (1)
+                {
+                    tPath_dic = [tPath_dic stringByDeletingLastPathComponent];
+                    
+                    if ([tManager fileExistsAtPath:tPath_dic isDirectory:&tIsDirectory]) {
+                        if (tIsDirectory)
+                            break;
+                    }
+                    else
+                    {
+                        [tManager createDirectoryAtPath:tPath_dic withIntermediateDirectories:NO attributes:nil error:nil];
+                    }
+                }
+                if ([_stampTextList writeToFile:kPDFStampTextList atomically:NO])
+                {
+                    return YES;
+                }
+            }
+            return NO;
+            
+        case PDFStampCustomType_Image:
+            if ([_stampImageList writeToFile:kPDFStampImageList atomically:NO])
+            {
+                return YES;
+            }
+            else
+            {
+                NSString *tPath_dic = kPDFStampImageList;
+                BOOL tIsDirectory = NO;
+                while (1)
+                {
+                    tPath_dic = [tPath_dic stringByDeletingLastPathComponent];
+                    
+                    if ([tManager fileExistsAtPath:tPath_dic isDirectory:&tIsDirectory]) {
+                        if (tIsDirectory)
+                            break;
+                    }
+                    else
+                    {
+                        [tManager createDirectoryAtPath:tPath_dic withIntermediateDirectories:NO attributes:nil error:nil];
+                    }
+                }
+                if ([_stampImageList writeToFile:kPDFStampImageList atomically:NO])
+                {
+                    return YES;
+                }
+            }
+            return NO;
+            
+        default:
+            return NO;
+    }
+}
+
+- (BOOL)insertStampItem:(NSDictionary *)stampItem type:(PDFStampCustomType)stampType
+{
+    switch (stampType)
+    {
+        case PDFStampCustomType_Text:
+            if (!_stampTextList) {
+                [self readCustomStamp_TextStamp];
+            }
+            
+            if (stampItem)
+            {
+                [_stampTextList addObject:stampItem];
+                if ([self saveStampDataToFile:PDFStampCustomType_Text])
+                    return YES;
+                else
+                    return NO;
+            }
+            else
+                return NO;
+            
+        case PDFStampCustomType_Image:
+            if (!_stampImageList) {
+                [self readCustomStamp_ImageStamp];
+            }
+            
+            if (stampItem)
+            {
+                [_stampImageList addObject:stampItem];
+                if ([self saveStampDataToFile:PDFStampCustomType_Image])
+                    return YES;
+                else
+                    return NO;
+            }
+            else
+                return NO;
+            
+        default:
+            return NO;
+    }
+}
+
+- (BOOL)removeStampItem:(NSInteger)index type:(PDFStampCustomType)stampType
+{
+    switch (stampType)
+    {
+        case PDFStampCustomType_Text:
+            if (!_stampTextList) {
+                [self readCustomStamp_TextStamp];
+            }
+            
+            if (index >= 0 && index <= [_stampTextList count])
+            {
+                [_stampTextList removeObjectAtIndex:index];
+                if ([self saveStampDataToFile:PDFStampCustomType_Text])
+                    return YES;
+                else
+                    return NO;
+            }
+            else
+                return NO;
+            
+        case PDFStampCustomType_Image:
+            if (!_stampImageList) {
+                [self readCustomStamp_ImageStamp];
+            }
+            
+            if (index >= 0 && index < [_stampImageList count])
+            {
+                if (!_deleteList) {
+                    _deleteList = [[NSMutableArray alloc] init];
+                }
+                NSDictionary *tDict = [_stampImageList objectAtIndex:index];
+                [_deleteList addObject:tDict];
+                
+                [_stampImageList removeObjectAtIndex:index];
+                if ([self saveStampDataToFile:PDFStampCustomType_Image])
+                    return YES;
+                else
+                    return NO;
+            }
+            else
+                return NO;
+            
+        default:
+            return NO;
+    }
+}
+
+@end

+ 2 - 2
compdfkit-tools/compdfkit-tools/Common/Controls/BOTA/CPDFBOTAViewController.m

@@ -76,9 +76,9 @@
     _segmentedControl.selectedSegmentIndex = 0;
     _segmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [_segmentedControl addTarget:self action:@selector(segmentedControlValueChanged_BOTA:) forControlEvents:UIControlEventValueChanged];
-//    self.navigationItem.titleView = self.segmentedControl;
+    self.navigationItem.titleView = self.segmentedControl;
     [self.view addSubview:self.segmentedControl];
-    self.currentViewController = self.outlineViewController;
+//    self.currentViewController = self.outlineViewController;
     [self.view addSubview:self.outlineViewController.view];
     
     self.doneBtn = [UIButton buttonWithType:UIButtonTypeSystem];

+ 15 - 11
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -26,7 +26,6 @@
 #import "CPDFListView.h"
 #import "CPDFListView+UndoManager.h"
 #import "CPDFListView+Private.h"
-
 #import "CAnnotationManage.h"
 #import "CPDFSignatureEditViewController.h"
 #import "CSignatureManager.h"
@@ -371,11 +370,7 @@
             break;
         case CPDFToolbarSignature:
         {
-             self.signatureVC = [[CPDFSignatureViewController alloc] initWithStyle:annotStytle];
-            presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:self.signatureVC presentingViewController:self.parentVC];
-            self.signatureVC.delegate = self;
-            self.signatureVC.transitioningDelegate = presentationController;
-            [self.parentVC presentViewController:self.signatureVC animated:YES completion:nil];
+            
         }
             break;
         default:
@@ -412,6 +407,14 @@
             [self.parentVC.view addSubview:self.topToolBar];
         }
         self.alpha = 0.0;
+    } else if (CPDFViewAnnotationModeSignature == self.selectedIndex) {
+        CAnnotStyle *annotStytle = self.annotManage.annotStyle;
+        AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
+        self.signatureVC = [[CPDFSignatureViewController alloc] initWithStyle:annotStytle];
+       presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:self.signatureVC presentingViewController:self.parentVC];
+       self.signatureVC.delegate = self;
+       self.signatureVC.transitioningDelegate = presentationController;
+       [self.parentVC presentViewController:self.signatureVC animated:YES completion:nil];
     }
 }
 
@@ -423,6 +426,12 @@
     [self.parentVC.navigationController pushViewController:editVC animated:NO];
 }
 
+- (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController image:(UIImage *)image {
+    CPDFSignatureAnnotation *annotation = [[CPDFSignatureAnnotation alloc] initWithDocument:self.annotManage.pdfListView.document];
+    [annotation setImage:image];
+    [self.annotManage.pdfListView addAnnotation:annotation];
+}
+
 #pragma mark - CPDFSignatureEditViewControllerDelegate
 
 - (void)signatureEditViewController:(CPDFSignatureEditViewController *)signatureEditViewController image:(UIImage *)image{
@@ -430,11 +439,6 @@
     [self.signatureVC.tableView reloadData];
 }
 
-- (void)signatureEditViewController:(CPDFSignatureEditViewController *)signatureEditViewController text:(NSString *)text {
-    [[CSignatureManager sharedManager] addTextSignature:text];
-    [self.signatureVC.tableView reloadData];
-}
-
 #pragma mark - CPDFNoteViewControllerDelegate
 
 - (void)noteViewController:(CPDFNoteViewController *)noteViewController annotSytle:(CAnnotStyle *)annotStyle {

+ 2 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.h

@@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)updateScrollEnabled;
 
+- (void)addAnnotation:(CPDFAnnotation *)annotation forPage:(CPDFPage *)page;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 0 - 14
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.m

@@ -1146,18 +1146,4 @@
     [self showMenuForAnnotation:annotation];
 }
 
-- (void)addAnnotation:(CPDFAnnotation *)annotation {
-    CPDFPage *page = [self.document pageAtIndex:self.currentPageIndex];
-    CGPoint center = [self convertPoint:self.center toPage:page];
-    if (CGPointEqualToPoint(center, CGPointZero)) {
-        return;
-    }
-    CGRect bounds = annotation.bounds;
-    bounds.origin.x = center.x-bounds.size.width/2.0;
-    bounds.origin.y = center.y-bounds.size.height/2.0;
-    bounds.origin.y = MIN(MAX(0, bounds.origin.y), page.bounds.size.height-bounds.size.height);
-    annotation.bounds = bounds;
-    [self addAnnotation:annotation forPage:page];
-}
-
 @end

+ 2 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView.h

@@ -104,6 +104,8 @@ extern NSNotificationName const CPDFListViewAnnotationsOperationChangeNotificati
 
 @property (nonatomic, readonly) NSMutableArray <CPDFAnnotation *>*activeAnnotations;
 
+- (void)addAnnotation:(CPDFAnnotation *)annotation;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 16 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView.m

@@ -321,6 +321,22 @@ NSNotificationName const CPDFListViewAnnotationsOperationChangeNotification = @"
     }
 }
 
+#pragma mark - Public Methods
+
+- (void)addAnnotation:(CPDFAnnotation *)annotation {
+    CPDFPage *page = [self.document pageAtIndex:self.currentPageIndex];
+    CGPoint center = [self convertPoint:self.center toPage:page];
+    if (CGPointEqualToPoint(center, CGPointZero)) {
+        return;
+    }
+    CGRect bounds = annotation.bounds;
+    bounds.origin.x = center.x-bounds.size.width/2.0;
+    bounds.origin.y = center.y-bounds.size.height/2.0;
+    bounds.origin.y = MIN(MAX(0, bounds.origin.y), page.bounds.size.height-bounds.size.height);
+    annotation.bounds = bounds;
+    [self addAnnotation:annotation forPage:page];
+}
+
 #pragma mark - NotificationCenter
 
 - (void)documentChangedNotification:(NSNotification *)notification {

+ 0 - 6
compdfkit-tools/compdfkit-tools/Viewer/PDFBookmark/CPDFBookmarkViewCell.m

@@ -21,14 +21,8 @@
         _pageIndexLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.bounds.size.width - 80, 5, 60, self.bounds.size.height - 10)];
         _pageIndexLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
         
-//        _editButton = [[UIButton alloc] initWithFrame:CGRectMake(self.bounds.size.width - 40, 5, 30, self.bounds.size.height - 10)];
-//        [_editButton addTarget:self action:@selector(buttonItemClicked_edit:) forControlEvents:UIControlEventTouchUpInside];
-//        _editButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
-//        [_editButton setImage:[UIImage imageNamed:@"CPDFBookmarkImageMore" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
-        
         [self.contentView addSubview:self.titleLabel];
         [self.contentView addSubview:self.pageIndexLabel];
-//        [self.contentView addSubview:self.editButton];
     }
     return self;
 }