Ver Fonte

Merge branch 'compdfkit_demo_ios' of git.kdan.cc:others/kmpdfkit_demo into compdfkit_demo_ios

# Conflicts:
#	Edit-Ctrl-Demo/Edit-Ctrl-Demo/CPDFViewController.m
chenyu há 1 ano atrás
pai
commit
01d4b3234d
33 ficheiros alterados com 355 adições e 115 exclusões
  1. 11 2
      Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/AppDelegate.m
  2. 11 3
      Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/CPDFViewController.m
  3. 10 2
      ComPDFKit/ComPDFKit/AppDelegate.m
  4. 19 3
      ComPDFKit/ComPDFKit/CPDFViewController.m
  5. 10 2
      Edit-Ctrl-Demo/Edit-Ctrl-Demo/AppDelegate.m
  6. 79 3
      Edit-Ctrl-Demo/Edit-Ctrl-Demo/CPDFViewController.m
  7. 10 2
      Form-Ctrl-Demo/Form-Ctrl-Demo/AppDelegate.m
  8. 1 1
      compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj
  9. 1 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFBase/CPDFAnnotationBaseViewController.m
  10. 2 0
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFLink/CPDFLinkViewController.h
  11. 27 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFLink/CPDFLinkViewController.m
  12. 6 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFNote/CPDFNoteOpenViewController.m
  13. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFNote/CPDFNoteViewController.m
  14. 1 1
      compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.h
  15. 4 2
      compdfkit-tools/compdfkit-tools/Common/Controls/PDFViewController/CPDFViewBaseController.h
  16. 36 28
      compdfkit-tools/compdfkit-tools/Common/Controls/PDFViewController/CPDFViewBaseController.m
  17. 2 2
      compdfkit-tools/compdfkit-tools/Common/Controls/Tools/CPDFToolsViewController.m
  18. 10 4
      compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m
  19. 1 1
      compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFAnnotationSampleView.m
  20. 1 1
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Annotation.m
  21. 20 12
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Edit.m
  22. 16 2
      compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView.m
  23. 0 2
      compdfkit-tools/compdfkit-tools/Edit/CPDFEditCell/CPDFEditFontNameSelectView.h
  24. 6 8
      compdfkit-tools/compdfkit-tools/Edit/CPDFEditCell/CPDFEditFontNameSelectView.m
  25. 11 0
      compdfkit-tools/compdfkit-tools/Edit/CPDFEditToolBar/CPDFEditToolBar.m
  26. 1 0
      compdfkit-tools/compdfkit-tools/Edit/CPDFEditViewController.m
  27. 12 3
      compdfkit-tools/compdfkit-tools/Viewer/PDFAnnotation/CPDFAnnotationListCell.m
  28. 3 3
      compdfkit-tools/compdfkit-tools/Viewer/PDFOutlie/CPDFOutlineViewCell.m
  29. 1 10
      compdfkit-tools/compdfkit-tools/Viewer/PDFOutlie/Image.xcassets/CPDFOutlineImageBotaMore.imageset/Contents.json
  30. 1 10
      compdfkit-tools/compdfkit-tools/Viewer/PDFOutlie/Image.xcassets/CPDFOutlineImageBotaMoreLeft.imageset/Contents.json
  31. 1 0
      compdfkit-tools/compdfkit-tools/compdfkit_tools.h
  32. 10 2
      viewer-ctrl-demo/viewer-ctrl-demo/AppDelegate.m
  33. 30 3
      viewer-ctrl-demo/viewer-ctrl-demo/CPDFViewController.m

+ 11 - 2
Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/AppDelegate.m

@@ -65,8 +65,17 @@ static AppDelegate *appDelegate = NULL;
     self.window.backgroundColor = [UIColor whiteColor];
     
     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"PDF32000_2008" ofType:@"pdf"];
-        
-    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:filePath];
+    
+    NSString *documentFolder = [NSHomeDirectory() stringByAppendingFormat:@"/%@/%@", @"Documents",@"Samples"];
+
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentFolder])
+        [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:documentFolder] withIntermediateDirectories:YES attributes:nil error:nil];
+    
+    NSString * documentPath = [documentFolder stringByAppendingPathComponent:filePath.lastPathComponent];
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentPath])
+        [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:filePath] toURL:[NSURL fileURLWithPath:documentPath] error:nil];
+
+    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:documentPath password:nil];
     CNavigationController *navController = [[CNavigationController alloc]initWithRootViewController:pdfViewController];
 
     self.window.rootViewController = navController;

+ 11 - 3
Annotation-Ctrl-Demo/Annotation-Ctrl-Demo/CPDFViewController.m

@@ -166,13 +166,13 @@
     CGFloat tBottomY = 0;
     
     if (@available(iOS 11.0, *)) {
-        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tBottomY - tPosY);
+        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tBottomY - tPosY-self.view.safeAreaInsets.bottom);
     } else {
-        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height  - tBottomY - tPosY);
+        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height  - tBottomY - tPosY-20);
     }
 }
 
-- (void) titleButtonClickd:(UIButton *) button {
+- (void)titleButtonClickd:(UIButton *) button {
     CPDFToolsViewController * toolsVc = [[CPDFToolsViewController alloc] initCustomizeWithToolArrays:@[@(CToolModelViewer),@(CToolModelAnnotation)]];
     toolsVc.delegate = self;
     AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
@@ -193,6 +193,14 @@
     [self presentViewController:botaViewController animated:YES completion:nil];
 }
 
+- (void)setTitleRefresh {
+    if (CToolModelAnnotation == self.pdfListView.toolModel) {
+        [self enterAnnotationMode];
+    } else if (CToolModelViewer == self.pdfListView.toolModel) {
+        [self enterViewerMode];
+    }
+}
+
 #pragma mark - CPDFListViewDelegate
 
 - (void)PDFListViewPerformTouchEnded:(CPDFListView *)pdfView {

+ 10 - 2
ComPDFKit/ComPDFKit/AppDelegate.m

@@ -65,8 +65,16 @@ static AppDelegate *appDelegate = NULL;
     self.window.backgroundColor = [UIColor whiteColor];
     
     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Quick Start Guide" ofType:@"pdf"];
-        
-    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:filePath];
+    NSString *documentFolder = [NSHomeDirectory() stringByAppendingFormat:@"/%@/%@", @"Documents",@"Samples"];
+
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentFolder])
+        [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:documentFolder] withIntermediateDirectories:YES attributes:nil error:nil];
+    
+    NSString * documentPath = [documentFolder stringByAppendingPathComponent:filePath.lastPathComponent];
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentPath])
+        [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:filePath] toURL:[NSURL fileURLWithPath:documentPath] error:nil];
+    
+    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:documentPath password:nil];
     CNavigationController *navController = [[CNavigationController alloc]initWithRootViewController:pdfViewController];
 
     self.window.rootViewController = navController;

+ 19 - 3
ComPDFKit/ComPDFKit/CPDFViewController.m

@@ -155,7 +155,7 @@
     self.annotationBar.hidden = YES;
     self.pdfListView.toolModel = CToolModelEdit;
     [self.pdfListView beginEditingLoadType:CEditingLoadTypeText | CEditingLoadTypeImage];
-    self.navigationTitle = NSLocalizedString(@"Edit", nil);
+    self.navigationTitle = NSLocalizedString(@"Content Edit", nil);
     [self.titleButton setTitle:self.navigationTitle forState:UIControlStateNormal];
     
     [self.toolBar updateButtonState];
@@ -236,9 +236,9 @@
     CGFloat tBottomY = 0;
     
     if (@available(iOS 11.0, *)) {
-        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tBottomY - tPosY);
+        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tBottomY - tPosY-self.view.safeAreaInsets.bottom);
     } else {
-        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height  - tBottomY - tPosY);
+        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height  - tBottomY - tPosY-20);
     }
 }
 
@@ -259,6 +259,16 @@
     [super enterPDFAddFile];
 }
 
+- (void)setTitleRefresh {
+    if (CToolModelEdit == self.pdfListView.toolModel) {
+        [self enterEditMode];
+    } else if (CToolModelViewer == self.pdfListView.toolModel) {
+        [self enterViewerMode];
+    } else if (CToolModelAnnotation == self.pdfListView.toolModel) {
+        [self enterAnnotationMode];
+    }
+}
+
 #pragma mark - Action
 
 - (void)navigationRightItemBota{
@@ -318,6 +328,12 @@
     }
 }
 
+#pragma mark - CPDFViewDelegate
+
+- (void)PDFViewEditingSelectStateDidChanged:(CPDFView *)pdfView {
+    [self.toolBar updateButtonState];
+}
+
 #pragma mark - CPDFListViewDelegate
 
 - (void)PDFListViewPerformTouchEnded:(CPDFListView *)pdfView {

+ 10 - 2
Edit-Ctrl-Demo/Edit-Ctrl-Demo/AppDelegate.m

@@ -65,8 +65,16 @@ static AppDelegate *appDelegate = NULL;
     self.window.backgroundColor = [UIColor whiteColor];
     
     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Quick Start Guide" ofType:@"pdf"];
-        
-    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:filePath];
+    NSString *documentFolder = [NSHomeDirectory() stringByAppendingFormat:@"/%@/%@", @"Documents",@"Samples"];
+
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentFolder])
+        [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:documentFolder] withIntermediateDirectories:YES attributes:nil error:nil];
+    
+    NSString * documentPath = [documentFolder stringByAppendingPathComponent:filePath.lastPathComponent];
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentPath])
+        [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:filePath] toURL:[NSURL fileURLWithPath:documentPath] error:nil];
+    
+    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:documentPath password:nil];
     CNavigationController *navController = [[CNavigationController alloc]initWithRootViewController:pdfViewController];
 
     self.window.rootViewController = navController;

+ 79 - 3
Edit-Ctrl-Demo/Edit-Ctrl-Demo/CPDFViewController.m

@@ -15,13 +15,16 @@
 #import <ComPDFKit/ComPDFKit.h>
 #import <compdfkit_tools/compdfkit_tools.h>
 
-@interface CPDFViewController () <UIDocumentPickerDelegate,CPDFToolsViewControllerDelegate,CPDFEditToolBarDelegate>
+@interface CPDFViewController () <UIDocumentPickerDelegate,CPDFToolsViewControllerDelegate,CPDFEditToolBarDelegate,CPDFSignatureViewControllerDelegate>
 
 @property(nonatomic, strong) CPDFEditViewController *baseVC;
 
 @property(nonatomic, assign) CPDFEditMode editMode;
 
 @property(nonatomic, strong) CPDFEditToolBar * toolBar;
+
+@property (nonatomic, strong) CPDFSignatureWidgetAnnotation * signatureAnnotation;
+
 @end
 
 @implementation CPDFViewController
@@ -57,7 +60,7 @@
     //titleButton
     CNavigationBarTitleButton * navTitleButton = [[CNavigationBarTitleButton alloc] init];
     self.titleButton = navTitleButton;
-    self.navigationTitle = NSLocalizedString(@"Edit", nil);
+    self.navigationTitle = NSLocalizedString(@"Content Edit", nil);
     [navTitleButton setImage:[UIImage imageNamed:@"syasarrow"] forState:UIControlStateNormal];
     [navTitleButton addTarget:self action:@selector(titleButtonClickd:) forControlEvents:UIControlEventTouchUpInside];
     [navTitleButton setTitle:self.navigationTitle forState:UIControlStateNormal];
@@ -134,7 +137,14 @@
         [self.pdfListView endOfEditing];
     }
     
-    [self viewWillLayoutSubviews];
+    CGFloat tPosY = 0;
+    CGFloat bottomY = 0;
+    
+    if (@available(iOS 11.0, *)) {
+        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tPosY- bottomY-self.view.safeAreaInsets.bottom);
+    } else {
+        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY-bottomY-20);
+    }
 }
 
 - (void)enterPDFShare  {
@@ -154,6 +164,15 @@
     [super enterPDFAddFile];
 }
 
+- (void)setTitleRefresh {
+    if (CToolModelEdit == self.pdfListView.toolModel) {
+        [self enterEditMode];
+    } else if (CToolModelViewer == self.pdfListView.toolModel) {
+        [self enterViewerMode];
+    }
+}
+
+
 #pragma mark - CPDFViewDelegate
 
 - (void)PDFListViewCustomMenuClick:(CPDFListView *)pdfView identifier:(NSString *)menuIdentifier {
@@ -172,8 +191,51 @@
     }
     
     [self.toolBar updateButtonState];
+    
+- (void)PDFListViewPerformTouchEnded:(CPDFListView *)pdfView {
+    CGFloat tPosY = 0;
+    CGFloat tBottomY = 0;
+
+    if(CToolModelViewer == self.pdfListView.toolModel) {
+        CGFloat tPosY = 0;
+        if (self.navigationController.navigationBarHidden) {
+            [self.navigationController setNavigationBarHidden:NO animated:YES];
+            [UIView animateWithDuration:0.3 animations:^{
+                self.pdfListView.pageSliderView.alpha = 1.0;
+            }];
+            CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
+            tPosY = self.navigationController.navigationBar.frame.size.height + rectStatus.size.height;
+
+        } else {
+            [self.navigationController setNavigationBarHidden:YES animated:YES];
+            [UIView animateWithDuration:0.3 animations:^{
+                self.pdfListView.pageSliderView.alpha = 0.0;
+            }];
+        }
+    }
+    
+    if (@available(iOS 11.0, *)) {
+        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tBottomY - tPosY);
+    } else {
+        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height  - tBottomY - tPosY);
+    }
+
 }
 
+- (void)PDFListViewPerformSignatureWidget:(CPDFListView *)pdfView forAnnotation:(CPDFSignatureWidgetAnnotation *)annotation {
+    if(CToolModelViewer == self.pdfListView.toolModel) {
+        self.signatureAnnotation = annotation;
+        AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
+        CPDFSignatureViewController *signatureVC = [[CPDFSignatureViewController alloc] initWithStyle:nil];
+        presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:signatureVC presentingViewController:self];
+        signatureVC.delegate = self;
+        signatureVC.transitioningDelegate = presentationController;
+        [self presentViewController:signatureVC animated:YES completion:nil];
+    }
+}
+
+#pragma mark - CPDFViewDelegate
+
 - (void)PDFViewEditingSelectStateDidChanged:(CPDFView *)pdfView {
     if([pdfView.editingArea isKindOfClass:[CPDFEditImageArea class]]) {
         self.editMode = CPDFEditModeImage;
@@ -229,6 +291,20 @@
     }
 }
 
+#pragma mark - CPDFSignatureViewControllerDelegate
+
+- (void)signatureViewControllerDismiss:(CPDFSignatureViewController *)signatureViewController {
+    self.signatureAnnotation = nil;
+}
+
+- (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController image:(UIImage *)image {
+    if(self.signatureAnnotation) {
+        [self.signatureAnnotation signWithImage:image];
+        [self.pdfListView setNeedsDisplayForPage:self.signatureAnnotation.page];
+        self.signatureAnnotation = nil;
+    }
+}
+
 #pragma mark - UIDocumentPickerDelegate
 
 - (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {

+ 10 - 2
Form-Ctrl-Demo/Form-Ctrl-Demo/AppDelegate.m

@@ -64,8 +64,16 @@ static AppDelegate *appDelegate = NULL;
     self.window.backgroundColor = [UIColor whiteColor];
     
     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Quick Start Guide" ofType:@"pdf"];
-        
-    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:filePath];
+    NSString *documentFolder = [NSHomeDirectory() stringByAppendingFormat:@"/%@/%@", @"Documents",@"Samples"];
+
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentFolder])
+        [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:documentFolder] withIntermediateDirectories:YES attributes:nil error:nil];
+    
+    NSString * documentPath = [documentFolder stringByAppendingPathComponent:filePath.lastPathComponent];
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentPath])
+        [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:filePath] toURL:[NSURL fileURLWithPath:documentPath] error:nil];
+    
+    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:documentPath password:nil];
     CNavigationController *navController = [[CNavigationController alloc]initWithRootViewController:pdfViewController];
 
     self.window.rootViewController = navController;

+ 1 - 1
compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj

@@ -116,7 +116,7 @@
 		C91BE7CD2A037A490038F2BC /* CPDFInkTopToolBar.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7CB2A037A490038F2BC /* CPDFInkTopToolBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		C91BE7CE2A037A490038F2BC /* CPDFInkTopToolBar.m in Sources */ = {isa = PBXBuildFile; fileRef = C91BE7CC2A037A490038F2BC /* CPDFInkTopToolBar.m */; };
 		C91BE7D02A037B080038F2BC /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C91BE7CF2A037B080038F2BC /* Image.xcassets */; };
-		C91BE7D42A039AC40038F2BC /* CPDFSignatureViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7D22A039AC40038F2BC /* CPDFSignatureViewController.h */; };
+		C91BE7D42A039AC40038F2BC /* CPDFSignatureViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7D22A039AC40038F2BC /* CPDFSignatureViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		C91BE7D52A039AC40038F2BC /* CPDFSignatureViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C91BE7D32A039AC40038F2BC /* CPDFSignatureViewController.m */; };
 		C91BE7D82A039D2A0038F2BC /* CPDFSignatureViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C91BE7D62A039D2A0038F2BC /* CPDFSignatureViewCell.h */; };
 		C91BE7D92A039D2A0038F2BC /* CPDFSignatureViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C91BE7D72A039D2A0038F2BC /* CPDFSignatureViewCell.m */; };

+ 1 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFBase/CPDFAnnotationBaseViewController.m

@@ -125,6 +125,7 @@
     self.sampleView.selecIndex = CPDFSamplesHighlight;
     self.colorView.colorLabel.text = NSLocalizedString(@"Color:", nil);
     self.colorView.selectedColor = self.annotStyle.color;
+    [self.colorView setNeedsLayout];
 }
 
 - (void)commomInitFromAnnotStyle {

+ 2 - 0
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFLink/CPDFLinkViewController.h

@@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)linkViewController:(CPDFLinkViewController *)linkViewController linkType:(CPDFLinkType)linkType linkString:(NSString *)linkString;
 
+- (void)linkViewControllerDismiss:(CPDFLinkViewController *)linkViewController isLink:(BOOL)isLink;
+
 @optional
 
 @end

+ 27 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFLink/CPDFLinkViewController.m

@@ -308,7 +308,33 @@
 #pragma mark - Action
 
 - (void)buttonItemClicked_back:(id)sender {
-    [self dismissViewControllerAnimated:YES completion:nil];
+    NSString *currentTextField = nil;
+
+    switch (self.segmentedControl.selectedSegmentIndex) {
+        case 0:
+            currentTextField = self.urlTextField.text;
+            break;
+        case 1:
+            currentTextField = self.pageTextField.text;
+            break;
+        default:
+        case 2:
+            currentTextField = self.emailTextField.text;
+            break;
+    }
+    
+    BOOL isLink;
+    if (!([currentTextField isEqual:@""])) {
+        isLink = YES;
+    } else {
+        isLink = NO;
+    }
+    
+    [self dismissViewControllerAnimated:YES completion:^{
+        if (self.delegate && [self.delegate respondsToSelector:@selector(linkViewControllerDismiss:isLink:)]) {
+            [self.delegate linkViewControllerDismiss:self isLink:isLink];
+        }
+    }];
 }
 
 - (void)segmentedControlValueChanged_Mode:(id)sender {

+ 6 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFNote/CPDFNoteOpenViewController.m

@@ -179,8 +179,13 @@
 }
 
 #pragma mark - Button Event Action
+
 - (void)buttonItemClicked_Delete:(id)sender {
-    self.noteTextView.text = @"";
+    [self dismissViewControllerAnimated:YES completion:^{
+        if (self.delegate && [self.delegate respondsToSelector:@selector(getNoteOpenViewController:content:isDelete:)]) {
+            [self.delegate getNoteOpenViewController:self content:self.noteTextView.text isDelete:YES];
+        }
+    }];
 }
 
 - (void)buttonItemClicked_Save:(id)sender {

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFNote/CPDFNoteViewController.m

@@ -82,6 +82,7 @@
     [self.sampleBackgoundView addSubview:self.sampleView];
     
     self.colorView = [[CPDFColorSelectView alloc] init];
+    self.colorView.selectedColor = self.annotStyle.color;
     self.colorView.delegate = self;
     self.colorView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
     [self.view addSubview:self.colorView];
@@ -116,7 +117,6 @@
 - (void)viewWillAppear:(BOOL)animated {
     self.sampleView.color = self.annotStyle.color;
     self.sampleView.selecIndex = CPDFSamplesNote;
-    self.colorView.selectedColor = self.annotStyle.color;
     [self.sampleView setNeedsDisplay];
 }
 

+ 1 - 1
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFSignature/CPDFSignatureViewController.h

@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) UITableView *tableView;
 
-- (instancetype)initWithStyle:(CAnnotStyle *)annotStyle;
+- (instancetype)initWithStyle:(nullable CAnnotStyle *)annotStyle;
 
 @end
 

+ 4 - 2
compdfkit-tools/compdfkit-tools/Common/Controls/PDFViewController/CPDFViewBaseController.h

@@ -30,9 +30,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property(nonatomic, strong) CNavigationBarTitleButton * titleButton;
 
-- (instancetype)initWithFilePath:(NSString *)filePath;
+- (instancetype)initWithFilePath:(NSString *)filePath password:(nullable NSString *)password;
 
-- (void)reloadDocumentWithFilePath:(NSString *)filePath completion:(void (^)(BOOL result))completion;
+- (void)reloadDocumentWithFilePath:(NSString *)filePath password:(nullable NSString *)password completion:(void (^)(BOOL result))completion;
 
 - (void)initWitNavigationTitle;
 
@@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)enterPDFAddFile;
 
+- (void)setTitleRefresh;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 36 - 28
compdfkit-tools/compdfkit-tools/Common/Controls/PDFViewController/CPDFViewBaseController.m

@@ -31,15 +31,18 @@
 
 @property(nonatomic, strong) UIBarButtonItem * leftBarButtonItem;
 
+@property(nonatomic, strong) NSString *password;
+
 @end
 
 @implementation CPDFViewBaseController
 
 #pragma mark - Initializers
 
-- (instancetype)initWithFilePath:(NSString *)filePath {
+- (instancetype)initWithFilePath:(NSString *)filePath password:(nullable NSString *)password{
     if(self = [super init]) {
         self.filePath = filePath;
+        self.password = password;
     }
     return self;
 }
@@ -57,7 +60,7 @@
     
     [self initWithSearchTool];
             
-    [self reloadDocumentWithFilePath:self.filePath completion:^(BOOL result) {
+    [self reloadDocumentWithFilePath:self.filePath password:self.password completion:^(BOOL result) {
         
     }];
 }
@@ -100,15 +103,6 @@
     self.searchToolbar.delegate = self;
 }
 
-- (BOOL)copyMissingFile:(NSString*)sourcePath toPath:(NSString*)toPath {
-    BOOL retVal = YES;
-    NSString * finalLocation = [toPath stringByAppendingPathComponent:[sourcePath lastPathComponent]];
-    if(![[NSFileManager defaultManager]  fileExistsAtPath:finalLocation]) {
-        retVal = [[NSFileManager defaultManager] copyItemAtPath:sourcePath toPath:finalLocation error:NULL];
-    }
-    return retVal;
-}
-
 - (void)enterPDFSetting  {
     [self.popMenu hideMenu];
     CPDFDisplayViewController *displayVc = [[CPDFDisplayViewController alloc] initWithPDFView:self.pdfListView];
@@ -171,7 +165,7 @@
     self.navigationItem.titleView = self.titleButton;
 }
 
-- (void)reloadDocumentWithFilePath:(NSString *)filePath completion:(void (^)(BOOL result))completion {
+- (void)reloadDocumentWithFilePath:(NSString *)filePath password:(nullable NSString *)password completion:(void (^)(BOOL result))completion {
     
     _navigationTitle = self.title;
     //
@@ -186,6 +180,9 @@
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         NSURL *url = [NSURL fileURLWithPath:filePath];
         CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url];
+        if([document isLocked]) {
+            [document unlockWithPassword:password];
+        }
         dispatch_async(dispatch_get_main_queue(), ^{
             [self.navigationController.view setUserInteractionEnabled:YES];
             [self.loadingView stopAnimating];
@@ -212,11 +209,17 @@
     });
 }
 
+
+- (void)setTitleRefresh {
+    
+}
+
 #pragma mark - Action
 
 - (void)navigationRightItemSearch {
     [self.searchToolbar showInView:self.navigationController.navigationBar];
-    self.title = nil;
+    self.navigationTitle = @"";
+    self.titleButton.hidden = YES;
     self.navigationItem.rightBarButtonItem = nil;
     self.navigationItem.leftBarButtonItem = nil;
 }
@@ -298,6 +301,8 @@
         
         self.navigationItem.leftBarButtonItem = self.leftBarButtonItem;
     }
+    self.navigationTitle = @"Viewer";
+    self.titleButton.hidden = NO;
 }
 
 #pragma mark - CPDFDisplayViewDelegate
@@ -323,6 +328,7 @@
 
 - (void)searchResultsViewControllerDismiss:(CPDFSearchResultsViewController *)searchResultsViewController {
     [self.navigationController popViewControllerAnimated:YES];
+
 }
 
 #pragma mark - CPDFPopMenuDelegate
@@ -391,28 +397,30 @@
         NSError *error;
         [fileCoordinator coordinateReadingItemAtURL:urls.firstObject options:0 error:&error byAccessor:^(NSURL *newURL) {
             
-            NSFileManager * fileManager = [NSFileManager defaultManager];
-            NSString * appDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
-            NSString *fileName = [newURL lastPathComponent];
-            NSString * filePath = [appDir stringByAppendingPathComponent:fileName];
+            NSString *documentFolder = [NSHomeDirectory() stringByAppendingFormat:@"/%@/%@", @"Documents",@"Files"];
+
+            if (![[NSFileManager defaultManager] fileExistsAtPath:documentFolder])
+                [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:documentFolder] withIntermediateDirectories:YES attributes:nil error:nil];
             
-            if([fileManager fileExistsAtPath:filePath])
-                [[NSFileManager defaultManager] removeItemAtURL:[NSURL fileURLWithPath:filePath] error:nil];
-        
-            if(![fileManager fileExistsAtPath:filePath]) {
-                BOOL filePresent = [weakSelf copyMissingFile:newURL.path toPath:appDir];
-                NSString * savedPath = [NSString stringWithFormat:@"%@/%@",appDir,fileName];
-                
-                [weakSelf reloadDocumentWithFilePath:savedPath completion:^(BOOL result) {
-                    [weakSelf.pdfListView reloadInputViews];
-                }];
+            NSString * documentPath = [documentFolder stringByAppendingPathComponent:[newURL lastPathComponent]];
+            if (![[NSFileManager defaultManager] fileExistsAtPath:documentPath]) {
+               [[NSFileManager defaultManager] copyItemAtPath:newURL.path toPath:documentPath error:NULL];
+
             }
-            NSError *error = nil;
+            [weakSelf reloadDocumentWithFilePath:documentPath password:nil completion:^(BOOL result) {
+                [weakSelf.pdfListView reloadInputViews];
+            }];
+
             [self dismissViewControllerAnimated:YES completion:NULL];
             
         }];
         [urls.firstObject stopAccessingSecurityScopedResource];
     }
+    [self setTitleRefresh];
+}
+
+- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
+    [self setTitleRefresh];
 }
 
 @end

+ 2 - 2
compdfkit-tools/compdfkit-tools/Common/Controls/Tools/CPDFToolsViewController.m

@@ -35,7 +35,7 @@
 
 - (instancetype)init{
     if(self = [super init]) {
-        self.titleArr = [[NSMutableArray alloc] initWithObjects:NSLocalizedString(@"Viewer",nil),NSLocalizedString(@"Edit",nil), nil];
+        self.titleArr = [[NSMutableArray alloc] initWithObjects:NSLocalizedString(@"Viewer",nil),NSLocalizedString(@"Content Edit",nil), nil];
         self.iconArr = [[NSMutableArray alloc] initWithObjects:@"CNavigationImageNameViewer",@"CNavigationImageNameEditTool",nil];
     }
     return self;
@@ -51,7 +51,7 @@
                 [self.titleArr addObject:NSLocalizedString(@"Viewer",nil)];
                 [self.iconArr addObject:@"CNavigationImageNameViewer"];
             } else if (CToolModelEdit == num.integerValue) {
-                [self.titleArr addObject:NSLocalizedString(@"Edit",nil)];
+                [self.titleArr addObject:NSLocalizedString(@"Content Edit",nil)];
                 [self.iconArr addObject:@"CNavigationImageNameEditTool"];
             } else if (CToolModelAnnotation == num.integerValue) {
                 [self.titleArr addObject:NSLocalizedString(@"Annotation",nil)];

+ 10 - 4
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -265,10 +265,7 @@
     [self addSubview:self.propertiesBar];
     
     UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(offset, 12, 1, 20)];
-    if (@available(iOS 13.0, *))
-        lineView.backgroundColor = [UIColor labelColor];
-    else
-        lineView.backgroundColor = [UIColor blackColor];
+    lineView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.1];
     
     [self.propertiesBar addSubview:lineView];
     offset += lineView.frame.size.width;
@@ -631,6 +628,7 @@
     if(self.signatureAnnotation) {
         [self.signatureAnnotation signWithImage:image];
         [self.pdfListView setNeedsDisplayForPage:self.signatureAnnotation.page];
+        self.signatureAnnotation = nil;
     } else {
         CPDFSignatureAnnotation *annotation = [[CPDFSignatureAnnotation alloc] initWithDocument:self.annotManage.pdfListView.document];
         [annotation setImage:image];
@@ -834,6 +832,14 @@
     [self.pdfListView setNeedsDisplayForPage:linkAnnotation.page];
 }
 
+- (void)linkViewControllerDismiss:(CPDFLinkViewController *)linkViewController isLink:(BOOL)isLink {
+    if (!isLink) {
+        [((CPDFAnnotation *)linkViewController.annotStyle.annotations.firstObject).page removeAnnotation:linkViewController.annotStyle.annotations.firstObject];
+        [self.annotManage.pdfListView setNeedsDisplayForPage:self.annotManage.pdfListView.activeAnnotation.page];
+        [self.annotManage.pdfListView updateActiveAnnotations:@[]];
+    }
+}
+
 #pragma mark - CPDFDrawPencilViewDelegate
 
 - (void)drawPencilFuncView:(CPDFDrawPencilKitFuncView *)view eraserBtn:(UIButton *)btn {

+ 1 - 1
compdfkit-tools/compdfkit-tools/Common/Views/PDFProperties/CPDFAnnotationSampleView.m

@@ -161,7 +161,7 @@
             NSString *sampleStr = @"Sample";
             CGFloat red, green, blue, alpha;
             [self.color getRed:&red green:&green blue:&blue alpha:&alpha];
-            CGContextSetFillColorWithColor(context, [UIColor colorWithRed:red green:green blue:blue alpha:self.opcity].CGColor);
+            CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:red green:green blue:blue alpha:self.opcity].CGColor);
             
             float tWidth = self.textRect.size.width / 12.0;
             CGContextMoveToPoint(context, CGRectGetMinX(self.textRect), CGRectGetMaxY(self.textRect));

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

@@ -144,7 +144,7 @@
         [menuItems addObject:editNoteItem];
         [menuItems addObject:deleteItem];
     } else if ([annotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
-        UIMenuItem *addHereItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Signature", nil)
+        UIMenuItem *addHereItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Sign", nil)
                                                             action:@selector(menuItemClick_Signature:)];
         
         [menuItems addObject:addHereItem];

+ 20 - 12
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView+Edit.m

@@ -89,20 +89,23 @@
                 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:)];                
+                UIMenuItem * extractItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Export", nil) action:@selector(extractActionClick:)];
                 
                 [menuItems addObject:leftRotateItem];
                 [menuItems addObject:rightRotateItem];
                 [menuItems addObject:rPlaceItem];
                 [menuItems addObject:cropItem];
-                [menuItems addObject:cutItem];
-                [menuItems addObject:copyItem];
+                if(cutItem)
+                    [menuItems addObject:cutItem];
+                if(copyItem)
+                    [menuItems addObject:copyItem];
                 [menuItems addObject:opacityItem];
-
+                
                 [menuItems addObject:hMirrorItem];
                 [menuItems addObject:vMirrorItem];
                 [menuItems addObject:extractItem];
-                [menuItems addObject:deleteItem];
+                if(deleteItem)
+                    [menuItems addObject:deleteItem];
             }else{
                 [menuItems removeAllObjects];
                 UIMenuItem * propertyItem  = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"Properties", nil) action:@selector(propertyEditingItemAction:)];
@@ -125,13 +128,18 @@
                         deleteItem = item;
                     }
                 }
-                
-                [menuItems addObject:editItem];
-                [menuItems addObject:copyItem];
-                [menuItems addObject:cutItem];
-                [menuItems addObject:propertyItem];
-                [menuItems addObject:opacityItem];
-                [menuItems addObject:deleteItem];
+                if(editItem)
+                    [menuItems addObject:editItem];
+                if(copyItem)
+                    [menuItems addObject:copyItem];
+                if(cutItem)
+                    [menuItems addObject:cutItem];
+                if(propertyItem)
+                    [menuItems addObject:propertyItem];
+                if(opacityItem)
+                    [menuItems addObject:opacityItem];
+                if(deleteItem)
+                    [menuItems addObject:deleteItem];
             }
         }
     }

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

@@ -182,9 +182,23 @@ NSNotificationName const CPDFListViewAnnotationsOperationChangeNotification = @"
     } else if (CToolModelEdit == self.toolModel) {
         
     } else {
-        if ([self.performDelegate respondsToSelector:@selector(PDFListViewPerformTouchEnded:)]) {
-            [self.performDelegate PDFListViewPerformTouchEnded:self];
+        CPDFAnnotation *annotation = [page annotationAtPoint:point];
+        if(annotation) {
+            if ([annotation isKindOfClass:[CPDFSignatureWidgetAnnotation class]]) {
+                if ([(CPDFSignatureWidgetAnnotation *)annotation isSigned]) {
+                } else {
+                    if ([self.performDelegate respondsToSelector:@selector(PDFListViewPerformSignatureWidget:forAnnotation:)]) {
+                        [self.performDelegate PDFListViewPerformSignatureWidget:self forAnnotation:(CPDFSignatureWidgetAnnotation *)annotation];
+                    }
+                }
+            } 
+            [super touchEndedAtPoint:point forPage:page];
+        } else {
+            if ([self.performDelegate respondsToSelector:@selector(PDFListViewPerformTouchEnded:)]) {
+                [self.performDelegate PDFListViewPerformTouchEnded:self];
+            }
         }
+
     }
 }
 

+ 0 - 2
compdfkit-tools/compdfkit-tools/Edit/CPDFEditCell/CPDFEditFontNameSelectView.h

@@ -7,10 +7,8 @@
 //  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
 //
 
-
 #import <UIKit/UIKit.h>
 
-
 NS_ASSUME_NONNULL_BEGIN
 
 @class CPDFEditFontNameSelectView;

+ 6 - 8
compdfkit-tools/compdfkit-tools/Edit/CPDFEditCell/CPDFEditFontNameSelectView.m

@@ -93,20 +93,18 @@
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentity];
     }
     
-    if(indexPath.row == [[[NSUserDefaults standardUserDefaults] objectForKey:kSetTodoRemindCycle] integerValue])
-
-    {
-
+    UIFont *cellFont = [UIFont fontWithName:self.fontNameArr[indexPath.row] size:15];
+    UIFont *selectFont = [UIFont fontWithName:self.fontName size:15];
+    
+    if([cellFont isEqual:selectFont]){
         recordRow = indexPath.row;
         current = indexPath;
         cell.accessoryType = UITableViewCellAccessoryCheckmark;
-
-    }else
-
-    {
+    } else {
         cell.accessoryType = UITableViewCellAccessoryNone;
     }
     
+    
     cell.textLabel.text = self.fontNameArr[indexPath.row];
     
     return cell;

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

@@ -35,6 +35,8 @@
 - (instancetype)initWithPDFView:(CPDFView *)pdfView {
     if (self = [super init]) {
         _pdfView = pdfView;
+        
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageChangedNotification:) name:CPDFViewPageChangedNotification object:nil];
     }
     return self;
 }
@@ -217,4 +219,13 @@
         self.undoButton.enabled  = NO;
 }
 
+#pragma mark - NSNotification
+
+- (void)pageChangedNotification:(NSNotification *)notification {
+    CPDFView *pdfview = notification.object;
+    if (pdfview.document == self.pdfView.document) {
+        [self updateButtonState];
+    }
+}
+
 @end

+ 1 - 0
compdfkit-tools/compdfkit-tools/Edit/CPDFEditViewController.m

@@ -244,6 +244,7 @@
                 //Add actionFontNameSelect
                 self.fontSelectView = [[CPDFEditFontNameSelectView alloc] initWithFrame:self.view.bounds];
                 self.fontSelectView.fontNameArr = [NSMutableArray arrayWithArray:[self.pdfView getFontList]];
+                self.fontSelectView.fontName = self.textSampleView.fontName;
                 self.fontSelectView.delegate = self;
                 self.fontSelectView.backgroundColor = [CPDFColorUtils CPDFViewControllerBackgroundColor];
                 

+ 12 - 3
compdfkit-tools/compdfkit-tools/Viewer/PDFAnnotation/CPDFAnnotationListCell.m

@@ -124,9 +124,18 @@
         }
     } else {
         if ([annotation contents] && ![[annotation contents] isEqualToString:@""]){
-            _contentLabel.hidden = NO;
-            _contentLabel.text = [annotation contents];
-            
+            NSArray<NSString *> *contextArray = [[annotation contents] componentsSeparatedByString:@"\n"];
+            if (contextArray.count >3) {
+                NSString *newContents = @"";
+                for (int i = 0; i < 2; i++) {
+                    newContents = [newContents stringByAppendingFormat:@"%@\n", contextArray[i]];
+                }
+                _contentLabel.hidden = NO;
+                _contentLabel.text = [newContents stringByAppendingString:@"..."];
+            } else {
+                _contentLabel.hidden = NO;
+                _contentLabel.text = [annotation contents];
+            }
         }else{
             _contentLabel.hidden = YES;
         }

+ 3 - 3
compdfkit-tools/compdfkit-tools/Viewer/PDFOutlie/CPDFOutlineViewCell.m

@@ -19,15 +19,15 @@
     self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
     if (self) {
         
-        UIButton *arrowButton = [[UIButton alloc] initWithFrame:CGRectMake(5, 8, 16, 16)];
+        UIButton *arrowButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 4, 36, 26)];
         [arrowButton addTarget:self action:@selector(buttonItemClicked_Arrow:) forControlEvents:UIControlEventTouchUpInside];
         [arrowButton setImage:[UIImage imageNamed:@"CPDFOutlineImageBotaMore" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateSelected];
         [arrowButton setImage:[UIImage imageNamed:@"CPDFOutlineImageBotaMoreLeft" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil] forState:UIControlStateNormal];
         _arrowButton = arrowButton;
-        UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(50 + self.offsetX.constant, 0, self.bounds.size.width - self.offsetX.constant - 120, 16)];
+        UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(70 + self.offsetX.constant, 0, self.bounds.size.width - self.offsetX.constant - 120, 26)];
         _nameLabel = nameLabel;
         _nameLabel.font = [UIFont systemFontOfSize:14.];
-        UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.bounds.size.width-55, 0, 50, 16)];
+        UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.bounds.size.width-55, 0, 50, 26)];
         
         countLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
         _countLabel = countLabel;

+ 1 - 10
compdfkit-tools/compdfkit-tools/Viewer/PDFOutlie/Image.xcassets/CPDFOutlineImageBotaMore.imageset/Contents.json

@@ -2,16 +2,7 @@
   "images" : [
     {
       "filename" : "tri.pdf",
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x"
+      "idiom" : "universal"
     }
   ],
   "info" : {

+ 1 - 10
compdfkit-tools/compdfkit-tools/Viewer/PDFOutlie/Image.xcassets/CPDFOutlineImageBotaMoreLeft.imageset/Contents.json

@@ -2,16 +2,7 @@
   "images" : [
     {
       "filename" : "tri.pdf",
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x"
+      "idiom" : "universal"
     }
   ],
   "info" : {

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

@@ -66,6 +66,7 @@
 #import <compdfkit_tools/CPDFDrawPencilKitFuncView.h>
 #import <compdfkit_tools/CAnnotationManage.h>
 #import <compdfkit_tools/CPDFNoteOpenViewController.h>
+#import <compdfkit_tools/CPDFSignatureViewController.h>
 #import <compdfkit_tools/AAPLCustomPresentationController.h>
 //Edit
 #import <compdfkit_tools/CPDFEditToolBar.h>

+ 10 - 2
viewer-ctrl-demo/viewer-ctrl-demo/AppDelegate.m

@@ -64,8 +64,16 @@ static AppDelegate *appDelegate = NULL;
     self.window.backgroundColor = [UIColor whiteColor];
     
     NSString *filePath = [[NSBundle mainBundle] pathForResource:@"PDF32000_2008" ofType:@"pdf"];
-        
-    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:filePath];
+    NSString *documentFolder = [NSHomeDirectory() stringByAppendingFormat:@"/%@/%@", @"Documents",@"Samples"];
+
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentFolder])
+        [[NSFileManager defaultManager] createDirectoryAtURL:[NSURL fileURLWithPath:documentFolder] withIntermediateDirectories:YES attributes:nil error:nil];
+    
+    NSString * documentPath = [documentFolder stringByAppendingPathComponent:filePath.lastPathComponent];
+    if (![[NSFileManager defaultManager] fileExistsAtPath:documentPath])
+        [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:filePath] toURL:[NSURL fileURLWithPath:documentPath] error:nil];
+    
+    CPDFViewController *pdfViewController = [[CPDFViewController alloc] initWithFilePath:documentPath password:nil];
     CNavigationController *navController = [[CNavigationController alloc]initWithRootViewController:pdfViewController];
 
     self.window.rootViewController = navController;

+ 30 - 3
viewer-ctrl-demo/viewer-ctrl-demo/CPDFViewController.m

@@ -14,7 +14,9 @@
 
 #import <ComPDFKit/ComPDFKit.h>
 
-@interface CPDFViewController ()
+@interface CPDFViewController ()<CPDFSignatureViewControllerDelegate>
+
+@property (nonatomic, strong) CPDFSignatureWidgetAnnotation * signatureAnnotation;
 
 @end
 
@@ -52,9 +54,9 @@
     }
     
     if (@available(iOS 11.0, *)) {
-        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tPosY- bottomY);
+        self.pdfListView.frame = CGRectMake(self.view.safeAreaInsets.left, tPosY, self.view.frame.size.width - self.view.safeAreaInsets.left - self.view.safeAreaInsets.right, self.view.frame.size.height - tPosY- bottomY-self.view.safeAreaInsets.bottom);
     } else {
-        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY-bottomY);
+        self.pdfListView.frame = CGRectMake(0, tPosY, self.view.frame.size.width, self.view.frame.size.height - tPosY-bottomY-20);
     }
 }
 
@@ -84,4 +86,29 @@
     }
 }
 
+- (void)PDFListViewPerformSignatureWidget:(CPDFListView *)pdfView forAnnotation:(CPDFSignatureWidgetAnnotation *)annotation {
+    self.signatureAnnotation = annotation;
+    AAPLCustomPresentationController *presentationController NS_VALID_UNTIL_END_OF_SCOPE;
+    CPDFSignatureViewController *signatureVC = [[CPDFSignatureViewController alloc] initWithStyle:nil];
+    presentationController = [[AAPLCustomPresentationController alloc] initWithPresentedViewController:signatureVC presentingViewController:self];
+    signatureVC.delegate = self;
+    signatureVC.transitioningDelegate = presentationController;
+    [self presentViewController:signatureVC animated:YES completion:nil];
+}
+
+#pragma mark - CPDFSignatureViewControllerDelegate
+
+- (void)signatureViewControllerDismiss:(CPDFSignatureViewController *)signatureViewController {
+    self.signatureAnnotation = nil;
+}
+
+- (void)signatureViewController:(CPDFSignatureViewController *)signatureViewController image:(UIImage *)image {
+    if(self.signatureAnnotation) {
+        [self.signatureAnnotation signWithImage:image];
+        [self.pdfListView setNeedsDisplayForPage:self.signatureAnnotation.page];
+        self.signatureAnnotation = nil;
+    }
+}
+
+
 @end