Browse Source

【数字签名】PDF Pro Mac 代码迁移

lizhe 1 year ago
parent
commit
85e1e01a5d
86 changed files with 14140 additions and 320 deletions
  1. 452 10
      PDF Office/PDF Master.xcodeproj/project.pbxproj
  2. 1343 127
      PDF Office/PDF Master.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  3. 41 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CDSDrawView.h
  4. 428 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CDSDrawView.m
  5. 113 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CPDFDigtalView.h
  6. 815 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CPDFDigtalView.m
  7. 26 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFAnnotation+PDFListView.h
  8. 30 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFAnnotation+PDFListView.m
  9. 28 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFListViewConfig.h
  10. 46 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFListViewConfig.m
  11. 19 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSelection+PDFListView.h
  12. 22 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSelection+PDFListView.m
  13. 17 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureAnnotation+PDFListView.h
  14. 21 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureAnnotation+PDFListView.m
  15. 25 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureWidgetAnnotation+PDFListView.h
  16. 69 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureWidgetAnnotation+PDFListView.m
  17. 29 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSEvent+PDFListView.h
  18. 46 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSEvent+PDFListView.m
  19. 0 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSGeometry+PDFListView.h
  20. 0 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSGeometry+PDFListView.m
  21. 413 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.swift
  22. 166 0
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.xib
  23. 397 0
      PDF Office/PDF Master/Class/DigtalSignature/DSignatureApperanceManager.swift
  24. 135 0
      PDF Office/PDF Master/Class/DigtalSignature/DSignatureConfig.swift
  25. 422 0
      PDF Office/PDF Master/Class/DigtalSignature/DSignatureConfigWindowController.swift
  26. 47 0
      PDF Office/PDF Master/Class/DigtalSignature/DSignatureConfigWindowController.xib
  27. 150 0
      PDF Office/PDF Master/Class/DigtalSignature/DSignatureManager.swift
  28. 21 0
      PDF Office/PDF Master/Class/DigtalSignature/DSignatureModel.swift
  29. 55 0
      PDF Office/PDF Master/Class/DigtalSignature/KMDSignatureManager.h
  30. 526 0
      PDF Office/PDF Master/Class/DigtalSignature/KMDSignatureManager.m
  31. 716 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateCustomViewController.swift
  32. 644 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateCustomViewController.xib
  33. 98 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateStateViewController.swift
  34. 131 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateStateViewController.xib
  35. 88 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureDrawViewController.swift
  36. 104 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureDrawViewController.xib
  37. 69 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureTextViewController.swift
  38. 121 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureTextViewController.xib
  39. 422 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCertifyDetailViewController.swift
  40. 287 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCertifyDetailViewController.xib
  41. 291 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateInfoViewController.swift
  42. 359 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateInfoViewController.xib
  43. 134 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateViewController.swift
  44. 342 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateViewController.xib
  45. 679 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureDetailsViewController.swift
  46. 789 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureDetailsViewController.xib
  47. 307 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFileListViewController.swift
  48. 219 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFileListViewController.xib
  49. 175 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFromFileViewController.swift
  50. 283 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFromFileViewController.xib
  51. 246 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveFolderViewController.swift
  52. 303 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveFolderViewController.xib
  53. 126 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveTypeViewController.swift
  54. 338 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveTypeViewController.xib
  55. 77 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignDetailTypeACellView.swift
  56. 38 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignDetailTypeACellView.xib
  57. 128 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignatureFileListCellView.swift
  58. 145 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignatureFileListCellView.xib
  59. 30 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignatureFilelistRow.swift
  60. 26 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/PDFCertExportAccessoryView.swift
  61. 64 0
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/PDFCertExportAccessoryView.xib
  62. 8 0
      PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/KMQucikToolsView.swift
  63. 1 1
      PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionViewItem.swift
  64. 1 1
      PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWindowController.swift
  65. 1 1
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.swift
  66. 1 1
      PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m
  67. 1 1
      PDF Office/PDF Master/Class/PDFTools/Secure/Controller/KMSecureEncryptWindowController.swift
  68. 1 1
      PDF Office/PDF Master/Class/PDFTools/Secure/Window/KMPasswordInputWindow.swift
  69. 1 1
      PDF Office/PDF Master/Class/PDFTools/Watermark/View/KMWatermarkAdjectiveStepper.swift
  70. 13 13
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift
  71. BIN
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit
  72. 0 8
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument+Protected.h
  73. 40 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument.h
  74. 6 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKit.h
  75. 244 44
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSignature.h
  76. 0 50
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSignatureWidgetAnnotation+Signature.h
  77. 57 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSignatureWidgetAnnotation.h
  78. 23 12
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFView+Editing.h
  79. 0 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/ComPDFKit.h
  80. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Info.plist
  81. 17 28
      PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources
  82. 20 15
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Signature/KMSignatureViewController.swift
  83. 1 1
      PDF Office/PDF Master/Class/Preference/Window/KMPreferenceWindowController.swift
  84. 7 0
      PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h
  85. 8 0
      PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h
  86. 6 0
      PDF Office/PDF Master/PDF_Master-Bridging-Header.h

File diff suppressed because it is too large
+ 452 - 10
PDF Office/PDF Master.xcodeproj/project.pbxproj


File diff suppressed because it is too large
+ 1343 - 127
PDF Office/PDF Master.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist


+ 41 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CDSDrawView.h

@@ -0,0 +1,41 @@
+//
+//  CDSDrawView.h
+//  PDFViewer-Mac
+//
+//  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 <Cocoa/Cocoa.h>
+
+@class CDSDrawView;
+
+@protocol CDSDrawViewDelegate <NSObject>
+
+@optional
+- (void)drawViewDidFinishTouchMode:(CDSDrawView *)view;
+
+@end
+
+@interface CDSDrawView : NSView
+
+@property (nonatomic,assign) id<CDSDrawViewDelegate> delegate;
+
+@property (nonatomic,retain) NSColor *drawColor;
+@property (nonatomic,retain) NSImage *drawImage;
+@property (nonatomic,assign) float strokeRadius;
+
+@property (nonatomic,assign) BOOL isAcceptsTouch;
+
+@property (nonatomic,retain) NSBezierPath *drawBezierPath;
+
+- (void)clearImage;
+
+- (NSImage *)signatureImage;
+
+
+@end

+ 428 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CDSDrawView.m

@@ -0,0 +1,428 @@
+//
+//  CDSDrawView.m
+//  PDFViewer-Mac
+//
+//  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 "CDSDrawView.h"
+
+static NSInteger _index;
+static CGPoint _points[5];
+
+@interface CDSDrawView ()
+
+@property (nonatomic,assign) BOOL cursorIsHidden;
+@property (nonatomic,assign) BOOL mouseIsInView;
+
+@property (nonatomic,retain) NSTouch *activeTouch;
+
+@property (nonatomic,retain) NSBezierPath *bezierPath;
+
+@property (nonatomic,assign) BOOL isInView;
+
+@end
+
+@implementation CDSDrawView
+
+- (void)dealloc {
+ 
+}
+
+- (id)initWithFrame:(NSRect)frameRect {
+    if (self = [super initWithFrame:frameRect]) {
+        self.drawImage = [[NSImage alloc] initWithSize:self.frame.size];
+        self.drawColor = [NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1];
+        self.strokeRadius = 0.3;
+        
+        _bezierPath = [[NSBezierPath alloc] init];
+        
+        self.wantsLayer = YES;
+        self.layer.borderWidth = 1.0;
+        self.layer.borderColor =[NSColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.05].CGColor;
+
+    }
+    return self;
+}
+
+- (id)initWithCoder:(NSCoder *)coder {
+    if (self = [super initWithCoder:coder]) {
+        self.drawImage = [[NSImage alloc] initWithSize:self.frame.size];
+        self.drawColor = [NSColor colorWithDeviceRed:0 green:0 blue:0 alpha:1];
+        self.strokeRadius = 0.3;
+        
+        _bezierPath = [[NSBezierPath alloc] init];
+        
+        self.wantsLayer = YES;
+        self.layer.borderWidth = 1.0;
+        self.layer.borderColor =[NSColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.05].CGColor;
+
+    }
+    return self;
+}
+
+- (NSBezierPath *)drawBezierPath {
+    _drawBezierPath = [_bezierPath copy];
+    
+    CGRect rect = self.bezierPath.bounds;
+    NSAffineTransform *transform = [NSAffineTransform transform];
+    [transform translateXBy:- rect.origin.x + +self.bezierPath.lineWidth/2.0 yBy:-rect.origin.y + self.bezierPath.lineWidth/2.0];
+    [_drawBezierPath transformUsingAffineTransform:transform];
+    
+    return _drawBezierPath;
+}
+
+/*
+ ** - (BOOL) acceptsFirstResponder
+ **
+ ** Make sure the view will receive
+ ** events.
+ **
+ ** Input: none
+ **
+ ** Output: YES to accept, NO to reject
+ */
+- (BOOL)acceptsFirstResponder {
+    return YES;
+}
+
+- (void)setIsAcceptsTouch:(BOOL)isAcceptsTouch {
+    _isAcceptsTouch = isAcceptsTouch;
+    
+    // Accept trackpad events
+    [self setAcceptsTouchEvents:isAcceptsTouch];
+    
+    size_t screenHeight = CGDisplayPixelsHigh(CGMainDisplayID());
+    NSRect frameToWindow = [self convertRect:self.bounds toView:nil];
+    NSRect frameToScreen = [self.window convertRectToScreen:frameToWindow];
+    if (isAcceptsTouch) {
+        // If the mouse cursor is not already hidden,
+        if (!self.cursorIsHidden) {
+            frameToScreen.origin.x = frameToScreen.origin.x+5;
+            frameToScreen.origin.y = screenHeight-frameToScreen.origin.y-5;
+            CGWarpMouseCursorPosition(frameToScreen.origin);
+
+            // Detach the mouse cursor from the mouse
+            // hardware so that moving the mouse (or a
+            // single finger) will not move the cursor
+            CGAssociateMouseAndMouseCursorPosition(false);
+            
+            // Hide the mouse cursor
+            [NSCursor hide];
+            
+            // Remember that we detached and hid the
+            // mouse cursor
+            self.cursorIsHidden = YES;
+        }
+    } else {
+        frameToScreen.origin.y = screenHeight-frameToScreen.origin.y;
+        CGWarpMouseCursorPosition(frameToScreen.origin);
+
+        // Attach the mouse cursor to the mouse
+        // hardware so that moving the mouse (or a
+        // single finger) will move the cursor
+        CGAssociateMouseAndMouseCursorPosition(true);
+        
+        // Show the mouse cursor
+        [NSCursor unhide];
+        
+        // Remember that we attached and unhid the
+        // mouse cursor so that the next touch that
+        // begins will detach and hide it
+        self.cursorIsHidden = NO;
+    }
+}
+
+- (void)clearImage {
+    self.drawImage = nil;
+    [self.bezierPath removeAllPoints];
+    [self setNeedsDisplay:YES];
+}
+
+- (void)setDrawColor:(NSColor *)drawColor {
+    if (_drawColor != drawColor) {
+        _drawColor = drawColor;
+    }
+    [self setNeedsDisplay:YES];
+}
+
+- (void)setStrokeRadius:(float)strokeRadius {
+    _strokeRadius = strokeRadius;
+    [self setNeedsDisplay:YES];
+}
+
+
+- (NSImage *)signatureImage {
+    CGRect rect = CGRectZero;
+
+    if (self.bezierPath.empty) {
+        return nil;
+    } else {
+        rect = self.bezierPath.bounds;
+    }
+    
+    CGSize size = CGSizeMake(rect.size.width+self.bezierPath.lineWidth,
+                             rect.size.height+self.bezierPath.lineWidth);
+    NSImage *image = [[NSImage alloc] initWithSize:size];
+    [image lockFocus];
+    
+    [self.drawColor set];
+    [self.drawBezierPath setLineWidth:self.strokeRadius * 2];
+    [self.drawBezierPath setLineCapStyle:kCGLineCapRound];
+    [self.drawBezierPath setLineJoinStyle:kCGLineJoinRound];
+    [self.drawBezierPath stroke];
+
+    [image unlockFocus];
+
+    return image;
+}
+
+#pragma mark Draw
+- (void)drawRect:(NSRect)dirtyRect {
+    [super drawRect:dirtyRect];
+    
+    [NSGraphicsContext saveGraphicsState];
+    [[NSColor clearColor] set];
+
+    if (([[self window] firstResponder] == self) && self.mouseIsInView) {
+        NSSetFocusRingStyle(NSFocusRingAbove);
+    }
+    [[NSBezierPath bezierPathWithRect:[self bounds]] fill];
+    
+    [NSGraphicsContext restoreGraphicsState];
+
+    if (self.drawImage) {
+        CGRect imageFrame = [self imageFrameInRect:self.bounds];
+        [self.drawImage drawInRect:imageFrame];
+    }
+    
+    [self.drawColor set];
+    [self.bezierPath setLineWidth:self.strokeRadius * 2];
+    [self.bezierPath setLineCapStyle:kCGLineCapRound];
+    [self.bezierPath setLineJoinStyle:kCGLineJoinRound];
+    [self.bezierPath stroke];
+}
+
+- (CGRect)imageFrameInRect:(CGRect)rect {
+    CGRect imageRect;
+    if (self.drawImage.size.width < rect.size.width &&
+        self.drawImage.size.height < rect.size.height) {
+        imageRect.origin.x = (rect.size.width-self.drawImage.size.width)/2.0;
+        imageRect.origin.y = (rect.size.height-self.drawImage.size.height)/2.0;
+        imageRect.size = self.drawImage.size;
+    } else {
+        if (self.drawImage.size.width/self.drawImage.size.height >
+            rect.size.width/rect.size.height) {
+            imageRect.size.width = rect.size.width;
+            imageRect.size.height = rect.size.width*self.drawImage.size.height/self.drawImage.size.width;
+        } else {
+            imageRect.size.height = rect.size.height;
+            imageRect.size.width = rect.size.height*self.drawImage.size.width/self.drawImage.size.height;
+        }
+        imageRect.origin.x = (rect.size.width-imageRect.size.width)/2.0;
+        imageRect.origin.y = (rect.size.height-imageRect.size.height)/2.0;
+    }
+    return imageRect;
+}
+
+#pragma mark Touch
+
+- (void)touchesBeganWithEvent:(NSEvent *)event {
+    [super touchesBeganWithEvent:event];
+    
+    NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:self];
+    self.activeTouch = [touches anyObject];
+    
+    CGPoint point = [self.activeTouch normalizedPosition];
+    point.x = point.x * self.bounds.size.width;
+    point.y = point.y * self.bounds.size.height;
+    _index = 0;
+    _points[0] = point;
+    [self setNeedsDisplay:YES];
+    
+    if (!self.cursorIsHidden) {
+        CGAssociateMouseAndMouseCursorPosition(false);
+        
+        [NSCursor hide];
+        self.cursorIsHidden = YES;
+    }
+}
+
+- (void)touchesMovedWithEvent:(NSEvent *)event {
+    [super touchesMovedWithEvent:event];
+    
+    NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:self];
+    
+    BOOL isTouch = NO;
+    for (NSTouch *touch in touches) {
+        if (touch.identity == self.activeTouch.identity) {
+            isTouch = YES;
+            self.activeTouch = touch;
+        }
+    }
+    
+    if (!isTouch) {
+        return;
+    }
+    
+    NSPoint point = [self.activeTouch normalizedPosition];
+    point.x = point.x * self.bounds.size.width;
+    point.y = point.y * self.bounds.size.height;
+    
+    _index++;
+    _points[_index] = point;
+    
+    if (_index == 4) {
+        _points[3] = CGPointMake((_points[2].x + _points[4].x)/2.0,
+                                 (_points[2].y + _points[4].y)/2.0);
+        [self.bezierPath moveToPoint:_points[0]];
+        
+        [self.bezierPath curveToPoint:_points[3]
+                        controlPoint1:_points[1]
+                        controlPoint2:_points[2] ];
+        _points[0] = _points[3];
+        _points[1] = _points[4];
+        _index = 1;
+        [self setNeedsDisplay:YES];
+    }
+}
+
+- (void)touchesEndedWithEvent:(NSEvent *)event {
+    [super touchesEndedWithEvent:event];
+    
+    NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:self];
+    
+    for (NSTouch *touch in touches) {
+        if (touch.identity == self.activeTouch.identity) {
+            self.activeTouch = nil;
+        }
+    }
+    
+    if (_index < 4) {
+        for (int i=0; i<_index; i++) {
+            [self.bezierPath moveToPoint:_points[i]];
+        }
+        [self setNeedsDisplay:YES];
+    }
+}
+
+- (void)touchesCancelledWithEvent:(NSEvent *)event {
+    [super touchesCancelledWithEvent:event];
+    
+    for (int i=0; i<_index; i++) {
+        [self.bezierPath moveToPoint:_points[i]];
+    }
+    self.activeTouch = nil;
+    [self setNeedsDisplay:YES];
+}
+
+#pragma mark - Mouse
+
+- (void)viewDidMoveToWindow {
+    if ([self window] != nil) {
+        [self addTrackingRect:[self bounds]
+                        owner:self
+                     userData:NULL
+                 assumeInside:NO];
+    }
+}
+
+- (void)mouseEntered:(NSEvent *)theEvent {
+    [[self window] makeFirstResponder:self];
+
+    self.mouseIsInView = YES;
+    [self setNeedsDisplay:YES];
+}
+
+- (void)mouseExited:(NSEvent *)theEvent {
+    self.mouseIsInView = NO;
+    
+    [self setNeedsDisplay:YES];
+}
+
+- (void)mouseDown:(NSEvent *)theEvent {
+    if ([self acceptsTouchEvents]) {
+        return;
+    }
+    
+    CGPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+    if (CGRectContainsPoint(self.bounds, point)) {
+        self.isInView = YES;
+
+        _index = 0;
+        _points[0] = point;
+    }
+}
+
+- (void)mouseDragged:(NSEvent *)theEvent {
+    if ([self acceptsTouchEvents]) {
+        return;
+    }
+    
+    NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+    if (CGRectContainsPoint(self.bounds, point)) {
+        _index++;
+        _points[_index] = point;
+        
+        if (_index == 4) {
+            if (!self.isInView) {
+                _points[3] = CGPointMake((_points[2].x + _points[4].x)/2.0,
+                                         (_points[2].y + _points[4].y)/2.0);
+                [self.bezierPath moveToPoint:_points[0]];
+                
+                [self.bezierPath curveToPoint:_points[3]
+                                controlPoint1:_points[1]
+                                controlPoint2:_points[2] ];
+            }
+            self.isInView = NO;
+            _points[0] = _points[3];
+            _points[1] = _points[4];
+            _index = 1;
+            [self setNeedsDisplay:YES];
+        }
+    } else {
+        self.isInView = YES;
+        
+        _points[0] = _points[3];
+        _points[1] = _points[4];
+        _index = 1;
+        [self setNeedsDisplay:YES];
+    }
+}
+
+- (void)mouseUp:(NSEvent *)theEvent {
+    if ([self acceptsTouchEvents]) {
+        return;
+    }
+    
+    if (_index < 4) {
+        for (int i=0; i<_index; i++) {
+            [self.bezierPath moveToPoint:_points[i]];
+        }
+        [self setNeedsDisplay:YES];
+    }
+}
+
+- (void)keyDown:(NSEvent *)theEvent {
+    NSString *chars = [theEvent characters];
+    unichar character = [chars characterAtIndex: 0];
+    
+    if (character == 27) {
+        if (self.isAcceptsTouch) {
+            self.isAcceptsTouch = NO;
+            if ([self.delegate respondsToSelector:@selector(drawViewDidFinishTouchMode:)]) {
+                [self.delegate drawViewDidFinishTouchMode:self];
+            }
+            return;
+        }
+    }
+    
+    [super keyDown:theEvent];
+}
+
+@end

+ 113 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CPDFDigtalView.h

@@ -0,0 +1,113 @@
+//
+//  CPDFDigtalView.h
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/10.
+//
+
+#import <ComPDFKit/ComPDFKit.h>
+#import "NSEvent+PDFListView.h"
+#import "CPDFSelection+PDFListView.h"
+#import "CPDFListView.h"
+
+//#import <PDF_Master-Swift.h>
+//typedef NS_ENUM(NSInteger, CAnnotationType) {
+//    CAnnotationTypeUnkown = 0,
+//    CAnnotationTypeAnchored,
+//    CAnnotationTypeLink,
+//    CAnnotationTypeFreeText,
+//    CAnnotationTypeLine,
+//    CAnnotationTypeArrow,
+//    CAnnotationTypeSquare,
+//    CAnnotationTypeCircle,
+//    /*CAnnotationTypePolyGon,*/
+//    /*CAnnotationTypePolyLine,*/
+//    CAnnotationTypeHighlight,
+//    CAnnotationTypeUnderline,
+////    CAnnotationTypeSquiggly,
+//    CAnnotationTypeStrikeOut,
+//    CAnnotationTypeStamp,
+//    CAnnotationTypeSignSignature,
+//    /*CAnnotationTypeCaret,*/
+//    CAnnotationTypeInk,
+//    /*CAnnotationTypePopUp,*/
+//    /*CAnnotationTypeFileattachment,*/
+//    /*CAnnotationTypeSound,*/
+//    /*CAnnotationTypeMovie,*/
+//    CAnnotationTypeRedact,
+//    CAnnotationTypeEraser,
+//    CAnnotationTypeAddText,
+//    CAnnotationTypeAddImage,
+//    
+//    CAnnotationTypeRadioButton = 100,
+//    CAnnotationTypeCheckBox,
+//    CAnnotationTypeTextField,
+//    CAnnotationTypeComboBox,
+//    CAnnotationTypeListMenu,
+//    CAnnotationTypeActionButton,
+//    CAnnotationTypeSignature,
+//    
+//    CAnnotationTypeSignText = 200,
+//    CAnnotationTypeSignFalse,
+//    CAnnotationTypeSignTure,
+//    CAnnotationTypeSignCircle,
+//    CAnnotationTypeSignLine,
+//    CAnnotationTypeSignDot,
+//    CAnnotationTypeSignConfig,
+//    CAnnotationTypeSignDate,
+//};
+
+//typedef NS_OPTIONS(NSUInteger, CRectEdges) {
+//    CNoEdgeMask = 0,
+//    CMinXEdgeMask = (1UL << 0),
+//    CMinYEdgeMask = (1UL << 1),
+//    CMaxXEdgeMask = (1UL << 2),
+//    CMaxYEdgeMask = (1UL << 3),
+//    CEditInEdgeMask = (1UL << 4),
+//};
+
+//enum {
+//    CDragArea = 1 << 16,
+//    CResizeUpDownArea = 1 << 17,
+//    CReadingBarArea = 1 << 18,
+//    CSpecialToolArea = 1 << 19,
+//    CResizeMinXMinY = 1 << 20,
+//    CResizeMidXMinY = 1 << 21,
+//    CResizeMaxXMinY = 1 << 22,
+//    CResizeMinXMidY = 1 << 23,
+//    CResizeMaxXMaxY = 1 << 24,
+//    CResizeMidXMaxY = 1 << 25,
+//    CResizeMinXMaxY =  1 << 26,
+//    CResizeMaxXMidY = 1 << 27,
+//};
+
+
+@protocol CPDFDigtalViewDelegate;
+
+@interface CPDFDigtalView : CPDFView
+
+@property (nonatomic, assign) CAnnotationType annotationType;
+
+@property (nonatomic, readonly) CPDFAnnotation * activeAnnotation;
+
+@property (nonatomic, retain) NSMutableArray *activeAnnotations;
+
+@property (nonatomic, retain) NSMutableArray *selectAnnotations;
+
+@property (nonatomic, assign) id<CPDFDigtalViewDelegate>pdfListViewDelegate;
+
+@property (nonatomic, retain) NSArray *signatures;
+
+@end
+
+ 
+@protocol CPDFDigtalViewDelegate <NSObject>
+
+@optional
+
+- (void)PDFListViewAddAnnotation:(CPDFDigtalView *)pdfListView forAddAnnotation:(CPDFAnnotation *)annotation inPage:(CPDFPage *)pdfPage;
+
+- (void)PDFListViewEditAnnotation:(CPDFDigtalView *)pdfListView forAnnotation:(CPDFAnnotation *)anotation;
+
+
+@end

+ 815 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CPDFDigtalView.m

@@ -0,0 +1,815 @@
+//
+//  CPDFDigtalView.m
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/10.
+//
+
+#import "CPDFDigtalView.h"
+#import "CPDFAnnotation+PDFListView.h"
+#import "NSGeometry+PDFListView.h"
+#import "CPDFListViewConfig.h"
+
+#define HANDLE_SIZE 4.0
+
+#define MIN_NOTE_SIZE 8.0
+
+@implementation CPDFDigtalView
+
+- (void)drawRect:(NSRect)dirtyRect {
+    [super drawRect:dirtyRect];
+    
+    // Drawing code here.
+}
+
+- (id)initWithFrame:(NSRect)frameRect {
+    self = [super initWithFrame:frameRect];
+    if (self) {
+        [self setUp];
+    }
+    return self;
+}
+
+- (id)initWithCoder:(NSCoder *)decoder {
+    self = [super initWithCoder:decoder];
+    if (self) {
+        [self setUp];
+    }
+    return self;
+}
+
+- (void)setUp {
+    
+    self.annotationType = CAnnotationTypeSignature;
+    self.activeAnnotations = [NSMutableArray array];
+}
+
+- (void)setDocument:(CPDFDocument *)document {
+    [super setDocument:document];
+    
+    NSArray *signatures = document.signatures;
+    
+    NSMutableArray *tempArr = [NSMutableArray array];
+    for (CPDFSignature *signature in signatures) {
+        if(signature.signers.count > 0) {
+            [signature verifySignatureWithDocument:document];
+            [tempArr addObject:signature];
+        }
+    }
+    self.signatures = tempArr;
+}
+
+- (CPDFPage *)pageAndPoint:(NSPoint *)point forEvent:(NSEvent *)event nearest:(BOOL)nearest {
+    NSPoint p = [event locationInPDFListView:self];
+    CPDFPage *page = [self pageForPoint:p nearest:nearest];
+    if (page && point)
+        *point = [self convertPoint:p toPage:page];
+    return page;
+}
+
+- (void)setCursorForMouse:(NSEvent *)theEvent {
+    if (theEvent == nil)
+        theEvent = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
+                                      location:[[self window] mouseLocationOutsideOfEventStream]
+                                 modifierFlags:[NSEvent standardPDFListViewModifierFlags]
+                                     timestamp:0
+                                  windowNumber:[[self window] windowNumber]
+                                       context:nil
+                                   eventNumber:0
+                                    clickCount:1
+                                      pressure:0.0];
+    [self setCursorForAreaOfInterest:[self areaOfInterestForMouse:theEvent]];
+}
+
+- (CPDFAnnotation *)activeAnnotation {
+    return self.activeAnnotations.lastObject;
+}
+
+- (void)mouseDown:(NSEvent *)theEvent {
+    [self setCursorForMouse:theEvent];
+    
+    NSPoint point = NSZeroPoint;
+
+    CPDFAreaOfInterest area = [self areaOfInterestForMouse:theEvent];
+    NSPoint newpoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+    area = [self areaOfInterestForPoint:newpoint];
+
+    CPDFAnnotation *newActiveAnnotation = nil;
+    if ([[self document] isLocked]) {
+        [super mouseDown:theEvent];
+    } else if ([self doClickAnnotationWithEvent:theEvent forAnnotation:&newActiveAnnotation]) {
+        [self doDragAnnotationWithEvent:theEvent forAnnotation:newActiveAnnotation];
+    } else {
+        [self doDragAddAnnotationWithEvent:theEvent];
+    }
+    
+}
+
+- (BOOL)doClickAnnotationWithEvent:(NSEvent *)theEvent forAnnotation:(CPDFAnnotation **)annotation{
+    CPDFAnnotation *newActiveAnnotation = nil;
+    NSPoint point = NSZeroPoint;
+    CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
+    
+    
+    NSMutableArray *currentActiveAnnotations = [NSMutableArray array];
+    for (CPDFAnnotation *an in self.activeAnnotations) {
+        if([an.page isEqual:page]) {
+            if(!([an isKindOfClass:[CPDFMarkupAnnotation class]] || [an isKindOfClass:[CPDFTextAnnotation class]])) {
+                [currentActiveAnnotations addObject:an];
+            }
+        }
+    }
+    
+    newActiveAnnotation = [self doSelectAnnotationWithEvent:theEvent];
+    *annotation = newActiveAnnotation;
+    return !!newActiveAnnotation;
+}
+
+- (CPDFAnnotation *)doSelectAnnotationWithEvent:(NSEvent *)theEvent {
+    CPDFAnnotation *newActiveAnnotation = nil;
+    NSPoint point = NSZeroPoint;
+    CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
+    id annotations = [page annotations];
+    
+    for (CPDFAnnotation *annotation in annotations) {
+        if ([annotation hitTest:point] && [annotation annotationShouldDisplay] ) {
+            newActiveAnnotation = annotation;
+            break;
+        }
+    }
+    
+    return newActiveAnnotation;
+}
+
+- (void)doDragAnnotationWithEvent:(NSEvent *)theEvent forAnnotation:(CPDFAnnotation *)newActiveAnnotation {
+    BOOL isContains = YES;
+    if (self.activeAnnotations.count == 0 || ![self.activeAnnotations containsObject:newActiveAnnotation]) {
+        isContains = NO;
+    }
+    
+    NSRect originalBounds = [newActiveAnnotation bounds];
+    BOOL isLine = [newActiveAnnotation isKindOfClass:[CPDFLineAnnotation class]];
+    NSPoint pagePoint = NSZeroPoint;
+    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
+    NSPoint originalStartPoint = NSZeroPoint;
+    NSPoint originalEndPoint = NSZeroPoint;
+    
+    BOOL draggedAnnotation = NO;
+    NSEvent *lastMouseEvent = theEvent;
+    NSPoint offset = CPDFListViewSubstractPoints(pagePoint, originalBounds.origin);
+    NSUInteger eventMask = NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged;
+
+    CGFloat mouseOffset = [self unitWidthOnPage:page];
+    
+    
+    while (YES) {
+        theEvent = [[self window] nextEventMatchingMask:eventMask];
+        if ([theEvent type] == NSEventTypeLeftMouseUp) {
+            if(draggedAnnotation) {
+                if (!isContains)
+                    [self.selectAnnotations removeAllObjects];
+            } else {
+                if(self.activeAnnotations.count == 1 &&
+                   self.activeAnnotation == newActiveAnnotation &&
+                   ([newActiveAnnotation isKindOfClass:[CPDFTextAnnotation class]] || [newActiveAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]])) {
+                    [self editAnnotation:newActiveAnnotation];
+                    break;
+                }
+                
+                if(!isContains) {
+                    [self updateActiveAnnotations:@[newActiveAnnotation]];
+                }
+                [self editAnnotation:newActiveAnnotation];
+            }
+            [self setNeedsDisplayAnnotationViewForPage:page];
+            break;
+        } else if ([theEvent type] == NSEventTypeLeftMouseDragged) {
+            NSPoint point = NSZeroPoint;
+            [self pageAndPoint:&point forEvent:theEvent nearest:YES];
+            CGRect zRect = CGRectMake(pagePoint.x-2*mouseOffset, pagePoint.y-2*mouseOffset, 4*mouseOffset, 4*mouseOffset);
+            if (CGRectContainsPoint(zRect, point)) {continue;}
+            
+            lastMouseEvent = theEvent;
+            draggedAnnotation = YES;
+
+            if(!isContains) {
+                [self dragAnnotationReferenceLine:newActiveAnnotation];
+                
+                [self.selectAnnotations removeAllObjects];
+                [self.selectAnnotations addObject:newActiveAnnotation];
+                
+                [self doMoveAnnotation:newActiveAnnotation withEvent:lastMouseEvent offset:offset];
+            } else {
+                
+                if ([newActiveAnnotation isKindOfClass:[CPDFStampAnnotation class]] ||
+                    [newActiveAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]] ||
+                    [newActiveAnnotation isKindOfClass:[CPDFSignatureAnnotation class]] ||
+                    [newActiveAnnotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
+                    [newActiveAnnotation updateAppearanceStream];
+                }
+            }
+            [self dragAnnotationReferenceLine:newActiveAnnotation];
+            
+            [self setNeedsDisplayAnnotationViewForPage:page];
+        }
+    }
+    
+    [self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
+    
+}
+
+
+- (void)doMoveAnnotation:(CPDFAnnotation *)activeAnnotation withEvent:(NSEvent *)theEvent offset:(NSPoint)offset {
+    // Move annotation.
+    [[[self documentView] contentView] autoscroll:theEvent];
+    
+    NSPoint point = NSZeroPoint;
+    CPDFPage *newActivePage = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
+    
+    if (newActivePage) { // newActivePage should never be nil, but just to be sure
+        if (newActivePage != [activeAnnotation page]) {
+            return;
+        }
+        
+        NSRect newBounds = [activeAnnotation bounds];
+        newBounds.origin = CPDFListViewIntegralPoint(CPDFListViewSubstractPoints(point, offset));
+        // constrain bounds inside page bounds
+        
+    }
+}
+
+- (void)dragAnnotationReferenceLine:(CPDFAnnotation *)annotation {
+    
+//    if ([self isAlignedWithOtherForms:annotation] && annotation) {
+//        CGRect bounds = annotation.bounds;
+//        NSRect rect = [self convertRect:bounds fromPage:self.currentPage];
+//        [self drawLineOfDashByCAShapeLayer:rect];
+//    }
+}
+
+- (void)editAnnotation:(CPDFAnnotation *)annotation {
+    if ([annotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
+        [self editAnnotationFreeText:(CPDFFreeTextAnnotation *)annotation];
+        [[self window] makeFirstResponder:self];
+        
+        [self setNeedsDisplayAnnotation:annotation];
+    } else {
+        if([annotation isKindOfClass:[CPDFSignatureWidgetAnnotation class]]) {
+            if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewEditAnnotation:forAnnotation:)]) {
+                [self.pdfListViewDelegate PDFListViewEditAnnotation:self forAnnotation:annotation];
+            }
+        }
+    }
+}
+
+
+- (void)doDragAddAnnotationWithEvent:(NSEvent *)theEvent {
+    NSPoint pagePoint = NSZeroPoint;
+    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
+
+    NSRect originalBounds = CGRectZero;
+    CGFloat mouseOffset = [self unitWidthOnPage:page];
+//    [self setCursorForAreaOfInterest:CAreaOfInterestForResizeHandle(CMaxXEdgeMask | CMinYEdgeMask, page)];
+
+    CPDFAnnotation *annotation = nil;
+    
+    originalBounds = CPDFListViewRectFromCenterAndSquareSize(CPDFListViewIntegralPoint(pagePoint), 0.0);
+    CRectEdges resizeHandle = CMaxXEdgeMask | CMinYEdgeMask;
+    
+    BOOL draggedAnnotation = NO;
+    NSEvent *lastMouseEvent = theEvent;
+    NSUInteger eventMask = NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged;
+    while (YES) {
+        theEvent = [[self window] nextEventMatchingMask:eventMask];
+        if ([theEvent type] == NSEventTypeLeftMouseUp) {
+            if (!draggedAnnotation) {
+                if (annotation) {
+                    break;
+                }
+                if(CAnnotationTypeLine == self.annotationType ||
+                   CAnnotationTypeArrow == self.annotationType) {
+                    
+                } else {
+                    
+                    CGFloat defaultWidth = 72;
+                    CGFloat defaultHeight = 32;
+                    NSSize defaultSize = ([page rotation] % 180 == 0) ? NSMakeSize(defaultWidth, defaultHeight) : NSMakeSize(defaultHeight, defaultWidth);
+                    CGRect bounds = CGRectZero;
+                   
+                    bounds = CPDFListViewRectFromCenterAndSize(CPDFListViewIntegralPoint(pagePoint), defaultSize);
+                    
+                    bounds = CPDFListViewConstrainRect(bounds, page.bounds,[CPDFListViewConfig defaultManager].annotationBorderOffset.floatValue);
+                    annotation = [self addAnnotationWithType:self.annotationType selection:nil page:page bounds:bounds];
+                    originalBounds = [annotation bounds];
+                    
+                    if(annotation) {
+                        [self updateActiveAnnotations:@[annotation]];
+                        [self setNeedsDisplayAnnotation:annotation];
+                    } else if(self.activeAnnotations.count >0) {
+                        [self updateActiveAnnotations:@[]];
+                        [self setNeedsDisplayAnnotationViewForPage:page];
+                    }
+                }
+            } else {
+                
+            }
+            
+            break;
+        } else if ([theEvent type] == NSEventTypeLeftMouseDragged) {
+
+            CGPoint zPoint = pagePoint;
+            [self pageAndPoint:&zPoint forEvent:theEvent nearest:YES];
+            CGRect zRect = CGRectMake(pagePoint.x-2*mouseOffset, pagePoint.y-2*mouseOffset, 4*mouseOffset, 4*mouseOffset);
+            if (CGRectContainsPoint(zRect, zPoint)) {continue;}
+            
+            if (annotation == nil)
+                annotation = [self addAnnotationWithType:self.annotationType selection:nil page:page bounds:CPDFListViewRectFromCenterAndSquareSize(originalBounds.origin, 0.0)];
+            
+            if(annotation) {
+                [self updateActiveAnnotations:@[annotation]];
+            } else if(self.activeAnnotations.count >0) {
+                [self updateActiveAnnotations:@[]];
+                [self setNeedsDisplayAnnotationViewForPage:page];
+            }
+            lastMouseEvent = theEvent;
+            draggedAnnotation = YES;
+            
+            [self setNeedsDisplayAnnotationViewForPage:page];
+        }
+        [self doResizeAnnotationWithEvent:lastMouseEvent fromPoint:pagePoint originalBounds:originalBounds resizeHandle:&resizeHandle];
+    }
+    if (annotation) {
+        [self setNeedsDisplayAnnotation:annotation];
+        
+        if ([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewAddAnnotation:forAddAnnotation:inPage:)]) {
+            [self.pdfListViewDelegate PDFListViewAddAnnotation:self forAddAnnotation:annotation inPage:page];
+        }
+    }
+    
+    [self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
+}
+
+- (void)setNeedsDisplayAnnotation:(CPDFAnnotation *)annotation {
+    if (annotation) {
+        [self setNeedsDisplayAnnotationViewForPage:annotation.page];
+    } else {
+        [self setNeedsDisplayAnnotationViewForVisiblePages];
+    }
+}
+
+- (CGFloat)unitWidthOnPage:(CPDFPage *)page {
+    return NSWidth([self convertRect:NSMakeRect(0.0, 0.0, 1.0, 1.0) toPage:page]);
+}
+
+
+- (CPDFAnnotation *)addAnnotationWithType:(CAnnotationType)annotationType selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds {
+    CPDFAnnotation *annotation = nil;
+    
+    NSString *text = [selection PDFListViewCleanedString];
+    
+    BOOL isInitial = NO;
+    if(selection) {
+        CGRect noteRect = selection.bounds;
+        isInitial = NSEqualSizes(noteRect.size, NSZeroSize);
+    } else {
+        isInitial = NSEqualSizes(bounds.size, NSZeroSize);
+    }
+        
+    if (isInitial)
+        bounds = CPDFListViewRectFromCenterAndSquareSize(bounds.origin, 8.0);
+    switch (annotationType) {
+        case CAnnotationTypeSignature:
+            annotation = [[CPDFSignatureWidgetAnnotation alloc] initPDFListViewNoteWithDocument:self.document];
+            annotation.bounds = bounds;
+            break;
+        default:
+            break;
+    }
+    if (annotation) {
+        if (annotationType != CAnnotationTypeLine && annotationType != CAnnotationTypeArrow && annotationType != CAnnotationTypeInk && [text length] > 0)
+            [annotation setString:text];
+        [self addAnnotation:annotation toPage:page];
+    }
+    return annotation;
+}
+
+- (void)updateActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotations {
+    [self refreshActiveAnnotations:activeAnnotations isRight:NO];
+}
+
+- (void)addAnnotation:(CPDFAnnotation *)annotation toPage:(CPDFPage *)page {
+//    [[[self undoManager] prepareWithInvocationTarget:self] removeAnnotation:annotation];
+    
+    [annotation setModificationDate:[NSDate date]];
+    //widget设置作者与fieldName冲突
+    if (![annotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
+        [annotation setUserName:CPDFKitShareConfig.annotationAuthor?:NSFullUserName()];
+    }
+    [page addAnnotation:annotation];
+    [self setNeedsDisplayAnnotation:annotation];
+    [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo action name")];
+}
+
+- (void)refreshActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotations isRight:(BOOL)isRight {
+    if(activeAnnotations) {
+        NSArray *selectTure = [activeAnnotations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF in %@", self.activeAnnotations]];
+        BOOL isSame = NO;
+        if(self.activeAnnotations.count == activeAnnotations.count && self.activeAnnotations.count == selectTure.count) isSame = YES;
+        
+        if(!isSame) {
+            self.activeAnnotations = [NSMutableArray arrayWithArray:activeAnnotations];
+        }
+    } else if (!activeAnnotations && self.activeAnnotations.count > 0) {
+        [self.activeAnnotations removeAllObjects];
+    }
+}
+
+- (void)doResizeAnnotationWithEvent:(NSEvent *)theEvent fromPoint:(NSPoint)originalPagePoint originalBounds:(NSRect)originalBounds resizeHandle:(CRectEdges *)resizeHandlePtr {
+    CPDFAnnotation *activeAnnotation = self.activeAnnotation;
+    NSPoint pagePoint = NSZeroPoint;
+    CPDFPage *page = activeAnnotation?activeAnnotation.page:[self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
+    NSRect newBounds = originalBounds;
+    NSRect pageBounds = [page boundsForBox:[self displayBox]];
+    NSPoint currentPagePoint = [self convertPoint:[theEvent locationInPDFListView:self] toPage:page];
+    NSPoint relPoint = CPDFListViewSubstractPoints(currentPagePoint, originalPagePoint);
+    CRectEdges resizeHandle = *resizeHandlePtr;
+    
+    if (NSEqualSizes(originalBounds.size, NSZeroSize)) {
+        CRectEdges currentResizeHandle = (relPoint.x < 0.0 ? CMinXEdgeMask : CMaxXEdgeMask) | (relPoint.y <= 0.0 ? CMinYEdgeMask : CMaxYEdgeMask);
+        if (currentResizeHandle != resizeHandle) {
+            *resizeHandlePtr = resizeHandle = currentResizeHandle;
+//            [self setCursorForAreaOfInterest:CAreaOfInterestForResizeHandle(resizeHandle, page)];
+        }
+    }
+    
+    BOOL isRadioOrCheckButton = NO;
+    if ([activeAnnotation isKindOfClass:[CPDFButtonWidgetAnnotation class]]) {
+        CPDFButtonWidgetAnnotation *annotation = (CPDFButtonWidgetAnnotation *)activeAnnotation;
+        if (CPDFWidgetRadioButtonControl == annotation.controlType ||
+            CPDFWidgetCheckBoxControl == annotation.controlType) {
+            isRadioOrCheckButton = YES;
+        }
+    }
+    
+    CGFloat minWidth = MIN_NOTE_SIZE;
+    CGFloat minHeight = MIN_NOTE_SIZE;
+    CGFloat offsetPageSet = 2;
+    if ((resizeHandle & CMaxXEdgeMask)) {
+        newBounds.size.width += relPoint.x;
+        if (NSMaxX(newBounds)+offsetPageSet > NSMaxX(pageBounds))
+            newBounds.size.width = NSMaxX(pageBounds) - NSMinX(newBounds)-offsetPageSet;
+        if (NSWidth(newBounds) < minWidth) {
+            newBounds.size.width = minWidth;
+        }
+    } else if ((resizeHandle & CMinXEdgeMask)) {
+        newBounds.origin.x += relPoint.x;
+        newBounds.size.width -= relPoint.x;
+        if (NSMinX(newBounds)-offsetPageSet < NSMinX(pageBounds)) {
+            newBounds.size.width = NSMaxX(newBounds) - NSMinX(pageBounds)-offsetPageSet;
+            newBounds.origin.x = NSMinX(pageBounds)+offsetPageSet;
+        }
+        if (NSWidth(newBounds) < minWidth) {
+            newBounds.origin.x = NSMaxX(newBounds) - minWidth;
+            newBounds.size.width = minWidth;
+        }
+    }
+    if ((resizeHandle & CMaxYEdgeMask)) {
+        newBounds.size.height += relPoint.y;
+        if (NSMaxY(newBounds)+ offsetPageSet > NSMaxY(pageBounds)) {
+            newBounds.size.height = NSMaxY(pageBounds) - NSMinY(newBounds)- offsetPageSet;
+        }
+        if (NSHeight(newBounds) < minHeight) {
+            newBounds.size.height = minHeight;
+        }
+        
+    } else if ((resizeHandle & CMinYEdgeMask)) {
+        newBounds.origin.y += relPoint.y;
+        newBounds.size.height -= relPoint.y;
+        if (NSMinY(newBounds)-offsetPageSet < NSMinY(pageBounds)) {
+            newBounds.size.height = NSMaxY(newBounds) - NSMinY(pageBounds)-offsetPageSet;
+            newBounds.origin.y = NSMinY(pageBounds)+offsetPageSet;
+        }
+        if (NSHeight(newBounds) < minHeight) {
+            newBounds.origin.y = NSMaxY(newBounds) - minHeight;
+            newBounds.size.height = minHeight;
+        }
+    }
+    
+    [activeAnnotation setBounds:NSIntegralRect(newBounds)];
+    
+    if ([activeAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
+        [self updateAnnotationFreeTextBounds:(CPDFFreeTextAnnotation *)activeAnnotation];
+    }
+}
+
+#pragma mark - NSMenu
+
+- (NSMenu *)menuForEvent:(NSEvent *)event {
+    if (self.annotationType == CAnnotationTypeInk || self.annotationType == CAnnotationTypeEraser) {
+        return nil;
+    }
+    NSMenu *menu = [super menuForEvent:event];
+    if(!menu)
+        menu = [[NSMenu alloc] init];
+    
+    NSPoint pagePoint = NSZeroPoint;
+    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:event nearest:YES];
+    NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:@selector(copy:) keyEquivalent:@"c"];
+    
+    NSMenuItem * pasteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Paste", @"PDFListView") action:@selector(menuItemClick_Paste:) keyEquivalent:@"v"];
+    pasteItem.representedObject = event;
+    NSMenuItem * cutItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Cut", @"PDFListView") action:@selector(cut:) keyEquivalent:@"x"];
+    
+    NSMenuItem * deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Delete", @"PDFListView") action:@selector(delete:) keyEquivalent:@""];
+    
+    NSMenu *subMenu = nil;
+    NSMenuItem * arrangementItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Arrangement", @"PDFListView") action:nil keyEquivalent:@""];
+    subMenu = [[NSMenu alloc] init];
+    
+    NSMenuItem * bringForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring Forward", @"PDFListView") action:@selector(menuItemClick_BringForward:) keyEquivalent:@""];
+    NSMenuItem * sendBackForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send Backward", @"PDFListView") action:@selector(menuItemClick_SendBackward:) keyEquivalent:@""];
+    NSMenuItem * bringFrontItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring to Front", @"PDFListView") action:@selector(menuItemClick_BringFront:) keyEquivalent:@""];
+    NSMenuItem * sendBackItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send to Back", @"PDFListView") action:@selector(menuItemClick_SendBack:) keyEquivalent:@""];
+    [subMenu addItem:bringForwardItem];
+    [subMenu addItem:sendBackForwardItem];
+    [subMenu addItem:bringFrontItem];
+    [subMenu addItem:sendBackItem];
+    arrangementItem.submenu = subMenu;
+    
+    NSMenuItem * editNoteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Note", @"PDFListView") action:@selector(menuItemClick_EditNote:) keyEquivalent:@""];
+
+    if(0) {
+      
+        
+    } else {
+        CPDFAnnotation *annotation = nil;
+        
+        for (CPDFAnnotation *tAnnotation in page.annotations) {
+            if ([tAnnotation hitTest:pagePoint]) {
+                annotation = tAnnotation;
+                break;
+            }
+        }
+        
+        if (annotation && [annotation isKindOfClass:[CPDFWidgetAnnotation class]] ){
+           
+        }
+        
+        if(annotation) {
+            if(![self.activeAnnotations containsObject:annotation]) {
+                [self updateIsRightActiveAnnotations:@[annotation]];
+                [self setNeedsDisplayAnnotation:annotation];
+            }
+        }
+        
+        if(annotation && [annotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
+            annotation = nil;
+        } else if(annotation && [annotation isKindOfClass:[CPDFRedactAnnotation class]]) {
+            annotation = nil;
+        } else if (annotation && [annotation isKindOfClass:[CPDFInkAnnotation class]] && [self annotationType] == CAnnotationTypeInk) {
+            annotation = nil;
+        }
+        
+
+        CPDFSelection *selection = [self creatImageCurrentSelectionForPoint:[event locationInPDFListView:self]];
+        if(selection && CPDFSelectionTypeImage == [selection selectionType] && !self.activeAnnotation){
+            self.currentSelection = selection;
+        }
+        
+        NSMenu *subMenu = [[NSMenu alloc] init];
+        if(self.activeAnnotations.count == 1) {
+//            NSMenuItem * lineStyleItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Line Style", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
+//            
+//            subMenu = [[NSMenu alloc] init];
+//            NSMenuItem * lineSolidItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Solid", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
+//            lineSolidItem.tag = CPDFBorderStyleSolid;
+//            NSMenuItem * lineDashedItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Dashed", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
+//            lineDashedItem.tag = CPDFBorderStyleDashed;
+//
+//            [subMenu addItem:lineSolidItem];
+//            [subMenu addItem:lineDashedItem];
+//            lineStyleItem.submenu = subMenu;
+//
+//            NSMenuItem * changeColorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Color...", @"PDFListView") action:@selector(menuItemClick_ChangeColor:) keyEquivalent:@""];
+
+//            [menu insertItem:arrangementItem atIndex:0];
+//            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
+
+//            if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]] ||
+//               [self.activeAnnotation isKindOfClass:[CPDFStampAnnotation class]] ||
+//               [self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
+//                [menu insertItem:editNoteItem atIndex:0];
+//            } else if ([self.activeAnnotation isKindOfClass:[CPDFInkAnnotation class]]) {
+//                [menu insertItem:editNoteItem atIndex:0];
+//                [menu insertItem:lineStyleItem atIndex:0];
+//                [menu insertItem:changeColorItem atIndex:0];
+//            } else if ([self.activeAnnotation isKindOfClass:[CPDFTextAnnotation class]]) {
+//                [menu insertItem:editNoteItem atIndex:0];
+//                [menu insertItem:changeColorItem atIndex:0];
+//            } else if ([self.activeAnnotation isKindOfClass:[CPDFSquareAnnotation class]] ||
+//                       [self.activeAnnotation isKindOfClass:[CPDFCircleAnnotation class]] ||
+//                       [self.activeAnnotation isKindOfClass:[CPDFLineAnnotation class]]) {
+//                [menu insertItem:editNoteItem atIndex:0];
+//                if([self.activeAnnotation isKindOfClass:[CPDFLineAnnotation class]]) {
+//                    NSMenuItem * directionItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Direction", @"PDFListView") action:nil keyEquivalent:@""];
+//                    subMenu = [[NSMenu alloc]init];
+//                    
+//                    NSMenuItem * lineHorizontalItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Horizontal", @"PDFListView") action:@selector(menuItemClick_LineHorizontal:) keyEquivalent:@""];
+//                    NSMenuItem * lineVerticalItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Vertical", @"PDFListView") action:@selector(menuItemClick_LineVertical:) keyEquivalent:@""];
+//                    [subMenu addItem:lineHorizontalItem];
+//                    [subMenu addItem:lineVerticalItem];
+//                    directionItem.submenu = subMenu;
+//                    
+//                    [menu insertItem:directionItem atIndex:0];
+//                }
+//                [menu insertItem:lineStyleItem atIndex:0];
+//                [menu insertItem:changeColorItem atIndex:0];
+//            }
+            if ([self.activeAnnotation isKindOfClass:[CPDFSignatureWidgetAnnotation class]]) {
+                CPDFSignatureWidgetAnnotation *aa = (CPDFSignatureWidgetAnnotation *)self.activeAnnotation;
+                CPDFSignature *aaa = aa.signature;
+                [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
+                [menu insertItem:deleteItem atIndex:0];
+            }
+//            if(![self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
+//                if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
+//                    [menu insertItem:pasteItem atIndex:0];
+//                }
+//                [menu insertItem:cutItem atIndex:0];
+//            }
+//            [menu insertItem:copyItem atIndex:0];
+            __block typeof(self) blockSelf = self;
+
+            
+        } else if (self.activeAnnotations.count > 1) {
+            BOOL isMarkupAn = NO;
+            for (CPDFAnnotation *annotation in self.activeAnnotations) {
+                if([annotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
+                    isMarkupAn = YES;
+                    break;
+                }
+            }
+            
+//            [menu insertItem:arrangementItem atIndex:0];
+            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
+            [menu insertItem:deleteItem atIndex:0];
+            if(!isMarkupAn) {
+                [menu insertItem:cutItem atIndex:0];
+                [menu insertItem:copyItem atIndex:0];
+            }
+        } else if (self.currentSelection) {
+            if(CPDFSelectionTypeImage == [self.currentSelection selectionType]) {
+                NSMenuItem * exportImageItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Export…", nil) action:@selector(menuItemClick_ExportImage:) keyEquivalent:@""];
+
+                [menu insertItem:exportImageItem atIndex:0];
+                [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
+            }
+            if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
+                [menu insertItem:pasteItem atIndex:0];
+            }
+            [menu insertItem:copyItem atIndex:0];
+        } else if (!self.activeAnnotation) {
+//            NSMenuItem * pageDisplayItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Page Display", @"PDFListView") action:nil keyEquivalent:@""];
+//            subMenu = [[NSMenu alloc] init];
+//
+//            NSMenuItem * twoPagesContinuousItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Two Pages Continuous", @"PDFListView") action:@selector(menuItemClick_TwoPagesContinuous:) keyEquivalent:@""];
+//            NSMenuItem * twoPagesItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Two Pages", @"PDFListView") action:@selector(menuItemClick_TwoPages:) keyEquivalent:@""];
+//            NSMenuItem * singlePageContinuousItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Single Page Continuous", @"PDFListView") action:@selector(menuItemClick_SinglePagesContinuous:) keyEquivalent:@""];
+//            NSMenuItem * singlePageItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Single Page", @"PDFListView") action:@selector(menuItemClick_SinglePage:) keyEquivalent:@""];
+//            NSMenuItem * bookModeItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Book Mode", @"PDFListView") action:@selector(menuItemClick_BookMode:) keyEquivalent:@""];
+//            switch (self.displayViewMode) {
+//                case CPDFDisplayViewSinglePageContinuous:
+//                    singlePageContinuousItem.state = NSControlStateValueOn;
+//                    break;
+//                case CPDFDisplayViewTwoUp:
+//                    if (self.displaysAsBook)
+//                        bookModeItem.state = NSControlStateValueOn;
+//                    else
+//                        twoPagesItem.state = NSControlStateValueOn;
+//                    break;
+//                case CPDFDisplayViewTwoUpContinuous:
+//                    if (self.displaysAsBook)
+//                        bookModeItem.state = NSControlStateValueOn;
+//                    else
+//                        twoPagesContinuousItem.state = NSControlStateValueOn;
+//                    break;
+//                default:
+//                case CPDFDisplayViewSinglePage:
+//                    singlePageItem.state = NSControlStateValueOn;
+//                    break;
+//            }
+//
+//            [subMenu addItem:singlePageItem];
+//            [subMenu addItem:singlePageContinuousItem];
+//            [subMenu addItem:twoPagesItem];
+//            [subMenu addItem:twoPagesContinuousItem];
+//            [subMenu addItem:bookModeItem];
+//            pageDisplayItem.submenu = subMenu;
+//            
+//            [menu insertItem:pageDisplayItem atIndex:0];
+//
+//            NSMenuItem *zoomItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom", @"PDFListView") action:nil keyEquivalent:@""];
+//            subMenu = [[NSMenu alloc]init];
+//
+//            NSMenuItem * fitWidthItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Fit Width", @"PDFListView") action:@selector(menuItemClick_FitWidth:) keyEquivalent:@""];
+//            NSMenuItem * automaticallyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Automatically Resize", @"PDFListView") action:@selector(menuItemClick_AutomaticallyResize:) keyEquivalent:@""];
+//            NSMenuItem * actualSizeItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Actual Size", @"PDFListView") action:@selector(menuItemClick_ActualSize:) keyEquivalent:@""];
+//            NSMenuItem * zoomInItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom In", @"PDFListView") action:@selector(menuItemClick_ZoomIn:) keyEquivalent:@""];
+//            NSMenuItem * zoomOutItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom Out", @"PDFListView") action:@selector(menuItemClick_ZoomOut:) keyEquivalent:@""];
+//            
+//            NSMenuItem * hidenShowNoteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Hide Notes", @"PDFListView") action:@selector(menuItemClick_HidenorShowNote:) keyEquivalent:@""];
+//            
+//            if (self.autoScales) {
+//                automaticallyItem.state = NSControlStateValueOn;
+//            } else if (self.scaleFactor == 1.0) {
+//                actualSizeItem.state = NSControlStateValueOn;
+//            }
+//            
+//           
+//            
+//            [subMenu addItem:fitWidthItem];
+//            [subMenu addItem:automaticallyItem];
+//            [subMenu addItem:actualSizeItem];
+//            [subMenu addItem:zoomInItem];
+//            [subMenu addItem:zoomOutItem];
+//            zoomItem.submenu = subMenu;
+//            [menu insertItem:zoomItem atIndex:0];
+//            
+//            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
+//            [menu insertItem:hidenShowNoteItem atIndex:0];
+//            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
+//            [menu insertItem:pasteItem atIndex:0];
+
+        }
+    }
+    
+//    if ([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMenuForEvent:forEvent:clickMenu:)]) {
+//        [self.pdfListViewDelegate PDFListViewMenuForEvent:self forEvent:event clickMenu:&menu];
+//    }
+    
+    return menu;
+}
+
+- (void)updateIsRightActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotations {
+    [self refreshActiveAnnotations:activeAnnotations isRight:YES];
+}
+
+- (IBAction)delete:(id)sender {
+    if (self.activeAnnotations.count > 0 ) {
+        NSMutableArray *tarr = [NSMutableArray arrayWithArray:self.activeAnnotations];
+        for (CPDFAnnotation * an in tarr) {
+//            if(self.hoverAnnotation == an) {
+//                self.hoverAnnotation = nil;
+//            }
+            [self removeAnnotation:an];
+            [[self undoManager] setActionName:NSLocalizedString(@"Remove Note", @"Undo action name")];
+            if([an isKindOfClass:[CPDFFreeTextAnnotation class]]) {
+                CPDFFreeTextAnnotation *freeTextAn = (CPDFFreeTextAnnotation *)an;
+                if ([self isEditWithCurrentFreeText:freeTextAn]) {
+                    [self commitEditAnnotationFreeText:freeTextAn];
+                }
+            }
+        }
+        [self removeActiveAnnotations:tarr];
+    } else {
+        NSBeep();
+    }
+}
+
+- (void)removeAnnotation:(CPDFAnnotation *)annotation {
+    CPDFAnnotation *wasAnnotation = annotation;
+    CPDFPage *page = wasAnnotation.page;
+    
+    [[[self undoManager] prepareWithInvocationTarget:self] addAnnotation:wasAnnotation toPage:page];
+    
+    [page removeAnnotation:wasAnnotation];
+    [self annotationsChangedOnPage:page];
+    [self setNeedsDisplayAnnotation:wasAnnotation];
+
+//    dispatch_async(dispatch_get_main_queue(), ^{
+//        [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewDidRemoveAnnotationNotification object:self
+//                                                          userInfo:[NSDictionary dictionaryWithObjectsAndKeys:wasAnnotation, CPDFListViewAnnotationKey, page, CPDFListViewPageKey, nil]];
+//    });
+//    
+//    if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewRemoveAnnotations:forRemoveAnnotations:inPage:)])
+//        [self.pdfListViewDelegate PDFListViewRemoveAnnotations:self forRemoveAnnotations:@[annotation] inPage:page];
+}
+
+- (void)removeActiveAnnotations:(NSArray<CPDFAnnotation *> *)removeAnnotations {
+    BOOL isContains = NO;
+    NSMutableArray *tarr = [NSMutableArray arrayWithArray:self.activeAnnotations];
+    [tarr removeObjectsInArray:removeAnnotations];
+    self.activeAnnotations = tarr;
+    isContains = YES;
+
+//    if(isContains) {
+//        if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewChangeatioActiveAnnotations:forActiveAnnotations:isRightMenu:)])
+//            [self.pdfListViewDelegate PDFListViewChangeatioActiveAnnotations:self forActiveAnnotations:self.activeAnnotations isRightMenu:NO];
+//        
+//        dispatch_async(dispatch_get_main_queue(), ^{
+//            [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewActiveAnnotationsChangeNotification object:self];
+//        });
+//    }
+}
+
+@end

+ 26 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFAnnotation+PDFListView.h

@@ -0,0 +1,26 @@
+//
+//  CPDFAnnotation+PDFListView.h
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 <ComPDFKit/ComPDFKit.h>
+
+
+@class CPDFAnnotationModel,CPDFListView;
+
+@interface CPDFAnnotation (PDFListView)
+
+- (instancetype)initPDFListViewNoteWithDocument:(CPDFDocument *)document;
+
+
+- (BOOL)hitTest:(NSPoint)point;
+
+
+@end

+ 30 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFAnnotation+PDFListView.m

@@ -0,0 +1,30 @@
+//
+//  CPDFAnnotation+PDFListView.m
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 "CPDFAnnotation+PDFListView.h"
+
+@implementation CPDFAnnotation (PDFListView)
+
+- (instancetype)initPDFListViewNoteWithDocument:(CPDFDocument *)document {
+    self = [self initWithDocument:document];
+    if (self) {
+        
+    }
+    return self;
+}
+
+
+- (BOOL)hitTest:(NSPoint)point {
+    return [self shouldDisplay] ? NSPointInRect(point, [self bounds]) : NO;
+}
+
+@end

+ 28 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFListViewConfig.h

@@ -0,0 +1,28 @@
+//
+//  CPDFListViewConfig.h
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 <Foundation/Foundation.h>
+#import <AppKit/AppKit.h>
+
+@interface CPDFListViewConfig : NSObject
+
++ (instancetype)defaultManager;
+
+@property (nonatomic,retain) NSNumber * annotationBorderOffset;
+
+@property (nonatomic,retain) NSColor * annotationBorderColor;
+
+@property (nonatomic,retain) NSColor * dragHoverColor;
+
+@property (nonatomic,assign) BOOL  isSaveDefault;
+
+@end

+ 46 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFListViewConfig.m

@@ -0,0 +1,46 @@
+//
+//  CPDFListViewConfig.m
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 "CPDFListViewConfig.h"
+
+@implementation CPDFListViewConfig
+
++ (instancetype)defaultManager {
+    static CPDFListViewConfig *singleton = nil;
+    static dispatch_once_t pred;
+    dispatch_once(&pred, ^{
+        singleton = [[CPDFListViewConfig alloc] init];
+    });
+    return singleton;
+}
+
+- (NSNumber *)annotationBorderOffset {
+    if(_annotationBorderOffset) {
+        return _annotationBorderOffset;
+    }
+    return @(5);
+}
+
+- (NSColor *)annotationBorderColor {
+    if(_annotationBorderColor) {
+        return _annotationBorderColor;
+    }
+    return [NSColor colorWithRed:82.0/255.0 green:102.0/255.0 blue:204.0/255.0 alpha:1];
+}
+
+- (NSColor *)dragHoverColor {
+    if(_dragHoverColor) {
+        return _dragHoverColor;
+    }
+    return [NSColor colorWithRed:23/255.0 green:112/255.0 blue:244/255.0 alpha:1.0];
+}
+@end

+ 19 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSelection+PDFListView.h

@@ -0,0 +1,19 @@
+//
+//  CPDFSelection+PDFListView.h
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 <ComPDFKit/ComPDFKit.h>
+
+@interface CPDFSelection (PDFListView)
+
+- (NSString *)PDFListViewCleanedString;
+
+@end

+ 22 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSelection+PDFListView.m

@@ -0,0 +1,22 @@
+//
+//  CPDFSelection+PDFListView.m
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 "CPDFSelection+PDFListView.h"
+
+@implementation CPDFSelection (PDFListView)
+
+- (NSString *)PDFListViewCleanedString {
+    return [[[self selectionsByLine] valueForKey:@"string"] componentsJoinedByString:@" "];
+}
+
+
+@end

+ 17 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureAnnotation+PDFListView.h

@@ -0,0 +1,17 @@
+//
+//  CPDFSignatureAnnotation+PDFListView.h
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 <ComPDFKit/ComPDFKit.h>
+
+@interface CPDFSignatureAnnotation (PDFListView)
+
+@end

+ 21 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureAnnotation+PDFListView.m

@@ -0,0 +1,21 @@
+//
+//  CPDFSignatureAnnotation+PDFListView.m
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 "CPDFSignatureAnnotation+PDFListView.h"
+
+@implementation CPDFSignatureAnnotation (PDFListView)
+
+- (BOOL)isMovable { return YES; }
+
+- (BOOL)isResizable { return YES; }
+
+@end

+ 25 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureWidgetAnnotation+PDFListView.h

@@ -0,0 +1,25 @@
+//
+//  CPDFSignatureWidgetAnnotation+PDFListView.h
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 <ComPDFKit/ComPDFKit.h>
+
+@interface CPDFSignatureWidgetAnnotation (PDFListView)
+
+- (NSImage *)contentImage;
+
+-(void)setIsSignSignatureAdd:(BOOL)isSignSignatureAdd;
+
+-(BOOL)isSignSignatureAdd;
+
+
+@end
+

+ 69 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/CPDFSignatureWidgetAnnotation+PDFListView.m

@@ -0,0 +1,69 @@
+//
+//  CPDFSignatureWidgetAnnotation+PDFListView.m
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 "CPDFSignatureWidgetAnnotation+PDFListView.h"
+#import "objc/runtime.h"
+
+@implementation CPDFSignatureWidgetAnnotation (PDFListView)
+
+- (instancetype)initPDFListViewNoteWithDocument:(CPDFDocument *)document {
+    self = [self initWithDocument:document];
+    if (self) {
+//        [self setBackgroundColor:[NSColor clearColor]];
+        [self setBackgroundOpacity:1];
+        self.border = [[CPDFBorder alloc] initWithStyle:CPDFBorderStyleSolid lineWidth:2 dashPattern:@[@5]];
+        [self setFieldName:[NSString stringWithFormat:@"%@%@",@"Signature_",[CPDFSignatureWidgetAnnotation tagString]]];
+
+    }
+    return self;
+}
+
+- (BOOL)isMovable { return YES; }
+
+- (BOOL)isResizable { return YES; }
+
+- (NSImage *)contentImage {
+    NSImage * newImage = [[NSImage alloc] initWithSize:self.bounds.size];
+    [newImage lockFocus];
+    
+    CGContextRef imageContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+    CGContextTranslateCTM(imageContext,-self.bounds.origin.x,  -self.bounds.origin.y);
+    [self drawWithBox:CPDFDisplayMediaBox inContext:imageContext];
+    [newImage unlockFocus];
+    
+    return newImage;
+}
+
+-(void)setIsSignSignatureAdd:(BOOL)isSignSignatureAdd {
+    NSString *num = @"0";
+    if (isSignSignatureAdd) {
+        num = @"1";
+    }
+    objc_setAssociatedObject(self, @"kisSignSignatureAdd", num, OBJC_ASSOCIATION_COPY_NONATOMIC);
+}
+
+-(BOOL)isSignSignatureAdd {
+    NSNumber *num = objc_getAssociatedObject(self,@"kisSignSignatureAdd");
+    if (num.integerValue) {
+        return YES;
+    }
+    return NO;
+}
+
++ (NSString *)tagString {
+    NSDateFormatter *formatter = [[NSDateFormatter alloc ] init];
+    [formatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];
+    NSString *dateString = [formatter stringFromDate:[NSDate date]];
+    return [NSString stringWithFormat:@"%@ %d ", dateString,rand()%10000];
+}
+
+@end

+ 29 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSEvent+PDFListView.h

@@ -0,0 +1,29 @@
+//
+//  NSEvent+PDFListView.h
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 <Cocoa/Cocoa.h>
+
+@interface NSEvent (PDFListView)
+
++ (NSUInteger)standardPDFListViewModifierFlags;
+
+- (NSPoint)locationInPDFListView:(NSView *)view;
+
+- (NSUInteger)standardPDFListViewModifierFlags;
+
+- (unichar)PDFListViewFirstCharacter;
+
++ (NSPointingDeviceType)currentPointingDeviceType;
++ (void)setCurrentPointingDeviceType:(NSPointingDeviceType)newCurrentPointingDeviceType;
+
+
+@end

+ 46 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSEvent+PDFListView.m

@@ -0,0 +1,46 @@
+//
+//  NSEvent+PDFListView.m
+//  ComPDFKit
+//
+//  Copyright © 2014-2022 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 "NSEvent+PDFListView.h"
+
+static NSPointingDeviceType currentPointingDeviceType = NSUnknownPointingDevice;
+
+@implementation NSEvent (PDFListView)
+
++ (NSUInteger)standardPDFListViewModifierFlags {
+    return [self modifierFlags] & (NSEventModifierFlagCommand | NSEventModifierFlagOption | NSEventModifierFlagShift | NSEventModifierFlagControl);
+}
+
+- (NSPoint)locationInPDFListView:(NSView *)view {
+    return [view convertPoint:[self locationInWindow] fromView:nil];
+}
+
+- (NSUInteger)standardPDFListViewModifierFlags {
+    return [self modifierFlags] & (NSEventModifierFlagCommand | NSEventModifierFlagOption | NSEventModifierFlagShift | NSEventModifierFlagControl);
+}
+
+- (unichar)PDFListViewFirstCharacter {
+    NSString *characters = [self charactersIgnoringModifiers];
+    return [characters length] > 0 ? [characters characterAtIndex:0] : 0;
+}
+
++ (NSPointingDeviceType)currentPointingDeviceType {
+    return currentPointingDeviceType;
+}
+
++ (void)setCurrentPointingDeviceType:(NSPointingDeviceType)newCurrentPointingDeviceType {
+    currentPointingDeviceType = newCurrentPointingDeviceType;
+}
+
+
+
+@end

PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/NSGeometry+PDFListView.h → PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSGeometry+PDFListView.h


PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/NSGeometry+PDFListView.m → PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/Event/NSGeometry+PDFListView.m


+ 413 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.swift

@@ -0,0 +1,413 @@
+//
+//  KMPDFDigitalSignViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/19.
+//
+
+import Cocoa
+
+class KMPDFDigitalSignViewController: NSViewController, CPDFViewDelegate, CPDFDigtalViewDelegate {
+
+    @IBOutlet weak var contendView: NSView!
+    @IBOutlet weak var headerView: NSView!
+    @IBOutlet weak var tipLabel: NSTextField!
+    @IBOutlet weak var exitBox: NSBox!
+    @IBOutlet weak var exitButton: KMCustomButton!
+    @IBOutlet weak var saveBox: NSBox!
+    @IBOutlet weak var saveButton: KMCustomButton!
+    
+    @IBOutlet weak var stateBGView: NSView!
+    @IBOutlet weak var stateLbl: NSTextField!
+    @IBOutlet weak var stateButton: NSButton!
+    
+    @IBOutlet weak var pdfContendView: NSView!
+    @IBOutlet weak var contentTopConst: NSLayoutConstraint!
+    
+    
+    var editWidgeAnnotation: CPDFSignatureWidgetAnnotation!
+    var stateVC: CDSignatureCertificateStateViewController!
+    
+    @objc var scaleFactor: CGFloat = 0
+    @objc var url: URL!
+    @objc var password = String()
+    @objc var currentPageIndex: Int = 0
+    
+    var signatures = NSArray()
+    var type:CPromptSignaturesState = .failure
+    
+    @objc var titleChangeBlock: ((_ title: String, _ pageIndex: NSInteger)->Void)?
+    @objc var buttonActionBlock: ((_ actionType: DSignatureActionType, _ isChanged: Bool)->Void)?
+    
+    var pdfView: CPDFDigtalView!
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        
+        let contextString = NSLocalizedString("Please box an area for the signature to be added, then you can add a new digital signature.", comment: "")
+        _ = CustomAlertView.alertView(message: contextString, fromView: self.view, withStyle: .black)
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+    
+        self.headerView.wantsLayer = true
+        self.headerView.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
+        
+        self.tipLabel.stringValue = NSLocalizedString("You are Under Digital Sign Mode", comment: "")
+        
+        self.exitBox.borderColor = KMAppearance.Layout.w70Color()
+        self.exitBox.borderWidth = 1.0
+        self.exitButton.title = NSLocalizedString("Exit", comment: "")
+        
+        self.saveBox.fillColor = NSColor.white
+        self.saveButton.title = NSLocalizedString("Exit", comment: "")
+        self.saveButton.setTitleColor(KMAppearance.Interactive.a0Color())
+        
+        self.exitBox.isHidden = true
+        
+        self.pdfView = CPDFDigtalView.init(frame: self.pdfContendView.bounds)
+        self.pdfView.autoresizingMask = [.width, .height]
+        
+        let document = CPDFDocument.init(url: self.url)
+        if self.password.count > 0 {
+            document?.unlock(withPassword: self.password)
+        }
+        self.pdfView.delegate = self
+        self.pdfView.document = document
+        self.pdfView.autoScales = true
+        self.pdfView.pdfListViewDelegate = self
+        self.pdfContendView.addSubview(self.pdfView)
+        
+        self.stateBGView.wantsLayer = true
+        self.stateBGView.layer?.backgroundColor = KMAppearance.Else.textHighlightColor().cgColor
+        self.stateLbl.textColor = NSColor.labelColor
+        
+        self.reloadState()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(signatureStateChangeNoti), name: NSNotification.Name(rawValue: "CSignatureTrustCerDidChangeNotification"), object: nil)
+
+    }
+    
+    //MARK: Public Method
+    
+    func reloadState() {
+        if self.pdfView.signatures.count > 0 {
+            self.stateBGView.isHidden = false
+            self.contentTopConst.constant = 44
+        } else {
+            self.stateBGView.isHidden = true
+            self.contentTopConst.constant = 0
+        }
+        
+        self.signatures = self.pdfView.signatures! as NSArray
+        
+        var isSignVerified = false
+        var isCertTrusted = false
+        
+        for item in self.signatures {
+            let signature: CPDFSignature = item as! CPDFSignature
+            if signature.signers != nil {
+                let signer = signature.signers.first
+                if signer?.isCertTrusted == false {
+                    isCertTrusted = false
+                    break
+                } else {
+                    isCertTrusted = true
+                }
+            }
+        }
+        
+        for item in self.signatures {
+            let signature: CPDFSignature = item as! CPDFSignature
+            if signature.signers != nil {
+                let signer = signature.signers.first
+                if signer?.isSignVerified == false {
+                    isSignVerified = false
+                    break
+                } else {
+                    isSignVerified = true
+                }
+            }
+        }
+        
+        self.stateBGView.isHidden = false
+        
+        if (isSignVerified && isCertTrusted) {
+            self.type = .Success;
+        } else if(isSignVerified && !isCertTrusted) {
+            self.type = .Unknown;
+        } else {
+            self.type = .failure;
+        }
+        
+        if (.Success == self.type) {
+            self.stateButton.image = NSImage(named: "ImageNameSigntureVerifySuccess")
+            self.stateLbl.stringValue = NSLocalizedString("Signature is valid.", comment: "")
+        } else if(.Unknown == self.type) {
+            self.stateButton.image = NSImage(named: "ImageNameSigntureTrustedFailure")
+            if(self.signatures.count > 1) {
+                self.stateLbl.stringValue = NSLocalizedString("At least one signature is invalid.", comment: "")
+            } else {
+                self.stateLbl.stringValue = NSLocalizedString("Signature is invalid", comment: "")
+            }
+        } else {
+            self.stateButton.image = NSImage(named: "ImageNameSigntureVerifyFailure")
+            if(self.signatures.count > 1) {
+                self.stateLbl.stringValue = NSLocalizedString("At least one signature is invalid.", comment: "")
+            } else {
+                self.stateLbl.stringValue = NSLocalizedString("Signature is invalid", comment: "")
+            }
+        }
+    }
+    
+    func writeSignatureToWidget(_ widget: CPDFSignatureWidgetAnnotation, _ path: String, _ password: String, _ config: CPDFSignatureConfig, _ isLock: Bool) ->() {
+        
+        let fileName = self.pdfView.document.documentURL?.lastPathComponent
+        let fileNameWithoutExtension = URL(fileURLWithPath: fileName!).deletingPathExtension().lastPathComponent
+
+        let outputSavePanel = NSSavePanel()
+        outputSavePanel.directoryURL = self.pdfView.document.documentURL.deletingLastPathComponent()
+        outputSavePanel.title = NSLocalizedString("", comment: "Save as PDF")
+        outputSavePanel.allowedFileTypes = ["pdf"]
+        outputSavePanel.nameFieldStringValue = fileNameWithoutExtension + "_" + NSLocalizedString("Signed", comment: "")
+        let result = outputSavePanel.runModal()
+        if result == .OK {
+            let contentArr = NSMutableArray()
+            var locationStr = ""
+            var reasonStr = NSLocalizedString("none", comment: "")
+            for item in config.contents {
+                if item.key == NSLocalizedString("Reason", comment: "") {
+                    if item.value == NSLocalizedString("<your signing reason here>", comment: "") {
+                        item.value = " " + NSLocalizedString("none", comment: "")
+                    }
+                    reasonStr = item.value
+                } else if item.key == NSLocalizedString("Location", comment: "") {
+                    if item.value == NSLocalizedString("<your signing location here>", comment: "") {
+                        item.value = " "
+                    }
+                    locationStr = item.value
+                }
+                contentArr.add(item)
+            }
+            config.contents = contentArr as? [CPDFSignatureConfigItem]
+            widget.signAppearanceConfig(config)
+            
+            let success = self.pdfView.document.writeSignature(to: outputSavePanel.url, withWidget: widget, pkcs12Cert: path, password: password, location: locationStr, reason: reasonStr, permissions: .forbidChange)
+            widget.removeSignature()
+            if success {
+                DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
+                    NSDocumentController.shared.openDocument(withContentsOf: outputSavePanel.url!, display: true) { document, documentWasAlreadyOpen, error in
+                        if error != nil {
+                            NSApp.presentError(error!)
+                            return
+                        }
+                    }
+                }
+            } else {
+                let alert = NSAlert.init()
+                alert.messageText = NSLocalizedString("Save failed!", comment: "")
+                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                alert.runModal()
+            }
+            widget.page.removeAnnotation(widget)
+            self.pdfView.setNeedsDisplayAnnotationViewFor(widget.page)
+        } else {
+            widget.page.removeAnnotation(widget)
+            self.pdfView.setNeedsDisplayAnnotationViewFor(widget.page)
+        }
+    }
+ 
+    //MARK: Setter
+    
+    
+    
+    //MARK: IBAction
+    @IBAction func exitButtonAction(_ sender: NSButton) {
+        
+    }
+    
+    @IBAction func saveButtonAction(_ sender: NSButton) {
+        
+//        var documentArray = NSDocumentController.shared.documents
+        var didFileEdit = false
+//        for i in 0...documentArray.count-1 {
+//            let document = documentArray[i] 
+//            if document.fileURL!.path == self.pdfView.document.documentURL.path {
+//                didFileEdit = document.isDocumentEdited
+//            
+//                break
+//            }
+//        }
+        guard let callBack = self.buttonActionBlock else {
+            return
+        }
+        callBack(.cancel, didFileEdit)
+        
+    }
+ 
+    
+    //MARK: CPDFViewDelegate
+    func pdfViewDocumentDidLoaded(_ pdfView: CPDFView!) {
+        self.pdfView.go(toPageIndex: self.currentPageIndex, animated: true)
+    }
+    
+    func pdfViewCurrentPageDidChanged(_ pdfView: CPDFView!) {
+        let fileName = pdfView.document.documentURL.deletingPathExtension().lastPathComponent
+        let title = String(format: "%@ (page %ld / %ld)", fileName, pdfView.currentPageIndex+1, pdfView.document.pageCount)
+        
+        self.currentPageIndex = pdfView.currentPageIndex
+        guard let callBack = self.titleChangeBlock else {
+            return
+        }
+        callBack(title, self.currentPageIndex)
+    }
+    
+    func pdfListViewAddAnnotation(_ pdfListView: CPDFDigtalView!, forAdd annotation: CPDFAnnotation!, in pdfPage: CPDFPage!) {
+        
+        let widget = CPDFSignatureWidgetAnnotation.init(PDFListViewNoteWith: self.pdfView.document)
+        widget.bounds = CGRectMake(-1000, -1000, 545, 178);
+        annotation.page.addAnnotation(widget)
+        
+        let configWindowVC = DSignatureConfigWindowController.init(windowNibName: "DSignatureConfigWindowController")
+        configWindowVC.viewType = .fileList;
+        configWindowVC.appearanceWidget = widget;
+        configWindowVC.isCreatDS = false
+        configWindowVC.complentionHandle = {isSign, dic, config, isLock in
+            widget.page.removeAnnotation(widget)
+            if isSign {
+                if (dic.object(forKey: SAVEFILEPATH_KEY) != nil) {
+                    let p12Path = dic.object(forKey: SAVEFILEPATH_KEY) as! String
+                    let password = dic.object(forKey: PASSWORD_KEY)
+                    if p12Path.count > 0 {
+                        self.writeSignatureToWidget(annotation as! CPDFSignatureWidgetAnnotation, p12Path, password as! String, config, isLock)
+                    }
+                }
+            }
+        }
+        configWindowVC.actionBlock = { controller, type in
+            if (type == .cancel) {
+                NSApplication.shared.stopModal()
+                controller.window?.orderOut(nil)
+                controller.window?.close()
+            
+                annotation.page.removeAnnotation(annotation)
+                widget.page.removeAnnotation(widget)
+                self.pdfView.setNeedsDisplayAnnotationViewFor(annotation.page)
+                
+            } else if (type == .confirm) {
+                NSApplication.shared.stopModal()
+                controller.window?.orderOut(nil)
+                controller.window?.close()
+            }
+        }
+        configWindowVC.window?.center()
+        NSApplication.shared.runModal(for: configWindowVC.window!)
+    }
+    
+    func pdfListViewEditAnnotation(_ pdfListView: CPDFDigtalView!, for anotation: CPDFAnnotation!) {
+        if anotation.className == CPDFSignatureWidgetAnnotation.className() {
+            let signatureWidget = anotation as! CPDFSignatureWidgetAnnotation
+            var signature = signatureWidget.signature()
+            if signature == nil {
+                return
+            }
+            if signature?.signers != nil {
+                self.editWidgeAnnotation = signatureWidget
+                self.popUpSignatureWidgetState(signature!, self.pdfView)
+            } else if signatureWidget.isSigned() {
+//                self.signElectronicSignature(signatureWidget)
+            } else {
+                
+            }
+            
+////            __block WindowController *weakself = self;
+//            CPDFSignatureWidgetAnnotation *signatureWidget = (CPDFSignatureWidgetAnnotation *)annotation;
+//            CPDFSignature *signature = [signatureWidget signature];
+//            if (signature.signers.count > 0) {
+//                [self popUpSignatureWidgetState:signature];
+//            } else if (signatureWidget.isSigned) {
+//                [self signElectronicSignature:signatureWidget];
+//            } else {
+//                CDSignatureSignTypeWindowController *signType = [[CDSignatureSignTypeWindowController alloc] init];
+//                signType.callback = ^(CDSignType type) {
+//                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//                        if(type == CDSignType_ElectronicSignature) {
+//                            [weakself signElectronicSignature:signatureWidget];
+//                        } else {
+//                            [weakself signDigitalSignature:signatureWidget];
+//                        }
+//                    });
+//                };
+//                [signType startModal:nil];
+//                [signType release];
+//            }
+        }
+    }
+
+    func popUpSignatureWidgetState(_ signature: CPDFSignature, _ pdfListView: CPDFDigtalView) ->(){
+        
+        if self.stateVC == nil {
+            self.stateVC = CDSignatureCertificateStateViewController.init()
+        }
+        self.stateVC.signature = signature
+        self.stateVC.pdfListView = pdfListView
+        self.stateVC.actionBlock = { stateVCSelf, actionType in
+            if actionType == .cancel {
+                stateVCSelf.dismiss(stateVCSelf)
+            } else if actionType == .confirm {
+                let signer = signature.signers.first
+                let signatureDetail = DSignatureDetailsViewController.init()
+                signatureDetail.certificates = (signer?.certificates)!
+                signatureDetail.signature = signature
+                signatureDetail.pdfListView = pdfListView
+                stateVCSelf.presentAsSheet(signatureDetail)
+            }
+        }
+        self.presentAsSheet(self.stateVC)
+        self.stateVC.reloadData()
+    }
+     
+    func signElectronicSignature(_ signatureWidgetAnnotation: CPDFSignatureWidgetAnnotation) -> () {
+        
+//        PDFCustomSignatureWindowController *signatureWindowController = [[PDFCustomSignatureWindowController alloc] init];
+//        __block typeof(self) blockSelf = self;
+//        [signatureWindowController beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(PDFSignature *signature){
+//            if (signature) {
+//                [signatureWidgetAnnotation signWithImage:signature.pathsImage];
+//                [blockSelf.PDFListView setNeedsDisplayAnnotationViewForPage:signatureWidgetAnnotation.page];
+//            }
+//        }];
+//        [signatureWindowController release];
+    }
+    
+    //MARK: Notification
+    @objc fileprivate func signatureStateChangeNoti() {
+         
+        let signatures = self.pdfView.document.signatures()!
+        
+        let tempArr = NSMutableArray()
+        for signature in signatures {
+            if signature.signers != nil {
+                if signature.signers.count > 0 {
+                    signature.verifySignature(with: self.pdfView.document)
+                    tempArr.add(signature)
+                }
+            }
+        }
+        self.pdfView.signatures = tempArr as? [Any]
+        
+        self.reloadState()
+        
+        if self.stateVC != nil {
+            let signatureWidget = self.editWidgeAnnotation!
+            var signature = signatureWidget.signature()
+            if signature == nil {
+                return
+            }
+            self.stateVC.signature = signature
+            self.stateVC.reloadData()
+        }
+    }
+}

+ 166 - 0
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.xib

@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMPDFDigitalSignViewController" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="contendView" destination="SJ2-pS-M3B" id="jyP-Zt-Wsa"/>
+                <outlet property="contentTopConst" destination="TVB-8H-a7j" id="PyN-MC-YU8"/>
+                <outlet property="exitBox" destination="gHQ-0K-XbK" id="uSU-eh-Wbc"/>
+                <outlet property="exitButton" destination="FD6-Gh-1xx" id="UaC-rl-g8o"/>
+                <outlet property="headerView" destination="0a0-Fd-gka" id="p2n-oy-DJG"/>
+                <outlet property="pdfContendView" destination="Zqz-md-wWY" id="KK3-10-e8X"/>
+                <outlet property="saveBox" destination="eVE-dl-Oe8" id="otO-Cg-X4G"/>
+                <outlet property="saveButton" destination="pzG-r6-BJl" id="Ub1-Xx-lJs"/>
+                <outlet property="stateBGView" destination="LSe-Oi-yzJ" id="hq1-dp-U6D"/>
+                <outlet property="stateButton" destination="Yrb-Nx-Xvp" id="WNb-tD-Nfw"/>
+                <outlet property="stateLbl" destination="OGs-L1-cgc" id="CLU-fl-D0T"/>
+                <outlet property="tipLabel" destination="Hl2-Ul-Rge" id="Hoo-dI-j2s"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="572" height="387"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="SJ2-pS-M3B">
+                    <rect key="frame" x="0.0" y="0.0" width="572" height="387"/>
+                    <subviews>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="0a0-Fd-gka">
+                            <rect key="frame" x="0.0" y="343" width="572" height="44"/>
+                            <subviews>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hl2-Ul-Rge">
+                                    <rect key="frame" x="18" y="14" width="211" height="17"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="You are under Digital Sign Mode" id="V0q-9R-zZp">
+                                        <font key="font" metaFont="system" size="14"/>
+                                        <color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <box boxType="custom" borderWidth="0.0" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="gHQ-0K-XbK">
+                                    <rect key="frame" x="376" y="9" width="74" height="26"/>
+                                    <view key="contentView" id="ayl-GF-cSS">
+                                        <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FD6-Gh-1xx" customClass="KMCustomButton">
+                                                <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
+                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                <buttonCell key="cell" type="bevel" title="Exit" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="aYO-5U-m8F">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="exitButtonAction:" target="-2" id="Kku-4m-T30"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                    </view>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="74" id="1er-PM-AqZ"/>
+                                        <constraint firstAttribute="height" constant="26" id="6d8-pV-4YK"/>
+                                    </constraints>
+                                </box>
+                                <box boxType="custom" borderWidth="0.0" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="eVE-dl-Oe8">
+                                    <rect key="frame" x="474" y="9" width="74" height="26"/>
+                                    <view key="contentView" id="OXf-Ca-GEx">
+                                        <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pzG-r6-BJl" customClass="KMCustomButton">
+                                                <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
+                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                <buttonCell key="cell" type="bevel" title="Save" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="udW-bE-j0F">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="saveButtonAction:" target="-2" id="aYF-ao-sD4"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                    </view>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="26" id="AZg-uX-u6o"/>
+                                        <constraint firstAttribute="width" constant="74" id="wJe-Fd-VPo"/>
+                                    </constraints>
+                                </box>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="44" id="3Nv-UG-pV6"/>
+                                <constraint firstItem="Hl2-Ul-Rge" firstAttribute="centerY" secondItem="0a0-Fd-gka" secondAttribute="centerY" id="7HZ-GG-ADP"/>
+                                <constraint firstItem="gHQ-0K-XbK" firstAttribute="centerY" secondItem="0a0-Fd-gka" secondAttribute="centerY" id="GFG-2f-bpw"/>
+                                <constraint firstItem="eVE-dl-Oe8" firstAttribute="centerY" secondItem="0a0-Fd-gka" secondAttribute="centerY" id="dO6-sh-x3I"/>
+                                <constraint firstItem="Hl2-Ul-Rge" firstAttribute="leading" secondItem="0a0-Fd-gka" secondAttribute="leading" constant="20" id="fda-ry-iQg"/>
+                                <constraint firstItem="eVE-dl-Oe8" firstAttribute="leading" secondItem="gHQ-0K-XbK" secondAttribute="trailing" constant="24" id="jJH-v2-8zV"/>
+                                <constraint firstAttribute="trailing" secondItem="eVE-dl-Oe8" secondAttribute="trailing" constant="24" id="jrj-SY-dGC"/>
+                            </constraints>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="LSe-Oi-yzJ">
+                            <rect key="frame" x="0.0" y="299" width="572" height="44"/>
+                            <subviews>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OGs-L1-cgc">
+                                    <rect key="frame" x="62" y="14" width="118" height="17"/>
+                                    <textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="Signature is valid." id="8Io-Az-nZb">
+                                        <font key="font" metaFont="system" size="14"/>
+                                        <color key="textColor" red="0.1529411765" green="0.23529411759999999" blue="0.38431372549999998" alpha="1" colorSpace="calibratedRGB"/>
+                                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                    </textFieldCell>
+                                </textField>
+                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Yrb-Nx-Xvp">
+                                    <rect key="frame" x="20" y="8" width="28" height="28"/>
+                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="ImageNameSigntureVerifySuccess" imagePosition="only" alignment="center" inset="2" id="CSb-kc-4bZ">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="28" id="KTF-vp-57P"/>
+                                        <constraint firstAttribute="width" constant="28" id="pH4-eK-D99"/>
+                                    </constraints>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="OGs-L1-cgc" firstAttribute="leading" secondItem="Yrb-Nx-Xvp" secondAttribute="trailing" constant="16" id="InY-f8-nYB"/>
+                                <constraint firstAttribute="height" constant="44" id="LP5-qS-vlI"/>
+                                <constraint firstItem="Yrb-Nx-Xvp" firstAttribute="centerY" secondItem="LSe-Oi-yzJ" secondAttribute="centerY" id="OhR-G4-aH5"/>
+                                <constraint firstItem="Yrb-Nx-Xvp" firstAttribute="leading" secondItem="LSe-Oi-yzJ" secondAttribute="leading" constant="20" id="bzp-4D-Iad"/>
+                                <constraint firstItem="OGs-L1-cgc" firstAttribute="centerY" secondItem="LSe-Oi-yzJ" secondAttribute="centerY" id="tp1-ZU-dCo"/>
+                            </constraints>
+                        </customView>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="Zqz-md-wWY">
+                            <rect key="frame" x="0.0" y="0.0" width="572" height="299"/>
+                        </customView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="0a0-Fd-gka" firstAttribute="top" secondItem="SJ2-pS-M3B" secondAttribute="top" id="55g-wO-0OT"/>
+                        <constraint firstAttribute="bottom" secondItem="Zqz-md-wWY" secondAttribute="bottom" id="FUC-Kx-gTD"/>
+                        <constraint firstAttribute="trailing" secondItem="0a0-Fd-gka" secondAttribute="trailing" id="G1W-22-Qz7"/>
+                        <constraint firstAttribute="trailing" secondItem="Zqz-md-wWY" secondAttribute="trailing" id="O3j-vR-LrR"/>
+                        <constraint firstItem="LSe-Oi-yzJ" firstAttribute="top" secondItem="0a0-Fd-gka" secondAttribute="bottom" id="T4w-1s-hJl"/>
+                        <constraint firstItem="Zqz-md-wWY" firstAttribute="top" secondItem="0a0-Fd-gka" secondAttribute="bottom" constant="44" id="TVB-8H-a7j"/>
+                        <constraint firstItem="0a0-Fd-gka" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="Xr7-mF-Gp6"/>
+                        <constraint firstAttribute="trailing" secondItem="LSe-Oi-yzJ" secondAttribute="trailing" id="Yh1-Yn-0lm"/>
+                        <constraint firstItem="LSe-Oi-yzJ" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="gFX-ft-SN3"/>
+                        <constraint firstItem="Zqz-md-wWY" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="pXw-1w-Uie"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="SJ2-pS-M3B" secondAttribute="bottom" id="EUd-sg-sLZ"/>
+                <constraint firstItem="SJ2-pS-M3B" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="L88-8E-hNk"/>
+                <constraint firstAttribute="trailing" secondItem="SJ2-pS-M3B" secondAttribute="trailing" id="R3R-Qo-tcK"/>
+                <constraint firstItem="SJ2-pS-M3B" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="XUe-4Q-CHV"/>
+            </constraints>
+            <point key="canvasLocation" x="75" y="188.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameSigntureVerifySuccess" width="32" height="32"/>
+    </resources>
+</document>

+ 397 - 0
PDF Office/PDF Master/Class/DigtalSignature/DSignatureApperanceManager.swift

@@ -0,0 +1,397 @@
+//
+//  DSignatureApperanceManager.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/8.
+//
+
+import Cocoa
+
+class DSignatureAppearanceData: NSObject {
+    
+    var appearanceName = NSString()
+    var signatureConfig = CPDFSignatureConfig()
+    var tag = NSString()
+    var drawType: CDSignatureCustomType = .none
+    var isInputDSignatureText: Bool = false
+    
+    override init() {
+        super.init()
+        
+        appearanceName = ""
+        
+    }
+    
+}
+
+class DSignatureApperanceManager: NSObject {
+
+    @objc public static let manager = DSignatureApperanceManager.init()
+    
+    var signatures: NSMutableArray!
+    
+    override init() {
+        super.init()
+        
+        self.signatures = NSMutableArray.init()
+    }
+    
+    @objc func tagString() -> NSString {
+        let dateFormatter = DateFormatter.init()
+        dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+        let dateString = dateFormatter.string(from: NSDate() as Date)
+        return NSString(format: "%@ %d", dateString, arc4random()%10000)
+    }
+    
+    func getFileSize(atPath filePath : String) -> CGFloat {
+        guard let dict = try? FileManager.default.attributesOfItem(atPath: filePath) as NSDictionary else {
+            return 0
+        }
+        return CGFloat(dict.fileSize())
+    }
+    
+    func sortContens(_ contens: NSArray) -> NSArray {
+        let tContens = NSMutableArray()
+        
+        var nameItem: CPDFSignatureConfigItem!
+        var dnItem: CPDFSignatureConfigItem!
+        var reaItem: CPDFSignatureConfigItem!
+        var locaItem: CPDFSignatureConfigItem!
+        var dateItem: CPDFSignatureConfigItem!
+        var verItem: CPDFSignatureConfigItem!
+        
+        for item in contens {
+            if (item as! CPDFSignatureConfigItem).key == NAME_KEY {
+                nameItem = item as? CPDFSignatureConfigItem
+            } else if (item as! CPDFSignatureConfigItem).key == DN_KEY {
+                dnItem = item as? CPDFSignatureConfigItem
+            } else if (item as! CPDFSignatureConfigItem).key == REASON_KEY {
+                reaItem = item as? CPDFSignatureConfigItem
+            } else if (item as! CPDFSignatureConfigItem).key == LOCATION_KEY {
+                locaItem = item as? CPDFSignatureConfigItem
+            } else if (item as! CPDFSignatureConfigItem).key == DATE_KEY {
+                dateItem = item as? CPDFSignatureConfigItem
+            } else if (item as! CPDFSignatureConfigItem).key == VERSION_KEY {
+                verItem = item as? CPDFSignatureConfigItem
+            }
+        }
+        
+        if nameItem != nil {
+            tContens.add(nameItem as Any)
+        }
+        
+        if dnItem != nil {
+            tContens.add(dnItem as Any)
+        }
+        
+        if reaItem != nil {
+            tContens.add(reaItem as Any)
+        }
+        
+        if locaItem != nil {
+            tContens.add(locaItem as Any)
+        }
+        
+        if dateItem != nil {
+            tContens.add(dateItem as Any)
+        }
+        
+        if verItem != nil {
+            tContens.add(verItem as Any)
+        }
+        
+        return tContens
+    }
+    
+    //MARK: Load
+    public func loadDSignatureAppearanceDatas() -> NSMutableArray{
+        self.signatures.removeAllObjects()
+        
+        if FileManager.default.fileExists(atPath: kDSignaturePlistPath) {
+            let dictionary = NSDictionary(contentsOfFile: kDSignaturePlistPath)!
+            for key in dictionary.allKeys {
+                let dic: NSDictionary = dictionary[key] as! NSDictionary
+                
+                let data: DSignatureAppearanceData = DSignatureAppearanceData.init()
+                data.tag = key as! NSString
+                data.appearanceName = dic[kDSignatureOfAppearanceKey] as! NSString
+                if (dic.value(forKey: kDSignatureOfDrawTypeKey) != nil) {
+                    data.drawType = CDSignatureCustomType(rawValue: dic[kDSignatureOfDrawTypeKey] as! NSInteger)!
+                } else {
+                    data.drawType = .none
+                }
+                data.signatureConfig = self.switchDictionaryToWatermark(dic)
+                data.isInputDSignatureText = (dic[kDSignatureOfIsTextKey] != nil)
+                
+                self.signatures.add(data)
+            }
+        }
+        if self.signatures.count < 1 {
+            let data = self.standardDSignatureAppearanceData()
+            data.tag = self.tagString()
+            data.appearanceName = NSLocalizedString("Standard Text", comment: "") as NSString
+            _ = self.addDSignatureAppearanceData(watermark: data)
+            
+        }
+        return self.signatures
+    }
+    
+    func getLastDSignatureAppearanceData() -> DSignatureAppearanceData {
+        let data = DSignatureAppearanceData.init()
+        
+        
+        var info: [String : Any] = [:]
+        if (UserDefaults.standard.value(forKey: kLastAddDSignatureDataKey) == nil) {
+            
+        } else {
+            info = (UserDefaults.standard.value(forKey: kLastAddDSignatureDataKey) as! [String : Any])
+        }
+        var watermarkDic = NSMutableDictionary(dictionary: info)
+        
+        if watermarkDic.allKeys.count > 0 {
+            data.tag = watermarkDic.allKeys.first as! NSString
+            
+            var appearanceDic: [String : Any] = [:]
+            if (watermarkDic.object(forKey: data.tag as Any) == nil) {
+                
+            } else {
+                appearanceDic = watermarkDic.object(forKey: data.tag as Any) as! [String : Any]
+                data.appearanceName = appearanceDic[kDSignatureOfAppearanceKey] as! NSString
+                let typeA: CDSignatureCustomType = appearanceDic[kDSignatureOfDrawTypeKey] as? CDSignatureCustomType ?? .none
+                data.drawType = typeA
+                data.signatureConfig = self.switchDictionaryToWatermark(appearanceDic as NSDictionary)
+                data.isInputDSignatureText = (appearanceDic[kDSignatureOfIsTextKey] != nil)
+            }
+        }
+        return data
+    }
+    
+    //MARK: Get
+    func standardDSignatureAppearanceData() -> DSignatureAppearanceData {
+        let data = DSignatureAppearanceData.init()
+        data.drawType = .text
+        
+        let config = CPDFSignatureConfig.init()
+        config.isDrawLogo = true
+        config.isContentAlginLeft = false
+        config.isDrawKey = true
+#if VERSION_FREE
+#if VERSION_DMG
+        config.logo = NSImage(named: "PDF Reader Pro")
+#else
+        config.logo = NSImage(named: "PDF Reader Pro Free")
+#endif
+        
+#else
+        config.logo = NSImage(named: "PDF Reader Pro Edition")
+#endif
+        
+        let nameItem = CPDFSignatureConfigItem.init()
+        nameItem.key = NAME_KEY
+        nameItem.value = NSLocalizedString("<your common name here>", comment: "")
+        
+        let dateItem = CPDFSignatureConfigItem.init()
+        dateItem.key = DATE_KEY
+         
+        let dateFormatter = DateFormatter.init()
+        dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+        dateItem.value = dateFormatter.string(from: NSDate() as Date)
+        
+        let contents = NSMutableArray()
+        contents.add(nameItem)
+        contents.add(dateItem)
+        
+        config.contents = self.sortContens(contents) as? [CPDFSignatureConfigItem]
+        
+        data.signatureConfig = config
+        data.isInputDSignatureText = false
+        
+        return data
+    }
+    
+    //MARK: Switch
+    func switchDictionaryToWatermark(_ dic: NSDictionary) -> CPDFSignatureConfig {
+        let config = CPDFSignatureConfig.init()
+        
+        var contents = Array<Any>.init()
+        for key in dic.allKeys {
+            if key as! String == ISDRAWLOGO_KEY {
+                config.isDrawLogo = (dic[ISDRAWLOGO_KEY] != nil)
+            } else if key as! String == ISDRAW_KEY {
+                config.isDrawKey = (dic[ISDRAW_KEY] != nil)
+            } else if key as! String == ISCONTENTALGINLEGF_KEY {
+                if let isContentAlignLeft = dic[ISCONTENTALGINLEGF_KEY] as? Bool {
+                    config.isContentAlginLeft = isContentAlignLeft
+                }
+            } else if key as! String == kDSignatureOfTextKey {
+                config.text = dic[kDSignatureOfTextKey] as? String
+            } else if key as! String == kDSignatureOfImagePathKey {
+                guard let keyValue = dic[kDSignatureOfImagePathKey] as? String else {
+                    return config
+                }
+                let filePath = kDSignatureFolderPath + "/" + keyValue
+                if FileManager.default.fileExists(atPath: filePath) {
+                    config.image = NSImage.init(contentsOfFile: filePath)
+                }
+            } else {
+                let item = CPDFSignatureConfigItem.init()
+                item.key = NSLocalizedString(key as! String, comment: "")
+                item.value = dic[key] as? String
+                
+                contents.append(item)
+            }
+        }
+        
+        if config.isDrawLogo {
+#if VERSION_FREE
+#if VERSION_DMG
+        config.logo = NSImage(named: "PDF Reader Pro")
+#else
+        config.logo = NSImage(named: "PDF Reader Pro Free")
+#endif
+        
+#else
+        config.logo = NSImage(named: "PDF Reader Pro Edition")
+#endif
+        }
+        config.contents = self.sortContens(contents as NSArray) as? [CPDFSignatureConfigItem]
+        return config
+    }
+    
+    func switchDSignatureToDictionary(signatureConfig: CPDFSignatureConfig) -> NSDictionary {
+        let configDictionary = NSMutableDictionary.init()
+        
+        if signatureConfig.isDrawLogo {
+            configDictionary.setObject((1), forKey: ISDRAWLOGO_KEY as NSCopying)
+        } else {
+            configDictionary.setObject((0), forKey: ISDRAWLOGO_KEY as NSCopying)
+        }
+        
+        if signatureConfig.isDrawKey {
+            configDictionary.setObject((1), forKey: ISDRAW_KEY as NSCopying)
+        } else {
+            configDictionary.setObject((0), forKey: ISDRAW_KEY as NSCopying)
+        }
+        
+        if signatureConfig.isContentAlginLeft {
+            configDictionary.setObject((1), forKey: ISCONTENTALGINLEGF_KEY as NSCopying)
+        } else {
+            configDictionary.setObject((0), forKey: ISCONTENTALGINLEGF_KEY as NSCopying)
+        }
+        
+        if signatureConfig.text != nil {
+            configDictionary.setObject(signatureConfig.text as String, forKey: kDSignatureOfTextKey as NSCopying)
+        }
+        
+        if signatureConfig.image != nil {
+            let image = signatureConfig.image
+            let data = image?.tiffRepresentation
+            
+            let imageRep = NSBitmapImageRep(data: data!)
+            imageRep?.size = image!.size
+            
+            var imageData: NSData?
+            imageData = imageRep?.representation(using: .png, properties: [:]) as NSData?
+            
+            let tag = self.tagString()
+            let rPath = kDSignatureFolderPath.appending("/\(tag).png")
+            imageData?.write(toFile: rPath, atomically: true)
+           
+            var pathComponent: NSString?
+            pathComponent = NSString(format: "%@/%@.png", kDSignatureFolderPath, tag)
+            configDictionary.setObject(pathComponent?.lastPathComponent as Any, forKey: kDSignatureOfImagePathKey as NSCopying)
+        }
+        for item in signatureConfig.contents {
+            configDictionary.setValue(item.value, forKey: item.key)
+        }
+        
+        return configDictionary as NSDictionary
+    }
+    
+    //MARK: Add
+    func addDSignatureAppearanceData(watermark: DSignatureAppearanceData) -> Bool {
+        if FileManager.default.fileExists(atPath: kDSignatureFolderPath) == false {
+            try?FileManager.default.createDirectory(atPath: kDSignatureFolderPath, withIntermediateDirectories: false)
+            if FileManager.default.fileExists(atPath: kDSignatureFolderPath) == false {
+                return false
+            }
+        }
+        
+        if FileManager.default.fileExists(atPath: kDSignaturePlistPath) == false {
+            if FileManager.default.createFile(atPath: kDSignaturePlistPath, contents: nil, attributes: nil) == false {
+                return false
+            }
+        }
+        
+        var dictionary = NSDictionary.init()
+        if self.getFileSize(atPath: kDSignaturePlistPath) > 0 {
+            dictionary = NSDictionary(contentsOfFile: kDSignaturePlistPath)!
+        }
+        let newDictionary = NSMutableDictionary(dictionary: dictionary)
+        
+        let tag = watermark.tag
+        let appearanceDic = self.switchDSignatureToDictionary(signatureConfig: watermark.signatureConfig)
+        appearanceDic.setValue(watermark.appearanceName, forKey: kDSignatureOfAppearanceKey)
+        appearanceDic.setValue((watermark.drawType.rawValue), forKey: kDSignatureOfDrawTypeKey)
+        if watermark.isInputDSignatureText {
+            appearanceDic.setValue((1), forKey: kDSignatureOfIsTextKey)
+        } else {
+            appearanceDic.setValue((0), forKey: kDSignatureOfIsTextKey)
+        }
+        newDictionary.setObject(appearanceDic, forKey: tag)
+        if newDictionary.write(toFile: kDSignaturePlistPath, atomically: true) {
+            if self.signatures.count < 1 {
+                self.signatures.add(watermark)
+            } else {
+                self.signatures.insert(watermark, at: 0)
+            }
+            return true
+        }
+        
+        return false
+    }
+    
+    //MARK: Remove
+    func removeDSignatureAppearanceData(watermark: DSignatureAppearanceData) -> Bool {
+        let key = watermark.tag
+        if key.length == 0 {
+            return false
+        }
+        if FileManager.default.fileExists(atPath: kDSignaturePlistPath) == false {
+            return false
+        }
+        
+        let dictionary = NSDictionary(contentsOfFile: kDSignaturePlistPath)!
+        let newDictionary = NSMutableDictionary(dictionary: dictionary)
+        
+        newDictionary.removeObject(forKey: key as Any)
+        
+        if newDictionary.write(toFile: kDSignaturePlistPath, atomically: true) {
+            self.signatures.remove(watermark)
+            return true
+        }
+        return false
+    }
+    
+    //MARK: Save
+    func saveDSignatureAppearanceData(watermark: DSignatureAppearanceData) ->() {
+        
+        let watermarkDictionary = NSMutableDictionary()
+        let appearanceDic = self.switchDSignatureToDictionary(signatureConfig: watermark.signatureConfig)
+        appearanceDic.setValue(watermark.appearanceName, forKey: kDSignatureOfAppearanceKey)
+        appearanceDic.setValue((watermark.drawType.rawValue), forKey: kDSignatureOfDrawTypeKey)
+        if watermark.isInputDSignatureText {
+            appearanceDic.setValue((1), forKey: kDSignatureOfIsTextKey)
+        } else {
+            appearanceDic.setValue((0), forKey: kDSignatureOfIsTextKey)
+        }
+        watermarkDictionary.setObject(appearanceDic, forKey: watermark.tag)
+        
+        UserDefaults.standard.setValue(watermarkDictionary, forKey: kLastAddDSignatureDataKey)
+        UserDefaults.standard.setValue((1), forKey: "kHaveSaveWatermarkData")
+        UserDefaults.standard.synchronize()
+        
+    }
+    
+    
+}

+ 135 - 0
PDF Office/PDF Master/Class/DigtalSignature/DSignatureConfig.swift

@@ -0,0 +1,135 @@
+//
+//  DSignatureConfig.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/27.
+//
+
+import Foundation
+
+let NAME_KEY = NSLocalizedString("Signed by", comment: "")
+let DN_KEY = NSLocalizedString("DN", comment: "")
+let REASON_KEY = NSLocalizedString("Reason", comment: "")
+let LOCATION_KEY = NSLocalizedString("Location", comment: "")
+let DATE_KEY = NSLocalizedString("Date", comment: "")
+
+#if VERSION_FREE
+
+#if VERSION_DMG
+let VERSION_KEY = NSLocalizedString("PDF Reader Pro Version", comment: "")
+#else
+let VERSION_KEY = NSLocalizedString("PDF Reader Pro Lite Version", comment: "")
+#endif
+
+#else
+let VERSION_KEY = NSLocalizedString("PDF Reader Pro Version", comment: "")
+#endif
+
+let ISDRAW_KEY = "isDrawKey"
+let ISDRAWLOGO_KEY = "isDrawLogo"
+let ISCONTENTALGINLEGF_KEY = "isContentAlginLeft"
+
+let SAVEFILEPATH_KEY = "FilePathKey"
+let PASSWORD_KEY = "PassWordKey"
+
+let CAuthenticationLastNameKey        = "CAuthenticationLastName"
+let CAuthenticationNameKey            = "CAuthenticationName"
+let CAuthenticationTitleKey           = "CAuthenticationTitle"
+let CAuthenticationCompanyNameKey     = "CAuthenticationCompanyName"
+let CAuthenticationCompanyNameSealKey = "CAuthenticationCompanyNameSeal"
+let CAuthenticationDepartmentKey      = "CAuthenticationDepartment"
+let CAuthenticationEmailAddressKey    = "CAuthenticationEmailAddress"
+
+let KMSignatureTrustCerDidChangeNotification  = "KMSignatureTrustCerDidChangeNotification"
+
+let ApplicationSupportDirectory = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.applicationSupportDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).last! + "/" + Bundle.main.bundleIdentifier!
+
+let kDSignatureFolderPath = ApplicationSupportDirectory.appending("/CDSignaturesAppearance")
+let kDSignaturePlistPath = kDSignatureFolderPath.appending("/CDSignaturesAppearance.plist")
+
+let kDigitalSignatureFolderPath = ApplicationSupportDirectory.appending("/DigitalSignature")
+let kDigitalSignaturePlistPath = kDigitalSignatureFolderPath.appending("/DigitalSignature.plist")
+
+let kLastAddDSignatureDataKey  = "CAddLastDSignatureDatasKey"
+let kDSignatureOfTextKey       = "DSignatureOfNameTextKey"
+let kDSignatureOfIsTextKey     = "DSignatureOfNameISTextKey"
+let kDSignatureOfImagePathKey  = "DSignatureOfImagePathKey"
+let kDSignatureOfAppearanceKey = "DSignatureOfAppearanceKey"
+let kDSignatureOfDrawTypeKey   = "DSignatureOfDrawTypeKey"
+
+class DSignatureConfig {
+    
+}
+
+@objc public enum DSignatureViewType: NSInteger {
+    case none = 0
+    case fileList       = 1
+    case certifyDetail  = 2
+    case createNew      = 3
+    case createFromFile = 4
+    case saveType       = 5
+    case createInfo     = 6
+    case saveFolderType = 7
+    case signatureDetail = 8
+    case edit            = 9
+    case fromFileList = 10
+}
+
+@objc public enum DSignatureActionType: NSInteger {
+    case none = 0
+    case cancel = 1
+    case confirm = 2
+    case createNewDsign = 3
+    case previousStep = 4
+    case create = 5
+    case edit = 6
+    case delete = 7
+    case viewDetail = 8
+}
+
+@objc public enum CDSignatureCreatType: NSInteger {
+    case createNone = 0
+    case signCreate = 1
+    case fromFile = 2
+
+}
+
+@objc public enum CDSignatureSaveType: NSInteger {
+    case none = 0
+    case folder = 1
+    case keyChain = 2
+}
+
+@objc public enum CDSignatureCustomType: NSInteger {
+    case text = 0
+    case draw = 1
+    case image = 2
+    case none = 3
+}
+
+@objc public enum CPromptSignaturesState: NSInteger {
+    case failure = 0
+    case Unknown = 1
+    case Success = 2
+}
+
+@objcMembers public class Swift_oc_Tool: NSObject {
+    
+    static let NAME_KEY_OC = NAME_KEY
+    static let DN_KEY_OC = DN_KEY
+    static let REASON_KEY_OC = REASON_KEY
+    static let LOCATION_KEY_OC = LOCATION_KEY
+    static let DATE_KEY_OC = DATE_KEY
+    static let VERSION_KEY_OC = VERSION_KEY
+
+    static let SAVEFILEPATH_KEY_OC = SAVEFILEPATH_KEY
+    static let PASSWORD_KEY_OC = PASSWORD_KEY
+    
+    static let kDSignatureFolderPath_OC = kDSignatureFolderPath
+    static let kDSignaturePlistPath_OC = kDSignaturePlistPath
+    
+    static let kDigitalSignatureFolderPath_OC = kDigitalSignatureFolderPath
+    static let kDigitalSignaturePlistPath_OC = kDigitalSignaturePlistPath
+    
+}
+

+ 422 - 0
PDF Office/PDF Master/Class/DigtalSignature/DSignatureConfigWindowController.swift

@@ -0,0 +1,422 @@
+//
+//  DSignatureConfigWindowController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/27.
+//
+
+import Cocoa
+
+typealias configWActionInfoBlock = (_ controller: DSignatureConfigWindowController, _ type: DSignatureActionType) -> Void
+
+@objcMembers class DSignatureConfigWindowController: NSWindowController {
+    
+    @IBOutlet weak var contendBox: NSBox!
+    
+    var fileListVC: DSignatureFileListViewController           = DSignatureFileListViewController.init()
+    var certifyDetailVC: DSignatureCertifyDetailViewController!
+    var createVC: DSignatureCreateViewController               = DSignatureCreateViewController.init()
+    var fromFileVC: DSignatureFromFileViewController           = DSignatureFromFileViewController.init()
+    var saveTypeVC: DSignatureSaveTypeViewController           = DSignatureSaveTypeViewController.init()
+    var createInfoVC: DSignatureCreateInfoViewController       = DSignatureCreateInfoViewController.init()
+    var saveFolderTypeVC: DSignatureSaveFolderViewController   = DSignatureSaveFolderViewController.init()
+    var certificateCustomVC: CDSignatureCertificateCustomViewController = CDSignatureCertificateCustomViewController.init()
+    
+    @objc var _viewType: DSignatureViewType = .none
+    
+    @objc var appearanceWidget: CPDFSignatureWidgetAnnotation!
+    @objc var isCreatDS: Bool = false
+    
+    private var cert: KMDSignatureModel!
+    
+    private var certDictionary: NSDictionary!
+    private var certUsage: CPDFCertUsage!
+    
+    private var saveType: CDSignatureSaveType = .none
+    
+    var actionBlock: ((DSignatureConfigWindowController, DSignatureActionType)->Void)?
+    var complentionHandle: ((_ isSign: Bool, _ dic: NSDictionary, _ config: CPDFSignatureConfig, _ isLock: Bool) ->Void)?
+    
+    override func windowDidLoad() {
+        super.windowDidLoad()
+        // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+        
+        self.initFileListVC()
+        
+        self.initCreateVC()
+        self.initFromFileVC()
+        self.initSaveTypeVC()
+        self.initCreateInfoViewVC()
+        self.initSaveFolderVC()
+        self.initCertificateCustomVC()
+        
+        if KMDSignatureManager.default().signatures.count == 0 {
+            KMDSignatureManager.default().loadAllKeyChainCertificates()
+        }
+        
+    }
+    
+    //MARK: Setter
+    @objc var viewType: DSignatureViewType {
+        set {
+            _viewType = newValue;
+            
+            switch _viewType {
+                
+            case .none:
+                
+                break
+            case .fileList:
+                self.setContendView(self.fileListVC.view)
+                self.fileListVC.isFileList = false
+                
+                break
+            case .certifyDetail:
+                
+                self.initCertifyDetailVC()
+                self.setContendView(self.certifyDetailVC.view)
+                
+                break
+            case .createNew:
+                self.createVC.isCreatDS = self.isCreatDS
+                self.setContendView(self.createVC.view)
+                
+                break
+            case .createFromFile:
+                self.setContendView(self.fromFileVC.view)
+                
+                break
+            case .saveType:
+                self.setContendView(self.saveTypeVC.view)
+                
+                break
+            case .createInfo:
+                self.setContendView(self.createInfoVC.view)
+                
+                break
+            case .saveFolderType:
+                self.setContendView(self.saveFolderTypeVC.view)
+                
+                break
+            case .signatureDetail:
+
+                break
+                
+            case .edit:
+                self.certificateCustomVC.signatureWidget = self.appearanceWidget
+                self.certificateCustomVC.cert = self.cert
+                self.setContendView(self.certificateCustomVC.view)
+                break
+                
+            case .fromFileList:
+                self.fileListVC.isFileList = true
+                
+                self.setContendView(self.fileListVC.view)
+                break
+                
+            }
+        }
+        
+        get {
+            return _viewType;
+        }
+    }
+    
+    
+    
+    func setContendView(_ view: NSView) {
+        
+        
+        var frame = self.window?.frame
+        
+        let originX = (frame?.origin.x)!
+        let originY = (frame?.origin.y)!
+        let height: CGFloat = (frame?.size.height)!
+        let width: CGFloat = (frame?.size.width)!
+        
+        var viewHeight: CGFloat = 500
+        if self.viewType == .fileList ||
+            self.viewType == .fromFileList {
+            viewHeight = 499 + 22
+        } else if self.viewType == .createNew {
+            viewHeight = 500 + 22
+        } else if self.viewType == .certifyDetail {
+            viewHeight = 450 + 22
+        } else if self.viewType == .createFromFile {
+            viewHeight = 410 + 22
+        } else if self.viewType == .edit {
+            viewHeight = 530 + 22
+        } else if self.viewType == .saveType {
+            viewHeight = 430 + 22
+        } else if self.viewType == .saveFolderType {
+            viewHeight = 450 + 22
+        }  else {
+            frame?.size.height = view.frame.size.height + 22
+        }
+        
+        
+        frame?.size.height = viewHeight
+        frame?.origin.y = originY + (height - viewHeight)
+        
+        self.window?.setFrame(frame!, display: true)
+        self.contendBox.contentView = view
+    }
+    
+    //MARK: DSignatureFileListViewController
+    func initFileListVC () {
+        weak var weakSelf = self
+        self.fileListVC.actionBlock = { fileListVC, type in
+            if type == .cancel {
+                if fileListVC.isFileList {
+                    weakSelf!.viewType = .createFromFile
+                } else {
+                    guard let callback = weakSelf!.actionBlock else {
+                        return
+                    }
+                    callback(weakSelf!, type)
+                }
+            } else if type == .confirm {
+                if fileListVC.isFileList {
+                    weakSelf!.viewType = .fileList
+                } else {
+                    weakSelf!.cert = fileListVC.currentModel
+                    
+                    weakSelf!.viewType = .certifyDetail
+                }
+            } else if type == .createNewDsign {
+                weakSelf!.viewType = .createNew
+            }
+        }
+        
+        self.fileListVC.viewCertDetailBlock = {fileListVC, certificate, isDigitalFile in
+            DispatchQueue.main.async {
+                let signatureDetailVC = DSignatureDetailsViewController.init()
+                signatureDetailVC.isDigitalFile = isDigitalFile
+                signatureDetailVC.certificates = [certificate]
+                
+                fileListVC.presentAsModalWindow(signatureDetailVC)
+            }
+        }
+        
+    }
+    
+    //MARK: DSignatureCertifyDetailViewController
+    func initCertifyDetailVC () {
+        if self.certifyDetailVC != nil {
+            self.certifyDetailVC.view.removeFromSuperview()
+            self.certifyDetailVC = nil
+        }
+        self.certifyDetailVC = DSignatureCertifyDetailViewController.init()
+        self.certifyDetailVC.cert = self.cert
+        self.certifyDetailVC.signatureWidget = self.appearanceWidget
+        
+        self.certifyDetailVC.actionBlock = {detailVC, actionType, appearanceData, config, password, isLock in
+            if actionType == .cancel {
+                self.closeAction()
+            } else if actionType == .previousStep {
+                self.viewType = .fileList
+            } else if actionType == .confirm {
+                var returnAcType = actionType
+                
+                let dic = NSMutableDictionary()
+                if self.cert.isFormKeyChain {
+                    var save: Bool = false
+                    let folderPath = kDSignatureFolderPath
+                    
+                    if FileManager.default.fileExists(atPath: folderPath) == false {
+                        try?FileManager.default.createDirectory(atPath: kDSignatureFolderPath, withIntermediateDirectories: false)
+                    }
+                    let filePath = kDSignatureFolderPath.appending("/CDSignatures.p12")
+                    save = KMDSignatureManager.exportKeyChain(withP12FilePath: filePath, signatureModel: self.cert, passWord: "")
+                    if save {
+                        dic.setValue(filePath, forKey: SAVEFILEPATH_KEY)
+                        dic.setValue("", forKey: PASSWORD_KEY)
+                    } else {
+                        return
+                    }
+                    if save == false {
+                        returnAcType = .none
+                    }
+                } else {
+                    dic.setValue(self.cert.filePath, forKey: SAVEFILEPATH_KEY)
+                    dic.setValue(password, forKey: PASSWORD_KEY)
+                }
+
+                guard let complentionCallBack = self.complentionHandle else {
+                    return
+                }
+                complentionCallBack(true, dic, config, isLock)
+                
+                guard let callback = self.actionBlock else {
+                    return
+                }
+                callback(self, returnAcType)
+                
+            } else if actionType == .create {
+                self.certificateCustomVC.isCreat = true
+                self.certificateCustomVC.appearanceData = nil
+                self.viewType = .edit
+            } else if actionType == .edit {
+                self.certificateCustomVC.isCreat = false
+                self.certificateCustomVC.appearanceData = appearanceData
+                self.viewType = .edit
+            } else if actionType == .delete {
+                
+            } else if actionType == .viewDetail {
+                
+            }
+            
+        }
+        
+    }
+    
+    //MARK: DSignatureCreateViewController
+    func initCreateVC () {
+        self.createVC.actionBlock = { createVC, actionType, createType in
+            if actionType == .previousStep {
+                self.viewType = .fileList
+            } else if actionType == .confirm {
+                if createType == .signCreate {
+                    self.viewType = .saveType
+                } else if createType == .fromFile {
+                    self.viewType = .createFromFile
+                }
+            } else if actionType == .cancel {
+                guard let callback = self.actionBlock else {
+                    return
+                }
+                callback(self, actionType)
+            }
+            
+        }
+    }
+    
+    //MARK: DSignatureFromFileViewController
+    func initFromFileVC () {
+        self.fromFileVC.actionBlock = {fromFileVC, action, cer in
+            if action == .cancel {
+                self.closeAction()
+            } else if action == .previousStep {
+                self.viewType = .createNew
+            } else if action == .confirm {
+                self.viewType = .fromFileList
+            } else if action == .createNewDsign {
+                self.viewType = .saveType
+            }
+        }
+    }
+    
+    //MARK: DSignatureSaveTypeViewController
+    func initSaveTypeVC () {
+        self.saveTypeVC.actionBlock = { saveTypeVC, actionType, saveType in
+            self.saveType = saveType
+            
+            if actionType == .cancel {
+                self.closeAction()
+            } else if actionType == .previousStep {
+                self.viewType = .createNew
+            } else if actionType == .confirm {
+                self.viewType = .createInfo
+            }
+        }
+    }
+    
+    //MARK: DSignatureCreateInfoViewController
+    func initCreateInfoViewVC () {
+        self.createInfoVC.actionBlock = { createVC, action, cer, certUsage in
+            self.certDictionary = cer
+            if certUsage == 0 {
+                self.certUsage = .digSig
+            } else if certUsage == 1 {
+                self.certUsage = .dataEnc
+            } else if certUsage == 2 {
+                self.certUsage = .all
+            }
+            
+            if action == .previousStep {
+                self.viewType = .saveType
+            } else if action == .confirm {
+                if self.saveType == .folder {
+                    self.viewType = .saveFolderType
+                } else {
+                    let folderPath = kDSignatureFolderPath
+                    var save: Bool = true
+                    if FileManager.default.fileExists(atPath: folderPath) == false {
+                        try?FileManager.default.createDirectory(atPath: folderPath, withIntermediateDirectories: false)
+                        save = FileManager.default.fileExists(atPath: folderPath)
+                    }
+                    let filePath = kDSignatureFolderPath.appending("/KMDSignatures.p12")
+                    save = CPDFSignature.generatePKCS12Cert(withInfo: cer as? [AnyHashable : Any], password: "1", toPath: filePath, certUsage: self.certUsage)
+                
+                    let success = KMDSignatureManager.default().importKeyChain(withP12FilePath: filePath, passWord: "1")
+                    if save && success && FileManager.default.fileExists(atPath: filePath) {
+                        self.viewType = .fileList
+                    } else {
+                        let alert = NSAlert.init()
+                        alert.messageText = NSLocalizedString("Save failed!", comment: "")
+                        alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                        alert.runModal()
+                    }
+                }
+            } else if action == .cancel {
+                self.closeAction()
+            }
+        }
+    }
+    
+    //MARK: DSignatureSaveFolderViewController
+    func initSaveFolderVC () {
+        self.saveFolderTypeVC.actionBlock = { saveFolderVC, actionType, infoDic in
+            if actionType == .cancel {
+                self.closeAction()
+            } else if actionType == .confirm {
+                var save: Bool = CPDFSignature.generatePKCS12Cert(withInfo: self.certDictionary as? [AnyHashable : Any], password: infoDic[PASSWORD_KEY] as? String, toPath: infoDic[SAVEFILEPATH_KEY] as? String, certUsage: self.certUsage)
+                KMDSignatureManager.default().moveP12DigitalFile(withFilePath: infoDic[SAVEFILEPATH_KEY] as? String, password: infoDic[PASSWORD_KEY] as? String)
+                if save {
+                    self.viewType = .fileList
+                } else {
+                    let alert = NSAlert.init()
+                    alert.messageText = NSLocalizedString("Save failed!", comment: "")
+                    alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                    alert.runModal()
+                }
+                
+                
+            } else if actionType == .previousStep {
+                self.viewType = .createInfo
+            }
+        }
+    }
+    
+    //MARK: CDSignatureCertificateCustomViewController
+    func initCertificateCustomVC () {
+        self.certificateCustomVC.actionBlock = {customVC, type, appearanceData in
+            if type == .cancel {
+                self.closeAction()
+            } else if type == .previousStep {
+                self.viewType = .certifyDetail
+            } else if type == .confirm {
+                
+                _ = DSignatureApperanceManager.manager.addDSignatureAppearanceData(watermark: appearanceData)
+                DSignatureApperanceManager.manager.saveDSignatureAppearanceData(watermark: appearanceData)
+
+                self.viewType = .certifyDetail
+                
+                self.certifyDetailVC.cert = self.cert
+                self.certifyDetailVC.appearanceData = appearanceData
+                self.certifyDetailVC.signatureWidget = self.appearanceWidget
+                self.certifyDetailVC.reloadSignatures()
+            }
+        }
+    }
+    
+    //
+    func closeAction() {
+        guard let callback = self.actionBlock else {
+            return
+        }
+        callback(self, .cancel)
+    }
+    
+    
+}

+ 47 - 0
PDF Office/PDF Master/Class/DigtalSignature/DSignatureConfigWindowController.xib

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureConfigWindowController" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="contendBox" destination="ArY-Oy-pfT" id="QNY-fu-Hxo"/>
+                <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" titled="YES" fullSizeContentView="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="608" height="531"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <view key="contentView" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="608" height="531"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ArY-Oy-pfT">
+                        <rect key="frame" x="0.0" y="0.0" width="608" height="531"/>
+                        <view key="contentView" id="NN1-i8-zR6">
+                            <rect key="frame" x="0.0" y="0.0" width="608" height="531"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        </view>
+                    </box>
+                </subviews>
+                <constraints>
+                    <constraint firstAttribute="bottom" secondItem="ArY-Oy-pfT" secondAttribute="bottom" id="224-oZ-9ge"/>
+                    <constraint firstAttribute="trailing" secondItem="ArY-Oy-pfT" secondAttribute="trailing" id="Ahn-Qh-lRt"/>
+                    <constraint firstItem="ArY-Oy-pfT" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="hI1-JO-rmz"/>
+                    <constraint firstItem="ArY-Oy-pfT" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="ye3-tm-mAg"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="114.5" y="36.5"/>
+        </window>
+    </objects>
+</document>

+ 150 - 0
PDF Office/PDF Master/Class/DigtalSignature/DSignatureManager.swift

@@ -0,0 +1,150 @@
+//
+//  DSignatureManager.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureManager: NSObject {
+    
+    public static let manager = DSignatureManager.init()
+    
+    lazy var signatures: NSArray = []
+    
+    override init() {
+        super.init()
+        
+        self.loadAllKeyChainCertificates()
+//        self.getAllKeychainItems()
+         
+    }
+    
+    func loadAllKeyChainCertificates () {
+
+        let keychainQuery: [String: Any] = [
+          kSecClass as String : kSecClassIdentity,
+          kSecReturnData as String  : true,
+          kSecReturnAttributes as String : true,
+          kSecReturnRef as String : true,
+          kSecMatchLimit as String: kSecMatchLimitAll,
+          kSecReturnPersistentRef as String: true
+        ]
+        
+        
+        var results: AnyObject?
+//        let status = SecItemCopyMatching(keychainQuery as CFDictionary, &results)
+        
+        let status = withUnsafeMutablePointer(to: &results) {
+          SecItemCopyMatching(keychainQuery as CFDictionary, UnsafeMutablePointer($0))
+        }
+        
+        var resultArr = results as! NSArray;
+
+        for result in resultArr {
+
+            let tResult = result as![String:Any]
+
+            let identify = tResult[kSecValueRef as String] as! AnyObject
+ 
+
+            var certificate: SecCertificate?
+//            let status = SecIdentityCopyCertificate(identify, &certificate)
+//            if (status == errSecSuccess) {
+                
+                let label = tResult[kSecAttrLabel as String] as? String
+                
+                let account = tResult[kSecAttrAccount as String] as? String
+                
+                guard let Issuer = tResult[kSecAttrIssuer as String] as? Data else { return  }
+                let IssuerKey = String(data: Issuer, encoding: .utf8)
+                
+                let valueReflabel = tResult[kSecValueRef as String] as? String
+                
+                guard let data = tResult[kSecValueData as String] as? Data else {
+                    return
+                }
+                let dataKey = String(data: data, encoding: .utf8)
+                
+                if let key = tResult[kSecAttrLabel as String] as? String,
+                   let value = tResult[kSecValueData as String] as? Data {
+                    print(value)
+                }
+                else if let key = tResult[kSecAttrLabel as String] as? String,
+                        let value = tResult[kSecValueRef as String] {
+                    print(value)
+                    
+                }
+                
+                print("adsf")
+//                {
+//                    values[key] = String(data: value, encoding:.utf8) as AnyObject?
+//                }
+//            }
+
+//            SecIdentityCopyCertificate(identify, &certificate)
+
+
+
+
+        }
+ 
+    }
+    
+    func getAllKeychainItems() {
+        
+        let classes = [kSecClassGenericPassword as String,  // Generic password items
+                       kSecClassInternetPassword as String, // Internet password items
+                       kSecClassCertificate as String,      // Certificate items
+                       kSecClassKey as String,              // Cryptographic key items
+                       kSecClassIdentity as String]         // Identity items
+        
+        
+//        classes.forEach { secClass in
+          let items = getAllKeyChainItemsOfClass( kSecClassIdentity as String )
+          NSLog(items.description)
+//        }
+      }
+    
+    func getAllKeyChainItemsOfClass(_ secClass: String) -> [String: AnyObject] {
+        
+        let query: [String: Any] = [
+          kSecClass as String : secClass,
+          kSecReturnData as String  : true,
+          kSecReturnAttributes as String : true,
+          kSecReturnRef as String : true,
+          kSecMatchLimit as String: kSecMatchLimitAll,
+        ]
+        
+        var result: AnyObject?
+        
+        let lastResultCode = withUnsafeMutablePointer(to: &result) {
+          SecItemCopyMatching(query as CFDictionary, UnsafeMutablePointer($0))
+        }
+        
+        var values = [String: AnyObject]()
+        if lastResultCode == noErr {
+            let array = result as? Array<Dictionary<String, Any>>
+            
+            for item in array! {
+                
+                let value = item[kSecAttrLabel as String] as? String
+                
+                if let key = item[kSecAttrAccount as String] as? String,
+                   let value = item[kSecValueData as String] as? Data {
+                    values[key] = String(data: value, encoding:.utf8) as AnyObject?
+                }
+                else if let key = item[kSecAttrLabel as String] as? String,
+                        let value = item[kSecValueRef as String] {
+                    print(value)
+                    values[key] = value as AnyObject
+                }
+        
+            }
+        }
+        return values
+      }
+    
+
+}

+ 21 - 0
PDF Office/PDF Master/Class/DigtalSignature/DSignatureModel.swift

@@ -0,0 +1,21 @@
+//
+//  DSignatureModel.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureModel: NSObject {
+    
+    var identityRef: SecIdentity!
+    var name: NSString!
+    var expiresDate: NSDate!
+    var issusName: NSString!
+    var DN: NSString!
+    var isFormKeyChain = false
+    var filePath: NSString!
+    var password: NSString!
+    
+}

+ 55 - 0
PDF Office/PDF Master/Class/DigtalSignature/KMDSignatureManager.h

@@ -0,0 +1,55 @@
+//
+//  KMDSignatureManager.h
+//  SignFlow
+//
+//  Created by 丁林圭 on 2021/8/2.
+//
+
+#import <Foundation/Foundation.h>
+
+#define DSignatureDidStartLoadNotification @"DSignatureDidStartLoadNotification"
+#define DSignatureDidFinishLoadNotification @"DSignatureDidFinishLoadNotification"
+
+@interface KMDSignatureModel: NSObject
+
+@property (nonatomic,assign) SecIdentityRef identityRef;
+
+@property (nonatomic,retain) NSString *name;
+
+@property (nonatomic,retain) NSDate *expiresDate;
+
+@property (nonatomic,retain) NSString *issusName;
+
+@property (nonatomic,retain) NSString *DN;
+
+@property (nonatomic,assign) BOOL isFormKeyChain;
+
+@property (nonatomic,retain) NSString *filePath;
+
+@property (nonatomic,retain) NSString *password;
+
+@end
+
+@interface KMDSignatureManager : NSObject
+
+@property (nonatomic,readonly) NSMutableArray *signatures;
+
++ (KMDSignatureManager *)defaultManager;
+
++ (BOOL)exportKeyChainWithP12FilePath:(NSString *)filePath signatureModel:(KMDSignatureModel *)model passWord:(NSString *)passWord;
+
++ (SecIdentityRef)privateKeyUsingSecItemImportFromP12File:(NSString *)filePath password:(NSString *)password;
+
+- (void)loadAllKeyChainCertificates;
+
+- (BOOL)importKeyChainWithP12FilePath:(NSString *)filePath passWord:(NSString *)passWord;
+
+- (BOOL)moveP12DigitalFileWithFilePath:(NSString *)filePath password:(NSString *)password;
+
+- (void)addSignatureCertPath:(NSString *)filePath passWord:(NSString *)password;
+
+- (BOOL)removeSignatureCertPath:(NSString *)filePath;
+
+- (NSArray *)sortContens:(NSArray *)contens;
+
+@end

+ 526 - 0
PDF Office/PDF Master/Class/DigtalSignature/KMDSignatureManager.m

@@ -0,0 +1,526 @@
+//
+//  KMDSignatureManager.m
+//  SignFlow
+//
+//  Created by 丁林圭 on 2021/8/2.
+//
+
+#import "KMDSignatureManager.h"
+#import "CPDFListView+Private.h"
+//#import "KMDSignatureAppearanceManager.h"
+
+//#import <KMPDFKit/KMPDFSignature.h>
+//#import "NSString_SKExtensions.h"
+
+#import <PDF_Master-Swift.h>
+
+@implementation KMDSignatureModel
+
+- (void)dealloc
+{
+}
+@end
+
+#pragma mark - KMDSignatureManager
+
+@interface KMDSignatureManager()
+
+@property (nonatomic,retain) NSMutableArray *signatures;
+
+@end
+
+@implementation KMDSignatureManager
+
+- (void)dealloc {
+
+}
+
+static CFAbsoluteTime  getExpiredDate(SecCertificateRef cert) {
+    CFErrorRef error;
+    
+    CFTypeRef key = kSecOIDX509V1ValidityNotAfter;
+    
+    CFArrayRef keySelection = CFArrayCreate(NULL, &key, 1, &kCFTypeArrayCallBacks);
+    
+    
+    CFDictionaryRef values = SecCertificateCopyValues(cert, keySelection, &error);
+    
+    CFDictionaryRef dict = CFDictionaryGetValue(values, key);
+    CFNumberRef notAfterRef = (CFNumberRef) CFDictionaryGetValue(dict, kSecPropertyKeyValue);
+    CFAbsoluteTime notAfter;
+    
+    CFNumberGetValue(notAfterRef, kCFNumberDoubleType, &notAfter);
+    return notAfter;
+}
+
+- (NSString *)subNameFromCerificateWithLongDescription:(SecCertificateRef)certificateRef {
+    
+    if (certificateRef == NULL)
+        return nil;
+    
+#if TARGET_OS_MAC
+    
+    const void *keys[] = { kSecOIDX509V1SubjectName};
+    CFArrayRef keySelection = CFArrayCreate(NULL, keys , sizeof(keys)/sizeof(keys[0]), &kCFTypeArrayCallBacks);
+    
+    CFErrorRef error;
+    CFDictionaryRef vals = SecCertificateCopyValues(certificateRef, keySelection, &error);
+    NSString *string = nil;
+    for(int i = 0; i < sizeof(keys)/sizeof(keys[0]); i++) {
+        CFDictionaryRef dict_values = CFDictionaryGetValue(vals, keys[i]);
+        
+        CFArrayRef values = CFDictionaryGetValue(dict_values, kSecPropertyKeyValue);
+        if (values == NULL)
+            continue;
+        string = [KMDSignatureManager stringFromDNwithSubjectName:values];
+    }
+    
+    CFRelease(vals);
+    
+#endif
+    
+    return string;
+}
+
++ (KMDSignatureManager *)defaultManager
+{
+    static KMDSignatureManager *singleton = nil;
+    static dispatch_once_t pred;
+    dispatch_once(&pred, ^{
+        singleton = [[KMDSignatureManager alloc] init];
+    });
+    return singleton;
+}
+
+- (id)init {
+    self = [super init];
+    if (self) {
+        self.signatures = [NSMutableArray array];
+    }
+    return self;
+}
+
+- (void)loadAllKeyChainCertificates {
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        [[NSNotificationCenter defaultCenter] postNotificationName:DSignatureDidStartLoadNotification object:nil];
+        
+        self.signatures = [NSMutableArray array];
+        
+        NSMutableDictionary *keychainQuery = [NSMutableDictionary dictionary];
+        [keychainQuery setObject:(__bridge id)kSecClassIdentity forKey:(__bridge id)kSecClass];
+        [keychainQuery setObject:(__bridge id)kSecMatchLimitAll forKey:(__bridge id)kSecMatchLimit];
+        [keychainQuery setObject:(id)kCFBooleanTrue forKey:(__bridge id)kSecReturnAttributes];
+        [keychainQuery setObject:(id)kCFBooleanTrue forKey:(__bridge id)kSecReturnRef];
+        
+        OSStatus keychainErr = noErr;
+        
+        CFArrayRef outDictionary;
+        keychainErr = SecItemCopyMatching((__bridge CFDictionaryRef)keychainQuery, (CFTypeRef *)&outDictionary);
+        
+        NSArray* array = (__bridge NSArray *)outDictionary;
+        for (NSInteger i=0; i<array.count; i++) {
+            SecIdentityRef identityRef = (__bridge SecIdentityRef)(array[i][(__bridge NSString *)kSecValueRef]);
+            KMDSignatureModel * model = [[KMDSignatureModel alloc] init];
+            model.identityRef = identityRef;
+            model.isFormKeyChain = YES;
+            SecCertificateRef certificateRef = nil;
+            OSStatus securityError = SecIdentityCopyCertificate(identityRef, &certificateRef);
+            if (errSecSuccess == securityError) {
+                const CSSM_X509_NAME *issuer = NULL;
+                securityError = SecCertificateGetIssuer(certificateRef, &issuer);
+                if (errSecSuccess == securityError) {
+                    model.issusName = [KMDSignatureManager certificateSubjectCommonName:issuer];
+                }
+                const CSSM_X509_NAME *subject = NULL;
+                securityError = SecCertificateGetSubject(certificateRef, &subject);
+                if (errSecSuccess == securityError) {
+                    model.name = [KMDSignatureManager certificateSubjectCommonName:subject];
+                }
+                model.DN = [self subNameFromCerificateWithLongDescription:certificateRef];
+                
+                CFAbsoluteTime notAfter = getExpiredDate(certificateRef);
+                CFDateRef cfDate = CFDateCreate(kCFAllocatorDefault, notAfter);
+                NSDate * date = (__bridge NSDate *)cfDate;
+                model.expiresDate = date;
+                CFRelease(cfDate);
+            }
+            [self.signatures addObject:model];
+        }
+        
+        if ([[NSFileManager defaultManager] fileExistsAtPath:Swift_oc_Tool.kDigitalSignaturePlistPath_OC]) {
+            NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:Swift_oc_Tool.kDigitalSignaturePlistPath_OC];
+            for (NSString *key in [dictionary allKeys]) {
+                NSDictionary *dic = [dictionary objectForKey:key];
+                NSString *filePath = dic[Swift_oc_Tool.SAVEFILEPATH_KEY_OC];
+                NSString *password = dic[Swift_oc_Tool.PASSWORD_KEY_OC];
+                if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
+                    continue;
+                }
+                
+                SecIdentityRef identity = [KMDSignatureManager privateKeyUsingSecItemImportFromP12File:filePath password:password];
+                
+                KMDSignatureModel *model = [[KMDSignatureModel alloc] init];
+                model.identityRef = identity;
+                model.isFormKeyChain = NO;
+                model.filePath = filePath;
+                model.password = password;
+                SecCertificateRef certificateRef = nil;
+                OSStatus securityError = SecIdentityCopyCertificate(identity, &certificateRef);
+                if (errSecSuccess == securityError) {
+                    const CSSM_X509_NAME *issuer = NULL;
+                    securityError = SecCertificateGetIssuer(certificateRef, &issuer);
+                    if (errSecSuccess == securityError) {
+                        model.issusName = [KMDSignatureManager certificateSubjectCommonName:issuer];
+                    }
+                    
+                    const CSSM_X509_NAME *subject = NULL;
+                    securityError = SecCertificateGetSubject(certificateRef, &subject);
+                    if (errSecSuccess == securityError) {
+                        model.name = [KMDSignatureManager certificateSubjectCommonName:subject];
+                    }
+                    model.DN = [self subNameFromCerificateWithLongDescription:certificateRef];
+                    
+                    CFAbsoluteTime notAfter = getExpiredDate(certificateRef);
+                    CFDateRef cfDate = CFDateCreate(kCFAllocatorDefault, notAfter);
+                    NSDate * date = (__bridge NSDate *)cfDate;
+                    model.expiresDate = date;
+                }
+                [self.signatures addObject:model];
+            }
+        }
+        
+        [[NSNotificationCenter defaultCenter] postNotificationName:DSignatureDidFinishLoadNotification object:nil];
+    });
+}
+
+#pragma mark - Setter and Getter
+- (NSString *)getUniqueFilePath:(NSString *)filePath {
+    int i = 0;
+    BOOL isDirectory = NO;
+    NSString* uniqueFilePath = filePath;
+    NSFileManager* filemanager = [NSFileManager defaultManager];
+    [filemanager fileExistsAtPath:uniqueFilePath isDirectory:&isDirectory];
+    if (isDirectory) {
+        while ([filemanager fileExistsAtPath:uniqueFilePath]) {
+            i++;
+            uniqueFilePath = [NSString stringWithFormat:@"%@(%d)",filePath,i];
+        }
+    } else {
+        while ([filemanager fileExistsAtPath:uniqueFilePath]) {
+            i++;
+            NSString* path = [NSString stringWithFormat:@"%@(%d)",[filePath stringByDeletingPathExtension],i];
+            uniqueFilePath = [path stringByAppendingPathExtension:[filePath pathExtension]];
+        }
+    }
+    return uniqueFilePath;
+}
+
++ (SecIdentityRef)privateKeyUsingSecItemImportFromP12File:(NSString *)filePath password:(NSString *)password {
+    SecIdentityRef key = NULL;
+    NSString *p12Path = filePath.stringByExpandingTildeInPath;
+    if (!password) {
+        password = @"";
+    }
+    NSData *p12Data = [NSData dataWithContentsOfFile:p12Path];
+    if (!p12Data) {
+        NSLog(@"Could not read p12 data from file: \"%@\".", p12Path);
+        return key;
+    }
+    OSStatus status;
+    SecKeychainRef keychain = NULL;
+    NSString *temporaryDirectory = NSTemporaryDirectory();
+    NSString *keychainPath = [[temporaryDirectory stringByAppendingPathComponent:[[NSUUID UUID] UUIDString]] stringByAppendingPathExtension:@"keychain"];
+    status = SecKeychainCreate(keychainPath.UTF8String, (UInt32)password.length, password.UTF8String, FALSE, NULL, &keychain);
+    if (status != errSecSuccess) {
+        if (keychain) {
+            SecKeychainDelete(keychain);
+            CFRelease(keychain);
+        }
+        return key;
+    }
+    NSMutableDictionary *options = [NSMutableDictionary dictionary];
+    if (password) {
+        [options setObject:password forKey:(id)kSecImportExportPassphrase];
+    }
+    [options setObject:(__bridge id)keychain forKey:(id)kSecImportExportKeychain];
+    CFArrayRef items = CFArrayCreate(NULL, 0, 0, NULL);
+    status = SecPKCS12Import((CFDataRef)p12Data, (CFDictionaryRef)options, &items);
+    if ((status == errSecSuccess) && (CFArrayGetCount(items) > 0)) {
+        CFDictionaryRef identityDict = CFArrayGetValueAtIndex(items, 0);
+        SecIdentityRef identity = (SecIdentityRef)CFDictionaryGetValue(identityDict, kSecImportItemIdentity);
+        key = identity;
+        
+    }
+    return key;
+}
+
++ (NSString *)certificateSubjectCommonName:(CSSM_X509_NAME *)name {
+    NSString *result = nil;
+    for (uint32 rdn = 0; rdn < name->numberOfRDNs; ++rdn) {
+        CSSM_X509_RDN rdnRef = name->RelativeDistinguishedName[rdn];
+        for (uint32 pair = 0; pair < rdnRef.numberOfPairs; ++pair) {
+            CSSM_DATA type = rdnRef.AttributeTypeAndValue[pair].type;
+            if (CSSMOID_CommonName.Length == type.Length &&
+                memcmp(CSSMOID_CommonName.Data, type.Data,
+                       CSSMOID_CommonName.Length) == 0) {
+                CSSM_DATA value = rdnRef.AttributeTypeAndValue[pair].value;
+                NSData *certCnData = [NSData dataWithBytes:value.Data
+                                                    length:value.Length];
+                NSString *certCnString
+                = [[NSString alloc] initWithData:certCnData
+                                         encoding:NSUTF8StringEncoding];
+                if (!result) {
+                    result = certCnString;
+                } else {
+                    result = [result stringByAppendingFormat:@", %@", certCnString];
+                }
+            }
+        }
+    }
+    return result;
+}
+
+- (NSArray *)sortContens:(NSArray *)contens {
+    NSMutableArray *tContens = [NSMutableArray array];
+
+    CPDFSignatureConfigItem *nameItem = nil;
+    CPDFSignatureConfigItem *dnItem = nil;
+    CPDFSignatureConfigItem *reaItem = nil;
+    CPDFSignatureConfigItem *locaItem = nil;
+    CPDFSignatureConfigItem *dateItem = nil;
+    CPDFSignatureConfigItem *verItem = nil;
+ 
+    for (CPDFSignatureConfigItem *item in contens) {
+        if ([item.key isEqual:Swift_oc_Tool.NAME_KEY_OC]) {
+            nameItem = item;
+        } else if ([item.key isEqual:Swift_oc_Tool.DN_KEY_OC]) {
+            dnItem = item;
+        } else if ([item.key isEqual:Swift_oc_Tool.REASON_KEY_OC]) {
+            reaItem = item;
+        } else if ([item.key isEqual:Swift_oc_Tool.LOCATION_KEY_OC]) {
+            locaItem = item;
+        } else if ([item.key isEqual:Swift_oc_Tool.DATE_KEY_OC]) {
+            dateItem = item;
+        } else if ([item.key isEqual:Swift_oc_Tool.VERSION_KEY_OC]) {
+            verItem = item;
+        }
+    }
+    
+    if (nameItem) {
+        [tContens addObject:nameItem];
+    }
+    if (dateItem) {
+        [tContens addObject:dateItem];
+    }
+    
+    if (reaItem) {
+        [tContens addObject:reaItem];
+    }
+    
+    if (dnItem) {
+        [tContens addObject:dnItem];
+    }
+  
+    if (verItem) {
+        [tContens addObject:verItem];
+    }
+    if (locaItem) {
+        [tContens addObject:locaItem];
+    }
+    return tContens;
+}
+
+#pragma mark - Add
+- (void)addSignatureCertPath:(NSString *)filePath passWord:(NSString *)password {
+    if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
+        return;;
+    }
+    
+    SecIdentityRef identity = [KMDSignatureManager privateKeyUsingSecItemImportFromP12File:filePath password:password];
+    [self addSecIdentityRef:identity certPath:filePath passWord:password];
+}
+
+- (void)addSecIdentityRef:(SecIdentityRef)identity certPath:(NSString *)filePath passWord:(NSString *)password {
+    KMDSignatureModel * model = [[KMDSignatureModel alloc] init];
+    model.identityRef = identity;
+    model.isFormKeyChain = filePath?NO:YES;
+    model.filePath = filePath;
+    model.password = password;
+    SecCertificateRef certificateRef = nil;
+    OSStatus securityError = SecIdentityCopyCertificate(identity, &certificateRef);
+    if (errSecSuccess == securityError) {
+        const CSSM_X509_NAME *issuer = NULL;
+        securityError = SecCertificateGetIssuer(certificateRef, &issuer);
+        if (errSecSuccess == securityError) {
+            model.issusName = [KMDSignatureManager certificateSubjectCommonName:issuer];
+        }
+        
+        const CSSM_X509_NAME *subject = NULL;
+        securityError = SecCertificateGetSubject(certificateRef, &subject);
+        if (errSecSuccess == securityError) {
+            model.name = [KMDSignatureManager certificateSubjectCommonName:subject];
+        }
+        CFAbsoluteTime notAfter = getExpiredDate(certificateRef);
+        CFDateRef cfDate = CFDateCreate(kCFAllocatorDefault, notAfter);
+        NSDate * date = (__bridge NSDate *)cfDate;
+        model.expiresDate = date;
+        
+        model.DN = [self subNameFromCerificateWithLongDescription:certificateRef];
+    }
+    if (self.signatures.count >0) {
+        [self.signatures insertObject:model atIndex:0];
+    } else {
+        [self.signatures addObject:model];
+    }
+}
+
+- (BOOL)removeSignatureCertPath:(NSString *)filePath
+{
+    if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
+        return NO;
+    }
+    for (KMDSignatureModel * model in self.signatures) {
+        if ([model.filePath isEqual:filePath]) {
+            [self.signatures removeObject:model];
+            [[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
+            break;
+        }
+    }
+    
+    if ([[NSFileManager defaultManager] fileExistsAtPath:Swift_oc_Tool.kDigitalSignaturePlistPath_OC]) {
+        [[NSFileManager defaultManager] removeItemAtPath:Swift_oc_Tool.kDigitalSignaturePlistPath_OC error:nil];
+        
+        for (KMDSignatureModel * model in self.signatures) {
+            NSString *tag = [DSignatureApperanceManager manager].tagString;
+            NSMutableDictionary *newDictionary = [NSMutableDictionary dictionary];
+            NSMutableDictionary * dic = [NSMutableDictionary dictionary];
+            [dic setValue:model.filePath forKey:Swift_oc_Tool.SAVEFILEPATH_KEY_OC];
+            if (model.password) {
+                [dic setValue:model.password forKey:Swift_oc_Tool.PASSWORD_KEY_OC];
+            }
+            
+            [newDictionary setObject:dic forKey:tag];
+            [newDictionary writeToFile:Swift_oc_Tool.kDigitalSignaturePlistPath_OC atomically:YES];
+        }
+    }
+    
+    return YES;
+}
+
+- (BOOL)importKeyChainWithP12FilePath:(NSString *)filePath passWord:(NSString *)passWord
+{
+    SecIdentityRef identity = nil;
+    NSData *PKCS12Data = [NSData dataWithContentsOfFile:filePath];
+    
+    CFDataRef inPKCS12Data = (__bridge CFDataRef)PKCS12Data;
+    CFStringRef password = (__bridge CFStringRef)passWord;
+    
+    const void *keys[] = { kSecImportExportPassphrase };
+    const void *values[] = { password };
+    CFDictionaryRef options = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL);
+    CFArrayRef items = CFArrayCreate(NULL, 0, 0, NULL);
+    OSStatus securityError = SecPKCS12Import(inPKCS12Data, options, &items);
+    CFRelease(options);
+    CFRelease(password);
+    if (securityError == errSecSuccess) {
+        CFDictionaryRef identityDict = CFArrayGetValueAtIndex(items, 0);
+        identity = (SecIdentityRef) CFDictionaryGetValue(identityDict, kSecImportItemIdentity);
+    } else {
+        NSLog(@"Error opening Certificate.");
+    }
+    if (identity) {
+        [self addSecIdentityRef:identity certPath:nil passWord:nil];
+        return YES;
+    } else {
+        return NO;
+    }
+}
+
++ (BOOL)exportKeyChainWithP12FilePath:(NSString *)filePath signatureModel:(KMDSignatureModel *)model passWord:(NSString *)passWord
+{
+    BOOL isSave = NO;
+    
+    SecIdentityRef identityRef = model.identityRef;
+    CFDataRef dataRef = NULL;
+    
+    SecItemImportExportKeyParameters params;
+    memset(&params, 0, sizeof(params));
+    
+    params.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION;
+    params.flags = 0;
+    params.passphrase = (__bridge CFTypeRef _Nullable)(passWord);
+    
+    params.alertTitle = NULL;
+    params.alertPrompt = NULL;
+    params.accessRef = NULL;
+    
+    OSStatus status = SecItemExport(identityRef, kSecFormatPKCS12, 0, &params, &dataRef);
+    if (status == errSecSuccess) {
+        isSave = [(__bridge NSData*)dataRef writeToFile:filePath atomically:YES];
+    }
+    
+    return isSave;
+}
+
+- (BOOL)moveP12DigitalFileWithFilePath:(NSString *)filePath password:(NSString *)password {
+    if (![[NSFileManager defaultManager] fileExistsAtPath:Swift_oc_Tool.kDigitalSignatureFolderPath_OC]) {
+        if (![[NSFileManager defaultManager] createDirectoryAtPath:Swift_oc_Tool.kDigitalSignatureFolderPath_OC withIntermediateDirectories:YES attributes:nil error:nil]) {
+            return NO;
+        }
+    }
+    
+    if (![[NSFileManager defaultManager] fileExistsAtPath:Swift_oc_Tool.kDigitalSignaturePlistPath_OC]) {
+        if (![[NSFileManager defaultManager] createFileAtPath:Swift_oc_Tool.kDigitalSignaturePlistPath_OC contents:nil attributes:nil]) {
+            return NO;
+        }
+    }
+    
+    NSString* toPath = [Swift_oc_Tool.kDigitalSignatureFolderPath_OC stringByAppendingPathComponent:filePath.lastPathComponent];
+    toPath = [self getUniqueFilePath:toPath];
+    BOOL isSuccess = [[NSFileManager defaultManager] copyItemAtPath:filePath toPath:toPath error:nil];
+    if (isSuccess) {
+        NSString *tag = [DSignatureApperanceManager manager].tagString;
+        NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:Swift_oc_Tool.kDigitalSignaturePlistPath_OC];
+        NSMutableDictionary *newDictionary = [NSMutableDictionary dictionaryWithDictionary:dictionary];
+        NSMutableDictionary * dic = [NSMutableDictionary dictionary];
+        [dic setValue:toPath forKey:Swift_oc_Tool.SAVEFILEPATH_KEY_OC];
+        if (password) {
+            [dic setValue:password forKey:Swift_oc_Tool.PASSWORD_KEY_OC];
+        }
+        
+        [newDictionary setObject:dic forKey:tag];
+        if ([newDictionary writeToFile:Swift_oc_Tool.kDigitalSignaturePlistPath_OC atomically:YES]) {
+            [self addSignatureCertPath:toPath passWord:password];
+            return YES;
+        }
+    }
+    return NO;
+}
+
+
++ (NSString *)stringFromDNwithSubjectName:(CFArrayRef)array
+{
+    NSMutableString * out = [[NSMutableString alloc] init];
+    const void *keys[] = { kSecOIDCommonName, kSecOIDOrganizationName,kSecOIDOrganizationalUnitName,kSecOIDEmailAddress, kSecOIDLocalityName, kSecOIDStateProvinceName, kSecOIDCountryName };
+    const void *labels[] = { "cn", "o", "ou", "email","l", "s", "c" };
+
+    for(int i = 0; i < sizeof(keys)/sizeof(keys[0]);  i++) {
+        for (CFIndex n = 0 ; n < CFArrayGetCount(array); n++) {
+            CFDictionaryRef dict = CFArrayGetValueAtIndex(array, n);
+            if (CFGetTypeID(dict) != CFDictionaryGetTypeID())
+                continue;
+            CFTypeRef dictkey = CFDictionaryGetValue(dict, kSecPropertyKeyLabel);
+            if (!CFEqual(dictkey, keys[i]))
+                continue;
+            CFStringRef str = (CFStringRef) CFDictionaryGetValue(dict, kSecPropertyKeyValue);
+            if (out.length< 1) {
+                [out appendFormat:@"%s=%@", labels[i], (__bridge NSString*)str];
+            } else {
+                [out appendFormat:@",%s=%@", labels[i], (__bridge NSString*)str];
+            }
+        }
+    }
+    return [NSString stringWithString:out];
+}
+
+@end

+ 716 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateCustomViewController.swift

@@ -0,0 +1,716 @@
+//
+//  CDSignatureCertificateCustomViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/12.
+//
+
+import Cocoa
+
+class CDSignatureCertificateCustomViewController: NSViewController, NSTextFieldDelegate {
+
+    
+    @IBOutlet weak var titleLabel: NSTextField!
+    
+    @IBOutlet weak var textButton: NSButton!
+    @IBOutlet weak var textLineBox: NSBox!
+    @IBOutlet weak var drawButton: NSButton!
+    @IBOutlet weak var drawLineBox: NSBox!
+    @IBOutlet weak var imageButton: NSButton!
+    @IBOutlet weak var imageLineBox: NSBox!
+    @IBOutlet weak var noneButton: NSButton!
+    @IBOutlet weak var noneLineBox: NSBox!
+    
+    @IBOutlet weak var drawBox: NSBox!
+    @IBOutlet weak var drawImageView: NSImageView!
+    
+    @IBOutlet weak var showDrawButton: NSButton!
+    @IBOutlet weak var clearButton: NSButton!
+    @IBOutlet weak var browseButton: NSButton!
+    
+    @IBOutlet weak var textLabel: NSTextField!
+    @IBOutlet weak var nameButton: NSButton!
+    @IBOutlet weak var dateButton: NSButton!
+    @IBOutlet weak var logoButton: NSButton!
+    @IBOutlet weak var reasonButton: NSButton!
+    @IBOutlet weak var distinguishedButton: NSButton!
+    @IBOutlet weak var versionButton: NSButton!
+    @IBOutlet weak var locationButton: NSButton!
+    @IBOutlet weak var labelsButton: NSButton!
+    @IBOutlet weak var directionLabel: NSTextField!
+    @IBOutlet weak var leftButton: NSButton!
+    @IBOutlet weak var rightButton: NSButton!
+    @IBOutlet weak var reasonLabel: NSTextField!
+    @IBOutlet weak var reasonPopUpButton: NSPopUpButton!
+    @IBOutlet weak var locationLabel: NSTextField!
+    @IBOutlet weak var locationTextField: NSTextField!
+    
+    @IBOutlet weak var nameLabel: NSTextField!
+    @IBOutlet weak var nameTextField: NSTextField!
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+     
+    @IBOutlet weak var locationTopOffset: NSLayoutConstraint!
+    
+    var _customType: CDSignatureCustomType = .none
+    var signatureWidget: CPDFSignatureWidgetAnnotation!
+    var appearanceData: DSignatureAppearanceData!
+    var cert: KMDSignatureModel!
+    var isCreat: Bool = false
+    
+    var photoImage: NSImage!
+    var drawImage: NSImage!
+    var drawText: String!
+    var drawViewController = CDSignatureDrawViewController.init()
+    var textViewController = CDSignatureTextViewController.init()
+
+    var actionBlock: ((_ customVC: CDSignatureCertificateCustomViewController, _ type: DSignatureActionType, _ appearanceData: DSignatureAppearanceData)->Void)?
+    
+    override func viewWillAppear() {
+        super.viewWillAppear()
+        
+        self.logoButton.state = .off;
+        self.labelsButton.state = .off
+        self.distinguishedButton.state = .off
+        self.nameButton.state = .off
+        self.reasonButton.state = .off
+        self.locationButton.state = .off
+        self.dateButton.state = .off
+        self.versionButton.state = .off
+        
+        self.reasonLabel.isHidden = true
+        self.reasonPopUpButton.isHidden = true
+        self.locationLabel.isHidden = true
+        self.locationTextField.isHidden = true
+        
+        self.locationTextField.delegate = self
+        
+        if (self.isCreat) {
+            self.nameTextField.stringValue = "";
+            self.appearanceData  = DSignatureApperanceManager.manager.standardDSignatureAppearanceData()
+            if self.cert.name.isEmpty == false {
+                self.appearanceData.signatureConfig.text = self.cert.name
+            }
+        } else {
+            if self.appearanceData.appearanceName.length > 0 {
+                self.nameTextField.stringValue = self.appearanceData.appearanceName as String
+            } else {
+                self.nameTextField.stringValue = ""
+            }
+        }
+        
+        if (self.appearanceData.signatureConfig.isDrawLogo) {
+            self.logoButton.state = .on;
+        }
+        
+        if (self.appearanceData.signatureConfig.isDrawKey) {
+            self.labelsButton.state = .on;
+        }
+        
+        let keys = NSMutableArray()
+        for item in self.appearanceData.signatureConfig.contents {
+            keys.add(item.key as String)
+        }
+        
+        if keys.contains(DN_KEY) {
+            self.distinguishedButton.state = .on
+        }
+        
+        if keys.contains(NAME_KEY) {
+            self.nameButton.state = .on
+        }
+        
+        if keys.contains(REASON_KEY) {
+            self.reasonButton.state = .on
+            self.reasonLabel.isHidden = false
+            self.reasonPopUpButton.isHidden = false
+        }
+        
+        if keys.contains(LOCATION_KEY) {
+            self.locationButton.state = .on
+            self.locationTextField.isHidden = false
+            self.locationLabel.isHidden = false
+            
+            if self.reasonButton.state == .on {
+                self.locationTopOffset.constant = 56;
+            } else {
+                self.locationTopOffset.constant = 12;
+            }
+            
+            var valueString = String()
+            
+            for item in self.appearanceData.signatureConfig.contents {
+                if item.key == LOCATION_KEY {
+                    valueString = item.value
+                    break
+                }
+            }
+            self.locationTextField.stringValue = valueString
+        }
+        
+        if keys.contains(DATE_KEY) {
+            self.dateButton.state = .on
+        }
+        
+        if keys.contains(VERSION_KEY) {
+            self.versionButton.state = .on
+        }
+        
+        
+        if (self.appearanceData.signatureConfig.isContentAlginLeft) {
+            self.leftButton.image = NSImage(named: "ImageNamePropertybarTextalignLeftNor")
+            self.rightButton.image = NSImage(named: "ImageNamePropertybarTextalignRightSel")
+        } else {
+            self.leftButton.image = NSImage(named: "ImageNamePropertybarTextalignLeftSel")
+            self.rightButton.image = NSImage(named: "ImageNamePropertybarTextalignRightNor");
+        }
+        
+        if (self.appearanceData.drawType == .image) {
+            self.photoImage = self.appearanceData.signatureConfig.image
+        } else if (self.appearanceData.drawType == .draw) {
+            self.drawImage = self.appearanceData.signatureConfig.image
+        } else if (self.appearanceData.drawType == .text) {
+            self.drawText = self.appearanceData.signatureConfig.text
+        }
+        self.customType = self.appearanceData.drawType
+        
+        self.reloadData()
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.localizedLanguage()
+        
+        self.reasonLabel.isHidden = true
+        self.reasonPopUpButton.isHidden = true
+        self.locationLabel.isHidden = true
+        self.locationTextField.isHidden = true
+        self.textLineBox.isHidden = true
+        self.imageLineBox.isHidden = true
+        self.drawLineBox.isHidden = true
+        self.noneLineBox.isHidden =  true
+        
+        self.textLineBox.fillColor = KMAppearance.Layout.mColor()
+        self.imageLineBox.fillColor = KMAppearance.Layout.mColor()
+        self.drawLineBox.fillColor = KMAppearance.Layout.mColor()
+        self.noneLineBox.fillColor = KMAppearance.Layout.mColor()
+            
+        self.titleLabel.textColor = NSColor.labelColor
+        self.nameLabel.textColor = NSColor.labelColor
+        self.drawBox.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1.0)
+        
+        self.reasonLabel.textColor = NSColor.labelColor
+        self.locationLabel.textColor = NSColor.labelColor
+        self.locationTextField.textColor = NSColor.labelColor
+        self.nameTextField.textColor = NSColor.labelColor
+        
+        self.leftButton.wantsLayer = true
+        self.rightButton.wantsLayer = true
+        self.leftButton.layer?.cornerRadius = 5.0
+        self.rightButton.layer?.cornerRadius = 5.0
+        
+        self.locationTextField.delegate = self;
+        
+        self.textViewController.actionBlock = { textVC, inputText in
+            if inputText.count > 0 {
+                self.drawText = inputText
+            } else {
+                self.drawText = ""
+            }
+            self.appearanceData.isInputDSignatureText = true
+            self.appearanceData.signatureConfig.text = self.drawText
+            self.reloadData()
+        }
+        
+        self.drawViewController.actionBlock = { drawVC, image in
+            if image.size.width > 0 &&
+                image.size.height > 0 {
+                self.drawImage = image
+                self.appearanceData.signatureConfig.image = image
+            }
+            self.reloadData()
+        }
+    }
+    
+    //MARK: Setter
+    var customType: CDSignatureCustomType {
+        set {
+            _customType = newValue;
+            
+            let norColor = KMAppearance.Layout.h1Color()
+            let selColor = KMAppearance.Layout.mColor()
+            
+            self.appearanceData.drawType = _customType
+            self.appearanceData.signatureConfig.isDrawOnlyContent = false
+            
+            self.textLineBox.isHidden = true
+            self.imageLineBox.isHidden = true
+            self.noneLineBox.isHidden = true
+            self.drawLineBox.isHidden = true
+            
+            self.textButton.setTitleColor(norColor)
+            self.drawButton.setTitleColor(norColor)
+            self.imageButton.setTitleColor(norColor)
+            self.noneButton.setTitleColor(norColor)
+            
+            if self.customType == .draw {
+                self.drawLineBox.isHidden = false
+                self.drawButton.setTitleColor(selColor)
+                
+                self.textButton.image = NSImage(named: "ImageNameDSignatureCustomText")
+                self.drawButton.image = NSImage(named: "ImageNameDSignatureCustomSignSelect")
+                self.imageButton.image = NSImage(named: "ImageNameDSignatureCustomImage")
+                self.noneButton.image = NSImage(named: "ImageNameDSignatureCustomNone")
+                
+                self.showDrawButton.isHidden = false
+                self.browseButton.isHidden = true
+                self.clearButton.isHidden = true
+                self.appearanceData.signatureConfig.text = nil;
+                self.appearanceData.signatureConfig.image = self.drawImage;
+                
+            } else if self.customType == .image {
+                self.imageLineBox.isHidden = false;
+                self.imageButton.setTitleColor(selColor)
+                
+                self.textButton.image = NSImage(named: "ImageNameDSignatureCustomText")
+                self.drawButton.image = NSImage(named: "ImageNameDSignatureCustomSign")
+                self.imageButton.image = NSImage(named: "ImageNameDSignatureCustomImageSelect")
+                self.noneButton.image = NSImage(named: "ImageNameDSignatureCustomNone")
+                
+                self.showDrawButton.isHidden = true
+                self.browseButton.isHidden = false
+                self.clearButton.isHidden = false
+                self.appearanceData.signatureConfig.text = nil
+                self.appearanceData.signatureConfig.image = self.photoImage
+            } else if self.customType == .none {
+                self.noneLineBox.isHidden = false
+                self.noneButton.setTitleColor(selColor)
+                
+                self.textButton.image = NSImage(named: "ImageNameDSignatureCustomText")
+                self.drawButton.image = NSImage(named: "ImageNameDSignatureCustomSign")
+                self.imageButton.image = NSImage(named: "ImageNameDSignatureCustomImage")
+                self.noneButton.image = NSImage(named: "ImageNameDSignatureCustomNoneSelect")
+                
+                self.showDrawButton.isHidden = true;
+                self.browseButton.isHidden = true;
+                self.clearButton.isHidden = true;
+                self.appearanceData.signatureConfig.text = nil;
+                self.appearanceData.signatureConfig.image = nil;
+                self.appearanceData.signatureConfig.isDrawOnlyContent = true;
+            } else if self.customType == .text {
+                self.textLineBox.isHidden = false
+                self.textButton.setTitleColor(selColor)
+                
+                self.textButton.image = NSImage(named: "ImageNameDSignatureCustomTextSelect")
+                self.drawButton.image = NSImage(named: "ImageNameDSignatureCustomSign")
+                self.imageButton.image = NSImage(named: "ImageNameDSignatureCustomImage")
+                self.noneButton.image = NSImage(named: "ImageNameDSignatureCustomNone")
+                
+                self.showDrawButton.isHidden = true;
+                self.browseButton.isHidden = true;
+                self.clearButton.isHidden = true;
+                self.appearanceData.signatureConfig.image = nil;
+                self.appearanceData.signatureConfig.text = self.drawText
+            }
+            self.reloadData()
+        }
+        
+        get {
+            return _customType;
+        }
+    }
+    
+    //MARK: Method
+    func localizedLanguage() {
+        
+        self.titleLabel.stringValue = NSLocalizedString("Customize the Signature Appearance", comment: "")
+        self.nameLabel.stringValue = NSLocalizedString("Preset Name", comment: "") + ":"
+        
+        self.textButton.title = NSLocalizedString("Text", comment: "");
+        self.imageButton.title = NSLocalizedString("Image", comment: "");
+        self.drawButton.title = NSLocalizedString("Draw", comment: "");
+        self.noneButton.title = NSLocalizedString("None", comment: "");
+        
+        self.browseButton.title = NSLocalizedString("Browse", comment: "");
+        self.clearButton.title = NSLocalizedString("Clear", comment: "");
+        self.showDrawButton.title = NSLocalizedString("Click here to draw", comment: "");
+        
+        let txtColor = KMAppearance.Interactive.a0Color()
+        self.browseButton.setTitleColor(txtColor)
+        self.clearButton.setTitleColor(txtColor)
+        self.showDrawButton.setTitleColor(txtColor)
+
+        self.continueButton.title = NSLocalizedString("Continue", comment: "");
+        self.cancelButton.title = NSLocalizedString("Cancel", comment: "");
+        
+        self.textLabel.stringValue = NSLocalizedString("Include Text", comment: "");
+        self.directionLabel.stringValue = String(format: "%@:",NSLocalizedString("Text Alignment", comment: ""));
+            
+        self.nameButton.title = NSLocalizedString("Name", comment: "");
+        self.dateButton.title = NSLocalizedString("Date", comment: "");
+        self.locationButton.title = NSLocalizedString("Location", comment: "");
+        self.reasonButton.title = NSLocalizedString("Reason", comment: "");
+        self.distinguishedButton.title = NSLocalizedString("Distinguished Name", comment: "");
+        self.versionButton.title = VERSION_KEY
+        self.logoButton.title = NSLocalizedString("Logo", comment: "");
+        self.labelsButton.title = NSLocalizedString("Include Text", comment: "");
+        
+        self.locationLabel.stringValue = String(format:"%@:",NSLocalizedString("Location", comment: ""));
+        self.reasonLabel.stringValue = String(format:"%@:",NSLocalizedString("Reason", comment: ""));
+        
+        let titles = [String(format:"  %@",NSLocalizedString("none", comment: "")),
+                      String(format:"  %@",NSLocalizedString("I am the author of this document", comment: "")),
+                      String(format:"  %@",NSLocalizedString("I have reviewed this document", comment: "")),
+                      String(format:"  %@",NSLocalizedString("I'm in the process of approving this document", comment: "")),
+                      String(format:"  %@",NSLocalizedString("I certify the accuracy and authenticity of this document", comment: "")),
+                      String(format:"  %@",NSLocalizedString("I have signed this document to indicate that I agree to the terms defined", comment: "")),
+                      String(format:"  %@",NSLocalizedString("I agree with the specified portions of this document", comment: ""))]
+        self.reasonPopUpButton.addItems(withTitles: titles)
+        
+    }
+    
+    func reloadData() {
+        for item in self.appearanceData.signatureConfig.contents {
+            if item.key == DATE_KEY {
+                let dateFormatter = DateFormatter.init()
+                dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+                let dateString = dateFormatter.string(from: NSDate() as Date)
+                item.value = dateString
+                break
+            }
+        }
+        self.signatureWidget.signAppearanceConfig(self.appearanceData.signatureConfig)
+        
+        let image: NSImage = self.signatureWidget.contentImage()
+        self.drawImageView.image = image
+    }
+    
+    //MARK: IBAction
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, DSignatureAppearanceData())
+    }
+    
+    @IBAction func buttonItemClick_CustomType(_ sender: NSButton) {
+        self.customType = CDSignatureCustomType(rawValue: sender.tag) ?? .none;
+        if (self.customType == .text) {
+//            self.textViewController.drawText = self.drawText
+//            self.presentAsSheet(self.textViewController)
+        } else if self.customType == .draw {
+            self.buttonItemClick_ShowDraw(self.drawButton)
+        }
+    }
+    
+    @IBAction func buttonItemClick_ShowDraw(_ sender: NSButton) {
+        self.drawViewController.drawImage = self.drawImage;
+        self.presentAsSheet(self.drawViewController)
+    }
+    
+    @IBAction func buttonItemClick_Clear(_ sender: Any) {
+        self.photoImage = nil
+        self.appearanceData.signatureConfig.image = nil
+        self.reloadData()
+        
+    }
+    
+    @IBAction func buttonItemClick_Browse(_ sender: Any) {
+        
+        let openPanel = NSOpenPanel()
+        openPanel.canChooseDirectories = true
+        openPanel.canChooseFiles = true
+        openPanel.allowsMultipleSelection = false;
+        openPanel.allowedFileTypes = KMPDFSignatureImageView().supportedImageTypes()
+        openPanel.beginSheetModal(for: self.view.window!) { result in
+            if result == .OK {
+                let fileURL = openPanel.urls.first
+                self.appearanceData.signatureConfig.text = ""
+                self.photoImage = NSImage(contentsOf: fileURL!)
+                self.appearanceData.signatureConfig.image = self.photoImage
+                self.reloadData()   
+            }
+        }
+    }
+    
+    @IBAction func buttonItemClick_ShowText(_ sender: Any) {
+        let contents = NSMutableArray(array: self.appearanceData.signatureConfig.contents)
+        if contents.count <= 1 && self.customType == .none {
+            let configItem: CPDFSignatureConfigItem = contents.firstObject as! CPDFSignatureConfigItem
+            if configItem.key == NAME_KEY && self.appearanceData.signatureConfig.isDrawKey {
+                if self.nameButton.state == .off {
+                    contents.removeAllObjects()
+                }
+                if self.labelsButton.state == .off {
+                    self.appearanceData.signatureConfig.isDrawKey = false
+                }
+            }
+        }
+        
+        var configItem: CPDFSignatureConfigItem!
+        
+        if self.nameButton.isEqual(sender) {
+            if self.nameButton.state == .on {
+                configItem = CPDFSignatureConfigItem.init()
+                configItem.key = NAME_KEY
+                configItem.value = NSLocalizedString("<your common name here>", comment: "")
+                contents.add(configItem as Any)
+            } else {
+                for item in contents {
+                    let exitItem: CPDFSignatureConfigItem = item as! CPDFSignatureConfigItem
+                    if exitItem.key == NAME_KEY {
+                        configItem = item as? CPDFSignatureConfigItem
+                        break
+                    }
+                }
+                if configItem != nil {
+                    contents.remove(configItem as Any)
+                }
+            }
+        } else if self.dateButton.isEqual(sender) {
+            if self.dateButton.state == .on {
+                configItem = CPDFSignatureConfigItem.init()
+                configItem.key = DATE_KEY
+                let dateFormatter = DateFormatter.init()
+                dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+                configItem.value = dateFormatter.string(from: NSDate() as Date)
+                contents.add(configItem as Any)
+            } else {
+                for item in contents {
+                    let exitItem: CPDFSignatureConfigItem = item as! CPDFSignatureConfigItem
+                    if exitItem.key == DATE_KEY {
+                        configItem = item as? CPDFSignatureConfigItem
+                        break
+                    }
+                }
+                if configItem != nil {
+                    contents.remove(configItem as Any)
+                }
+            }
+        } else if self.reasonButton.isEqual(sender) {
+            if (self.reasonButton.state == .on) {
+                self.locationTopOffset.constant = 56.0;
+            } else {
+                self.locationTopOffset.constant = 12.0;
+            }
+            if self.reasonButton.state == .on {
+                self.reasonPopUpButton.isHidden = false
+                self.reasonLabel.isHidden = false
+                self.reasonPopUpButton.selectItem(at: 0)
+                configItem = CPDFSignatureConfigItem.init()
+                configItem.key = REASON_KEY
+                configItem.value = self.reasonPopUpButton.title
+                if configItem.value == "" ||
+                    configItem.value == String(format: "  %@", NSLocalizedString("none", comment: "")) {
+                    configItem.value = NSLocalizedString("<your signing reason here>", comment: "")
+                }
+                contents.add(configItem as Any)
+            } else {
+                self.reasonPopUpButton.isHidden = true
+                self.reasonLabel.isHidden = true
+                
+                for item in contents {
+                    let exitItem: CPDFSignatureConfigItem = item as! CPDFSignatureConfigItem
+                    if exitItem.key == REASON_KEY {
+                        configItem = item as? CPDFSignatureConfigItem
+                        break
+                    }
+                }
+                if configItem != nil {
+                    contents.remove(configItem as Any)
+                }
+            }
+        } else if self.locationButton.isEqual(sender) {
+            if self.locationButton.state == .on {
+                self.locationLabel.isHidden = false
+                self.locationTextField.isHidden = false
+                if (self.reasonButton.state == .on) {
+                    self.locationTopOffset.constant = 56.0;
+                } else {
+                    self.locationTopOffset.constant = 12.0;
+                }
+                
+                configItem = CPDFSignatureConfigItem.init()
+                configItem.key = LOCATION_KEY
+                if self.locationTextField.stringValue.isEmpty {
+                    configItem.value = NSLocalizedString("<your signing location here>", comment: "")
+                } else {
+                    configItem.value = self.locationTextField.stringValue
+                }
+                contents.add(configItem as Any)
+            } else {
+                self.locationLabel.isHidden = true
+                self.locationTextField.isHidden = true
+                
+                for item in contents {
+                    let exitItem: CPDFSignatureConfigItem = item as! CPDFSignatureConfigItem
+                    if exitItem.key == LOCATION_KEY {
+                        configItem = item as? CPDFSignatureConfigItem
+                        break
+                    }
+                }
+                if configItem != nil {
+                    contents.remove(configItem as Any)
+                }
+            }
+        } else if self.distinguishedButton.isEqual(sender) {
+            if self.distinguishedButton.state == .on {
+                configItem = CPDFSignatureConfigItem.init()
+                configItem.key = DN_KEY
+                configItem.value = NSLocalizedString("<your distinguished name here>", comment: "")
+                contents.add(configItem as Any)
+            } else {
+                for item in contents {
+                    let exitItem: CPDFSignatureConfigItem = item as! CPDFSignatureConfigItem
+                    if exitItem.key == DN_KEY {
+                        configItem = item as? CPDFSignatureConfigItem
+                        break
+                    }
+                }
+                if configItem != nil {
+                    contents.remove(configItem as Any)
+                }
+            }
+        } else if self.versionButton.isEqual(sender) {
+            if self.versionButton.state == .on {
+                configItem = CPDFSignatureConfigItem.init()
+                configItem.key = VERSION_KEY
+                let infoDictionary = Bundle.main.infoDictionary!
+//                CFShow(infoDictionary)
+                let app_Version = infoDictionary["CFBundleShortVersionString"]
+                configItem.value = app_Version as? String
+                contents.add(configItem as Any)
+            } else {
+                for item in contents {
+                    let exitItem: CPDFSignatureConfigItem = item as! CPDFSignatureConfigItem
+                    if exitItem.key == VERSION_KEY {
+                        configItem = item as? CPDFSignatureConfigItem
+                        break
+                    }
+                }
+                if configItem != nil {
+                    contents.remove(configItem as Any)
+                }
+            }
+        } else if self.logoButton.isEqual(sender) {
+            if self.logoButton.state == .on {
+                self.appearanceData.signatureConfig.isDrawLogo = true
+            } else {
+                self.appearanceData.signatureConfig.isDrawLogo = false
+            }
+        }else if self.labelsButton.isEqual(sender) {
+            if self.labelsButton.state == .on {
+                self.appearanceData.signatureConfig.isDrawKey = true
+            } else {
+                self.appearanceData.signatureConfig.isDrawKey = false
+            }
+        }
+        
+        if self.customType == .none && contents.count == 0 {
+            configItem = CPDFSignatureConfigItem.init()
+            configItem.key = NAME_KEY
+            configItem.value = NSLocalizedString("<your common name here>", comment: "")
+            contents.add(configItem as Any)
+            
+            self.appearanceData.signatureConfig.isDrawKey = true
+        }
+        let sortContents:[Any] = KMDSignatureManager.default().sortContens((contents as! [Any]))
+        self.appearanceData.signatureConfig.contents = (sortContents as! [CPDFSignatureConfigItem])
+        
+        self.reloadData()
+        
+    }
+    
+    @IBAction func buttonItemClick_Algin(_ sender: NSButton) {
+        if (sender.tag == 0) {
+            self.appearanceData.signatureConfig.isContentAlginLeft = false;
+            self.leftButton.image = NSImage(named: "ImageNamePropertybarTextalignLeftSel")
+            self.rightButton.image = NSImage(named: "ImageNamePropertybarTextalignRightNor")
+        } else {
+            self.appearanceData.signatureConfig.isContentAlginLeft = true;
+            self.leftButton.image = NSImage(named: "ImageNamePropertybarTextalignLeftNor")
+            self.rightButton.image = NSImage(named: "ImageNamePropertybarTextalignRightSel")
+        }
+        self.reloadData()
+    }
+    
+    @IBAction func buttonItemClick_Reason(_ sender: Any) {
+        let contents:[CPDFSignatureConfigItem] = self.appearanceData.signatureConfig.contents
+        for object in contents {
+            if object.key == REASON_KEY {
+                if self.reasonPopUpButton.title.count > 2 {
+                    let fromStr = self.reasonPopUpButton.title.dropFirst(2)
+                    if self.reasonPopUpButton.title == String(format: "  %@", NSLocalizedString("none", comment: "")) {
+                        object.value = NSLocalizedString("<your signing reason here>", comment: "")
+                    } else {
+                        object.value = String(fromStr)
+                    }
+                }
+                break
+            }
+        }
+        self.reloadData()
+    }
+    
+    @IBAction func buttonItemClick_Cancel(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, DSignatureAppearanceData())
+    }
+    
+    @IBAction func buttonItemClick_Continue(_ sender: Any) {
+        let name = self.nameTextField.stringValue
+        if (self.isCreat) {
+            let at: [DSignatureAppearanceData] = DSignatureApperanceManager.manager.signatures as! [DSignatureAppearanceData]
+            var names = NSMutableArray()
+            for data in at {
+                names.add(data.appearanceName as Any)
+            }
+            if names.contains(name) {
+                let alert = NSAlert.init()
+                alert.messageText = NSLocalizedString("The name already exists, please enter it again!", comment: "")
+                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                alert.runModal()
+                return
+            }
+            self.appearanceData.tag = DSignatureApperanceManager.manager.tagString()
+        }
+        if name.count > 0 {
+            self.appearanceData.appearanceName = self.nameTextField.stringValue as NSString
+        } else {
+            self.appearanceData.appearanceName = DSignatureApperanceManager.manager.tagString()
+        }
+        
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .confirm, self.appearanceData)
+    }
+    
+    //MARK: NSTextFieldDelegate
+    func controlTextDidChange(_ obj: Notification) {
+        if obj.object == nil {
+            return
+        }
+        let textField = obj.object as! NSTextField
+        if self.locationTextField.isEqual(textField) {
+            let contents = self.appearanceData.signatureConfig.contents!
+            
+            for object in contents {
+                if object.key == LOCATION_KEY {
+                    if self.locationTextField.stringValue.isEmpty == true {
+                        object.value = NSLocalizedString("<your signing location here>", comment: "")
+                    } else {
+                        object.value = self.locationTextField.stringValue
+                    }
+                    break
+                }
+            }
+            self.reloadData()
+        }
+    }
+    
+}

+ 644 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateCustomViewController.xib

@@ -0,0 +1,644 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="CDSignatureCertificateCustomViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="browseButton" destination="Mlp-WB-DNU" id="O3u-FY-Ha2"/>
+                <outlet property="cancelButton" destination="O3E-wc-nBV" id="Ghg-bD-Dlr"/>
+                <outlet property="clearButton" destination="Ttc-sm-ptR" id="dng-e0-TuQ"/>
+                <outlet property="continueButton" destination="BBs-HJ-bNW" id="ZOf-px-XWU"/>
+                <outlet property="dateButton" destination="OSW-eR-z6D" id="8jV-BT-3rX"/>
+                <outlet property="directionLabel" destination="sob-mk-zDt" id="ddk-Cq-5Xk"/>
+                <outlet property="distinguishedButton" destination="eqg-Sq-ccJ" id="NXB-yM-R4W"/>
+                <outlet property="drawBox" destination="P95-Eo-jBE" id="YsD-0z-vb6"/>
+                <outlet property="drawButton" destination="aNE-0i-V0w" id="19I-hA-1zH"/>
+                <outlet property="drawImageView" destination="QRf-k3-H9l" id="dIN-cB-obv"/>
+                <outlet property="drawLineBox" destination="2Fo-V0-iJe" id="Kxt-m7-0mE"/>
+                <outlet property="imageButton" destination="gOc-Nd-ctz" id="0z1-0a-BTT"/>
+                <outlet property="imageLineBox" destination="14W-Va-E0F" id="G79-zM-hG7"/>
+                <outlet property="labelsButton" destination="324-d7-5V3" id="PiS-7s-fur"/>
+                <outlet property="leftButton" destination="35Z-n6-vB2" id="xRX-oa-r54"/>
+                <outlet property="locationButton" destination="fCG-74-01y" id="ggh-Zv-Rsh"/>
+                <outlet property="locationLabel" destination="ixk-CF-vNn" id="UgX-cM-9eB"/>
+                <outlet property="locationTextField" destination="WW1-ij-wXG" id="VXV-qU-fyt"/>
+                <outlet property="locationTopOffset" destination="YdI-rw-sP6" id="0HR-8M-jPI"/>
+                <outlet property="logoButton" destination="TMC-tW-mNf" id="Rd0-Nu-of6"/>
+                <outlet property="nameButton" destination="7ES-DS-PJP" id="bG4-Od-OoX"/>
+                <outlet property="nameLabel" destination="aH6-Rq-CWw" id="bcI-vR-LdB"/>
+                <outlet property="nameTextField" destination="ibO-c4-B3S" id="Wnj-fF-VMb"/>
+                <outlet property="noneButton" destination="Syv-13-vje" id="PTe-i7-Pdy"/>
+                <outlet property="noneLineBox" destination="V1i-US-cwo" id="xTa-HU-Rnp"/>
+                <outlet property="reasonButton" destination="toP-5L-9Zb" id="H3j-Pi-vs7"/>
+                <outlet property="reasonLabel" destination="4Te-9i-EPG" id="wEv-5c-B0A"/>
+                <outlet property="reasonPopUpButton" destination="dRt-2N-VM6" id="7l5-6R-1Ai"/>
+                <outlet property="rightButton" destination="MqX-jx-dzq" id="Lvg-pt-JSZ"/>
+                <outlet property="showDrawButton" destination="I92-83-FIM" id="aML-BL-a6d"/>
+                <outlet property="textButton" destination="ht7-RQ-lgZ" id="HYI-Ub-0Zh"/>
+                <outlet property="textLabel" destination="2dT-1G-B3y" id="Epe-PE-LZi"/>
+                <outlet property="textLineBox" destination="J0E-yI-anY" id="ybW-2h-2d2"/>
+                <outlet property="titleLabel" destination="k1a-6l-aIe" id="I1f-9h-bnj"/>
+                <outlet property="versionButton" destination="zj6-rR-itk" id="mhp-ne-C6F"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="619" height="528"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="nkd-bq-Ju3">
+                    <rect key="frame" x="0.0" y="0.0" width="619" height="528"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="k1a-6l-aIe">
+                            <rect key="frame" x="18" y="485" width="318" height="19"/>
+                            <textFieldCell key="cell" title="select the destination of the new Digital ID" id="fO5-2P-ue6">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="Rxw-SY-oZ6">
+                            <rect key="frame" x="583" y="487" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="FFf-Vn-4h5">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="5Jd-HR-v6Z"/>
+                            </connections>
+                        </button>
+                        <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ZW2-cR-TiA">
+                            <rect key="frame" x="183" y="427" width="253" height="42"/>
+                            <view key="contentView" id="2rL-Lg-eG9">
+                                <rect key="frame" x="0.0" y="0.0" width="253" height="42"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="RZG-Mp-ebL">
+                                        <rect key="frame" x="20" y="5" width="32" height="37"/>
+                                        <view key="contentView" id="Fqa-2e-lxO">
+                                            <rect key="frame" x="0.0" y="0.0" width="32" height="37"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ht7-RQ-lgZ">
+                                                    <rect key="frame" x="0.0" y="0.0" width="32" height="37"/>
+                                                    <buttonCell key="cell" type="bevel" title="Text" bezelStyle="regularSquare" image="ImageNameDSignatureCustomText" imagePosition="above" alignment="center" alternateImage="ImageNameDSignatureCustomTextSelect" inset="2" id="C5I-fz-Hot">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system" size="14"/>
+                                                    </buttonCell>
+                                                    <connections>
+                                                        <action selector="buttonItemClick_CustomType:" target="-2" id="n16-Xe-1rD"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="bottom" secondItem="ht7-RQ-lgZ" secondAttribute="bottom" id="1O8-ij-d7A"/>
+                                                <constraint firstItem="ht7-RQ-lgZ" firstAttribute="leading" secondItem="Fqa-2e-lxO" secondAttribute="leading" id="DJh-Df-oBQ"/>
+                                                <constraint firstItem="ht7-RQ-lgZ" firstAttribute="top" secondItem="Fqa-2e-lxO" secondAttribute="top" id="OfX-Sz-yoH"/>
+                                                <constraint firstAttribute="trailing" secondItem="ht7-RQ-lgZ" secondAttribute="trailing" id="WT6-co-sOV"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="J0E-yI-anY">
+                                        <rect key="frame" x="12" y="0.0" width="48" height="2"/>
+                                        <view key="contentView" id="cCS-wz-Tjx">
+                                            <rect key="frame" x="0.0" y="0.0" width="48" height="2"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="2" id="bZs-ij-zfc"/>
+                                        </constraints>
+                                        <color key="fillColor" red="0.80731823979999995" green="0.0" blue="0.0" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="rFh-MO-HRB">
+                                        <rect key="frame" x="72" y="5" width="38" height="37"/>
+                                        <view key="contentView" id="ILc-G5-afV">
+                                            <rect key="frame" x="0.0" y="0.0" width="38" height="37"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aNE-0i-V0w">
+                                                    <rect key="frame" x="0.0" y="0.0" width="38" height="37"/>
+                                                    <buttonCell key="cell" type="bevel" title="Draw" bezelStyle="regularSquare" image="ImageNameDSignatureCustomSign" imagePosition="above" alignment="center" alternateImage="ImageNameDSignatureCustomSignSelect" inset="2" id="1Sg-oC-3cA">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system" size="14"/>
+                                                    </buttonCell>
+                                                    <connections>
+                                                        <action selector="buttonItemClick_CustomType:" target="-2" id="IZV-cX-j7J"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="aNE-0i-V0w" firstAttribute="top" secondItem="ILc-G5-afV" secondAttribute="top" id="By8-up-km7"/>
+                                                <constraint firstAttribute="trailing" secondItem="aNE-0i-V0w" secondAttribute="trailing" id="J0U-co-aqm"/>
+                                                <constraint firstAttribute="bottom" secondItem="aNE-0i-V0w" secondAttribute="bottom" id="Shy-iH-BOx"/>
+                                                <constraint firstItem="aNE-0i-V0w" firstAttribute="leading" secondItem="ILc-G5-afV" secondAttribute="leading" id="xuY-sb-kWl"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="2Fo-V0-iJe">
+                                        <rect key="frame" x="64" y="0.0" width="54" height="2"/>
+                                        <view key="contentView" id="7VT-X2-FJ0">
+                                            <rect key="frame" x="0.0" y="0.0" width="54" height="2"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="2" id="PVx-Wh-Ye6"/>
+                                        </constraints>
+                                        <color key="fillColor" red="0.80731823979999995" green="0.0" blue="0.0" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Huj-Ag-41W">
+                                        <rect key="frame" x="130" y="5" width="44" height="37"/>
+                                        <view key="contentView" id="5ZM-n6-smv">
+                                            <rect key="frame" x="0.0" y="0.0" width="44" height="37"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gOc-Nd-ctz">
+                                                    <rect key="frame" x="0.0" y="0.0" width="44" height="37"/>
+                                                    <buttonCell key="cell" type="bevel" title="Image" bezelStyle="regularSquare" image="ImageNameDSignatureCustomImage" imagePosition="above" alignment="center" alternateImage="ImageNameDSignatureCustomImageSelect" inset="2" id="SX8-do-Kbe">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system" size="14"/>
+                                                    </buttonCell>
+                                                    <connections>
+                                                        <action selector="buttonItemClick_CustomType:" target="-2" id="FIi-Yg-laW"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="trailing" secondItem="gOc-Nd-ctz" secondAttribute="trailing" id="F3Q-cp-CF3"/>
+                                                <constraint firstItem="gOc-Nd-ctz" firstAttribute="top" secondItem="5ZM-n6-smv" secondAttribute="top" id="FZZ-p0-ftK"/>
+                                                <constraint firstItem="gOc-Nd-ctz" firstAttribute="leading" secondItem="5ZM-n6-smv" secondAttribute="leading" id="Moy-RZ-SXi"/>
+                                                <constraint firstAttribute="bottom" secondItem="gOc-Nd-ctz" secondAttribute="bottom" id="w8g-aw-YTg"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="14W-Va-E0F">
+                                        <rect key="frame" x="122" y="0.0" width="60" height="2"/>
+                                        <view key="contentView" id="aTj-XF-cXH">
+                                            <rect key="frame" x="0.0" y="0.0" width="60" height="2"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="2" id="X14-qr-c5T"/>
+                                        </constraints>
+                                        <color key="fillColor" red="0.80731823979999995" green="0.0" blue="0.0" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="41n-ub-JSS">
+                                        <rect key="frame" x="194" y="5" width="39" height="37"/>
+                                        <view key="contentView" id="4sc-Vx-eCz">
+                                            <rect key="frame" x="0.0" y="0.0" width="39" height="37"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Syv-13-vje">
+                                                    <rect key="frame" x="0.0" y="0.0" width="39" height="37"/>
+                                                    <buttonCell key="cell" type="bevel" title="None" bezelStyle="regularSquare" image="ImageNameDSignatureCustomNone" imagePosition="above" alignment="center" alternateImage="ImageNameDSignatureCustomNoneSelect" inset="2" id="eCr-OG-vwm">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system" size="14"/>
+                                                    </buttonCell>
+                                                    <connections>
+                                                        <action selector="buttonItemClick_CustomType:" target="-2" id="9TB-p9-U71"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="bottom" secondItem="Syv-13-vje" secondAttribute="bottom" id="aS3-Qc-v8r"/>
+                                                <constraint firstItem="Syv-13-vje" firstAttribute="leading" secondItem="4sc-Vx-eCz" secondAttribute="leading" id="sg3-hW-oX4"/>
+                                                <constraint firstAttribute="trailing" secondItem="Syv-13-vje" secondAttribute="trailing" id="xKZ-Y8-aP9"/>
+                                                <constraint firstItem="Syv-13-vje" firstAttribute="top" secondItem="4sc-Vx-eCz" secondAttribute="top" id="yfm-2A-4ES"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="V1i-US-cwo">
+                                        <rect key="frame" x="186" y="0.0" width="55" height="2"/>
+                                        <view key="contentView" id="dVA-KM-egx">
+                                            <rect key="frame" x="0.0" y="0.0" width="55" height="2"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="2" id="P3q-ba-pO5"/>
+                                        </constraints>
+                                        <color key="fillColor" red="0.80731823979999995" green="0.0" blue="0.0" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
+                                    </box>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="RZG-Mp-ebL" firstAttribute="top" secondItem="2rL-Lg-eG9" secondAttribute="top" id="0XM-TT-k9Y"/>
+                                    <constraint firstAttribute="bottom" secondItem="J0E-yI-anY" secondAttribute="bottom" id="27f-cG-rGp"/>
+                                    <constraint firstAttribute="trailing" secondItem="41n-ub-JSS" secondAttribute="trailing" constant="20" id="7xZ-mT-TyI"/>
+                                    <constraint firstItem="Huj-Ag-41W" firstAttribute="leading" secondItem="rFh-MO-HRB" secondAttribute="trailing" constant="20" id="8o1-ia-3uJ"/>
+                                    <constraint firstItem="Huj-Ag-41W" firstAttribute="top" secondItem="2rL-Lg-eG9" secondAttribute="top" id="MVY-PQ-DAE"/>
+                                    <constraint firstItem="rFh-MO-HRB" firstAttribute="leading" secondItem="RZG-Mp-ebL" secondAttribute="trailing" constant="20" id="XSI-T0-7FO"/>
+                                    <constraint firstAttribute="bottom" secondItem="2Fo-V0-iJe" secondAttribute="bottom" id="Xvz-Rl-hpd"/>
+                                    <constraint firstItem="rFh-MO-HRB" firstAttribute="top" secondItem="2rL-Lg-eG9" secondAttribute="top" id="YPm-Wv-OfA"/>
+                                    <constraint firstAttribute="bottom" secondItem="V1i-US-cwo" secondAttribute="bottom" id="Yha-W0-nqu"/>
+                                    <constraint firstAttribute="bottom" secondItem="RZG-Mp-ebL" secondAttribute="bottom" constant="5" id="ZVV-7E-TYa"/>
+                                    <constraint firstItem="RZG-Mp-ebL" firstAttribute="leading" secondItem="2rL-Lg-eG9" secondAttribute="leading" constant="20" id="ZwC-4e-tXN"/>
+                                    <constraint firstItem="41n-ub-JSS" firstAttribute="leading" secondItem="Huj-Ag-41W" secondAttribute="trailing" constant="20" id="aF2-P7-gWI"/>
+                                    <constraint firstItem="Huj-Ag-41W" firstAttribute="leading" secondItem="14W-Va-E0F" secondAttribute="leading" constant="8" id="bZv-nK-1QA"/>
+                                    <constraint firstItem="J0E-yI-anY" firstAttribute="leading" secondItem="RZG-Mp-ebL" secondAttribute="leading" constant="-8" id="cpT-1c-2vU"/>
+                                    <constraint firstItem="41n-ub-JSS" firstAttribute="leading" secondItem="V1i-US-cwo" secondAttribute="leading" constant="8" id="h2L-UQ-rsf"/>
+                                    <constraint firstItem="41n-ub-JSS" firstAttribute="top" secondItem="2rL-Lg-eG9" secondAttribute="top" id="h5b-cB-VD0"/>
+                                    <constraint firstAttribute="bottom" secondItem="14W-Va-E0F" secondAttribute="bottom" id="i1D-m7-450"/>
+                                    <constraint firstItem="2Fo-V0-iJe" firstAttribute="leading" secondItem="rFh-MO-HRB" secondAttribute="leading" constant="-8" id="lO8-h8-sgd"/>
+                                    <constraint firstItem="41n-ub-JSS" firstAttribute="trailing" secondItem="V1i-US-cwo" secondAttribute="trailing" constant="-8" id="nKX-PU-xPA"/>
+                                    <constraint firstItem="2Fo-V0-iJe" firstAttribute="trailing" secondItem="rFh-MO-HRB" secondAttribute="trailing" constant="8" id="nOV-lt-eHh"/>
+                                    <constraint firstItem="J0E-yI-anY" firstAttribute="trailing" secondItem="RZG-Mp-ebL" secondAttribute="trailing" constant="8" id="p0W-sg-sLn"/>
+                                    <constraint firstItem="Huj-Ag-41W" firstAttribute="trailing" secondItem="14W-Va-E0F" secondAttribute="trailing" constant="-8" id="znE-Jo-bmA"/>
+                                </constraints>
+                            </view>
+                        </box>
+                        <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="P95-Eo-jBE">
+                            <rect key="frame" x="30" y="237" width="560" height="180"/>
+                            <view key="contentView" id="GxS-fG-gYm">
+                                <rect key="frame" x="1" y="1" width="558" height="178"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="QRf-k3-H9l">
+                                        <rect key="frame" x="0.0" y="0.0" width="558" height="178"/>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="NLe-id-HJw"/>
+                                    </imageView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="QRf-k3-H9l" firstAttribute="top" secondItem="GxS-fG-gYm" secondAttribute="top" id="9Ij-Lf-lzV"/>
+                                    <constraint firstAttribute="bottom" secondItem="QRf-k3-H9l" secondAttribute="bottom" id="CiL-tl-oEO"/>
+                                    <constraint firstItem="QRf-k3-H9l" firstAttribute="leading" secondItem="GxS-fG-gYm" secondAttribute="leading" id="VRv-Nr-qho"/>
+                                    <constraint firstAttribute="trailing" secondItem="QRf-k3-H9l" secondAttribute="trailing" id="YlX-As-flJ"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="180" id="EDv-SG-rAJ"/>
+                                <constraint firstAttribute="width" constant="560" id="et4-rH-Hod"/>
+                            </constraints>
+                            <color key="fillColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I92-83-FIM">
+                            <rect key="frame" x="30" y="219" width="122" height="17"/>
+                            <buttonCell key="cell" type="bevel" title="Click here to Draw" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="6Zc-rW-r8w">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system" size="14"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="buttonItemClick_ShowDraw:" target="-2" id="rZb-vb-bHf"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mlp-WB-DNU">
+                            <rect key="frame" x="30" y="220" width="52" height="17"/>
+                            <buttonCell key="cell" type="bevel" title="Browse" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="arb-3U-RU5">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system" size="14"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="buttonItemClick_Browse:" target="-2" id="xcG-Sa-uuT"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ttc-sm-ptR">
+                            <rect key="frame" x="112" y="220" width="38" height="17"/>
+                            <buttonCell key="cell" type="bevel" title="Clear" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="E3E-sP-fXg">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system" size="14"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="buttonItemClick_Clear:" target="-2" id="fSE-XL-3Hq"/>
+                            </connections>
+                        </button>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="UwV-S6-YiG">
+                            <rect key="frame" x="30" y="67" width="560" height="140"/>
+                            <view key="contentView" id="WOr-Nb-gZu">
+                                <rect key="frame" x="0.0" y="0.0" width="560" height="140"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2dT-1G-B3y">
+                                        <rect key="frame" x="-2" y="125" width="73" height="15"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Include Text" id="kEB-7E-BA7">
+                                            <font key="font" metaFont="cellTitle"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7ES-DS-PJP">
+                                        <rect key="frame" x="-2" y="92.5" width="59" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Name" bezelStyle="regularSquare" imagePosition="left" inset="2" id="ROi-wJ-Dzt">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="Z3J-ze-QFZ"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OSW-eR-z6D">
+                                        <rect key="frame" x="-2" y="70.5" width="53" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Date" bezelStyle="regularSquare" imagePosition="left" inset="2" id="PLu-dR-j8v">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="Ume-j0-8jl"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="6" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TMC-tW-mNf">
+                                        <rect key="frame" x="-2" y="48.5" width="55" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Logo" bezelStyle="regularSquare" imagePosition="left" inset="2" id="kYS-Kt-Ffm">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="qXU-CY-vcc"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="3" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="toP-5L-9Zb">
+                                        <rect key="frame" x="-2" y="26.5" width="68" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Reason" bezelStyle="regularSquare" imagePosition="left" inset="2" id="J5w-3t-dtz">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="wR0-Li-zlA"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="4" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eqg-Sq-ccJ">
+                                        <rect key="frame" x="135" y="92.5" width="140" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Distinguished Name" bezelStyle="regularSquare" imagePosition="left" inset="2" id="R7N-t0-QaI">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="Ue6-dU-Gnr"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="5" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zj6-rR-itk">
+                                        <rect key="frame" x="135" y="70.5" width="137" height="18"/>
+                                        <buttonCell key="cell" type="check" title="ComPDFKit Version" bezelStyle="regularSquare" imagePosition="left" inset="2" id="11k-ny-VRd">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="pgP-K1-Az8"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="2" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fCG-74-01y">
+                                        <rect key="frame" x="135" y="48.5" width="75" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Location" bezelStyle="regularSquare" imagePosition="left" inset="2" id="idm-ID-lfF">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="ftl-VW-ZP9"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="7" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="324-d7-5V3">
+                                        <rect key="frame" x="135" y="26.5" width="63" height="18"/>
+                                        <buttonCell key="cell" type="check" title="Labels" bezelStyle="regularSquare" imagePosition="left" inset="2" id="eLV-a4-uK3">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_ShowText:" target="-2" id="jxg-yN-qdb"/>
+                                        </connections>
+                                    </button>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sob-mk-zDt">
+                                        <rect key="frame" x="316" y="117" width="83" height="15"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Text Direction" id="WpD-OM-3Dn">
+                                            <font key="font" metaFont="cellTitle"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <button translatesAutoresizingMaskIntoConstraints="NO" id="35Z-n6-vB2">
+                                        <rect key="frame" x="402" y="113" width="40" height="24"/>
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNamePropertybarTextalignLeftNor" imagePosition="only" alignment="center" inset="2" id="ENW-LB-YdJ">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="40" id="BPi-hf-Znr"/>
+                                            <constraint firstAttribute="height" constant="24" id="bWC-L7-PCx"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="buttonItemClick_Algin:" target="-2" id="lAz-cP-jok"/>
+                                        </connections>
+                                    </button>
+                                    <button tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="MqX-jx-dzq">
+                                        <rect key="frame" x="442" y="113" width="40" height="24"/>
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNamePropertybarTextalignRightNor" imagePosition="only" alignment="center" inset="2" id="Dhh-YC-Mq8">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="Dek-rF-95i"/>
+                                            <constraint firstAttribute="width" constant="40" id="xgI-8I-aG1"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="buttonItemClick_Algin:" target="-2" id="s41-iW-0Rj"/>
+                                        </connections>
+                                    </button>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Te-9i-EPG">
+                                        <rect key="frame" x="316" y="79" width="56" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Reason" id="bhY-NO-fbi">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="dRt-2N-VM6">
+                                        <rect key="frame" x="372" y="69" width="190" height="35"/>
+                                        <popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="4F2-c0-Cdq">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="Bvy-Re-ARY"/>
+                                        </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="G2Y-24-me0"/>
+                                            <constraint firstAttribute="width" constant="184" id="znG-4k-dBo"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="buttonItemClick_Reason:" target="-2" id="07b-dX-RrI"/>
+                                        </connections>
+                                    </popUpButton>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ixk-CF-vNn">
+                                        <rect key="frame" x="316" y="43" width="56" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Location" id="IFV-C3-k8C">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WW1-ij-wXG">
+                                        <rect key="frame" x="375" y="37" width="185" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="CIc-wN-sMs"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" bezelStyle="round" id="Oln-Dj-kWs">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="35Z-n6-vB2" firstAttribute="centerY" secondItem="sob-mk-zDt" secondAttribute="centerY" id="2ZP-Ny-EAI"/>
+                                    <constraint firstItem="sob-mk-zDt" firstAttribute="leading" secondItem="4Te-9i-EPG" secondAttribute="leading" id="57f-z9-ieF"/>
+                                    <constraint firstItem="TMC-tW-mNf" firstAttribute="leading" secondItem="WOr-Nb-gZu" secondAttribute="leading" id="7c1-qN-uRN"/>
+                                    <constraint firstItem="toP-5L-9Zb" firstAttribute="top" secondItem="TMC-tW-mNf" secondAttribute="bottom" constant="7" id="7kd-c5-jkj"/>
+                                    <constraint firstItem="dRt-2N-VM6" firstAttribute="leading" secondItem="WW1-ij-wXG" secondAttribute="leading" id="AMy-NQ-ccE"/>
+                                    <constraint firstItem="324-d7-5V3" firstAttribute="centerY" secondItem="toP-5L-9Zb" secondAttribute="centerY" id="DZN-sN-w8T"/>
+                                    <constraint firstItem="7ES-DS-PJP" firstAttribute="top" secondItem="2dT-1G-B3y" secondAttribute="bottom" constant="16" id="E0f-es-g1u"/>
+                                    <constraint firstItem="2dT-1G-B3y" firstAttribute="leading" secondItem="WOr-Nb-gZu" secondAttribute="leading" id="IDh-Q6-8tP"/>
+                                    <constraint firstItem="OSW-eR-z6D" firstAttribute="top" secondItem="7ES-DS-PJP" secondAttribute="bottom" constant="7" id="K9f-9p-E1t"/>
+                                    <constraint firstItem="sob-mk-zDt" firstAttribute="top" secondItem="WOr-Nb-gZu" secondAttribute="top" constant="8" id="Kpf-4P-7Cf"/>
+                                    <constraint firstItem="OSW-eR-z6D" firstAttribute="leading" secondItem="WOr-Nb-gZu" secondAttribute="leading" id="MAY-CM-yxi"/>
+                                    <constraint firstItem="2dT-1G-B3y" firstAttribute="top" secondItem="WOr-Nb-gZu" secondAttribute="top" id="Maa-f2-uSk"/>
+                                    <constraint firstItem="TMC-tW-mNf" firstAttribute="top" secondItem="OSW-eR-z6D" secondAttribute="bottom" constant="7" id="MvV-pR-Uob"/>
+                                    <constraint firstItem="324-d7-5V3" firstAttribute="leading" secondItem="eqg-Sq-ccJ" secondAttribute="leading" id="Nts-8h-sKc"/>
+                                    <constraint firstItem="ixk-CF-vNn" firstAttribute="trailing" secondItem="4Te-9i-EPG" secondAttribute="trailing" id="Qk4-MI-0bq"/>
+                                    <constraint firstItem="7ES-DS-PJP" firstAttribute="leading" secondItem="WOr-Nb-gZu" secondAttribute="leading" id="TzH-r6-VDX"/>
+                                    <constraint firstItem="dRt-2N-VM6" firstAttribute="leading" secondItem="4Te-9i-EPG" secondAttribute="trailing" constant="5" id="UVd-XE-6yQ"/>
+                                    <constraint firstItem="dRt-2N-VM6" firstAttribute="top" secondItem="MqX-jx-dzq" secondAttribute="bottom" constant="12" id="Vdr-MV-RCB"/>
+                                    <constraint firstItem="WW1-ij-wXG" firstAttribute="top" secondItem="sob-mk-zDt" secondAttribute="bottom" constant="52" id="YdI-rw-sP6"/>
+                                    <constraint firstItem="zj6-rR-itk" firstAttribute="leading" secondItem="eqg-Sq-ccJ" secondAttribute="leading" id="aRb-qc-EZw"/>
+                                    <constraint firstAttribute="bottom" secondItem="toP-5L-9Zb" secondAttribute="bottom" constant="28" id="bUX-Cx-6yw"/>
+                                    <constraint firstItem="toP-5L-9Zb" firstAttribute="leading" secondItem="WOr-Nb-gZu" secondAttribute="leading" id="c2u-Rc-gsd"/>
+                                    <constraint firstAttribute="trailing" secondItem="dRt-2N-VM6" secondAttribute="trailing" constant="1" id="cUl-l2-H4F"/>
+                                    <constraint firstItem="eqg-Sq-ccJ" firstAttribute="centerY" secondItem="7ES-DS-PJP" secondAttribute="centerY" id="fsH-NU-e7y"/>
+                                    <constraint firstItem="eqg-Sq-ccJ" firstAttribute="leading" secondItem="fCG-74-01y" secondAttribute="leading" id="giA-xy-ZOa"/>
+                                    <constraint firstItem="zj6-rR-itk" firstAttribute="centerY" secondItem="OSW-eR-z6D" secondAttribute="centerY" id="hBi-vq-NW1"/>
+                                    <constraint firstItem="dRt-2N-VM6" firstAttribute="centerY" secondItem="4Te-9i-EPG" secondAttribute="centerY" id="hh1-ZR-b7F"/>
+                                    <constraint firstItem="4Te-9i-EPG" firstAttribute="leading" secondItem="ixk-CF-vNn" secondAttribute="leading" id="iYY-D1-UgM"/>
+                                    <constraint firstItem="dRt-2N-VM6" firstAttribute="trailing" secondItem="WW1-ij-wXG" secondAttribute="trailing" constant="-1" id="jyE-1B-ZZE"/>
+                                    <constraint firstItem="35Z-n6-vB2" firstAttribute="leading" secondItem="sob-mk-zDt" secondAttribute="trailing" constant="5" id="orx-aI-gaL"/>
+                                    <constraint firstItem="eqg-Sq-ccJ" firstAttribute="leading" secondItem="7ES-DS-PJP" secondAttribute="trailing" constant="80" id="piO-lg-209"/>
+                                    <constraint firstItem="WW1-ij-wXG" firstAttribute="centerY" secondItem="ixk-CF-vNn" secondAttribute="centerY" id="rBr-C6-njb"/>
+                                    <constraint firstItem="MqX-jx-dzq" firstAttribute="leading" secondItem="35Z-n6-vB2" secondAttribute="trailing" id="x1M-cI-Iep"/>
+                                    <constraint firstItem="MqX-jx-dzq" firstAttribute="centerY" secondItem="35Z-n6-vB2" secondAttribute="centerY" id="xFN-yp-ZGp"/>
+                                    <constraint firstItem="fCG-74-01y" firstAttribute="centerY" secondItem="TMC-tW-mNf" secondAttribute="centerY" id="xLF-l2-rpG"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="140" id="g9a-kC-Ymc"/>
+                                <constraint firstAttribute="width" constant="560" id="pDy-bp-Fkn"/>
+                            </constraints>
+                        </box>
+                        <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="6B5-Ka-uED">
+                            <rect key="frame" x="20" y="30" width="270" height="28"/>
+                            <view key="contentView" id="9iU-6E-YdB">
+                                <rect key="frame" x="0.0" y="0.0" width="270" height="28"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aH6-Rq-CWw">
+                                        <rect key="frame" x="-2" y="6" width="75" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Select the " id="JLM-IJ-PnH">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ibO-c4-B3S">
+                                        <rect key="frame" x="76" y="0.0" width="194" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="pT6-3D-T5i"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" bezelStyle="round" id="adM-W0-ZlU">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="ibO-c4-B3S" firstAttribute="leading" secondItem="aH6-Rq-CWw" secondAttribute="trailing" constant="5" id="HV7-9L-S6M"/>
+                                    <constraint firstAttribute="bottom" secondItem="ibO-c4-B3S" secondAttribute="bottom" id="IIc-Nt-GiW"/>
+                                    <constraint firstItem="ibO-c4-B3S" firstAttribute="centerY" secondItem="aH6-Rq-CWw" secondAttribute="centerY" id="IZF-Pa-9nF"/>
+                                    <constraint firstAttribute="trailing" secondItem="ibO-c4-B3S" secondAttribute="trailing" id="Qk2-vy-hOS"/>
+                                    <constraint firstItem="ibO-c4-B3S" firstAttribute="top" secondItem="9iU-6E-YdB" secondAttribute="top" id="cb1-MV-MKe"/>
+                                    <constraint firstItem="aH6-Rq-CWw" firstAttribute="leading" secondItem="9iU-6E-YdB" secondAttribute="leading" id="fjE-VZ-BIG"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="tzN-xo-CV4"/>
+                                <constraint firstAttribute="width" constant="270" id="u2n-Y8-uau"/>
+                            </constraints>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="O3E-wc-nBV">
+                            <rect key="frame" x="361" y="24" width="116" height="40"/>
+                            <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="epR-uP-OL5">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="104" id="4Zp-UB-5mg"/>
+                            </constraints>
+                            <connections>
+                                <action selector="buttonItemClick_Cancel:" target="-2" id="t2x-aj-VJG"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BBs-HJ-bNW">
+                            <rect key="frame" x="485" y="24" width="116" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="lan-lJ-ywS">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="104" id="G6K-8b-vOE"/>
+                            </constraints>
+                            <connections>
+                                <action selector="buttonItemClick_Continue:" target="-2" id="1LD-ib-rU8"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="Ttc-sm-ptR" firstAttribute="leading" secondItem="Mlp-WB-DNU" secondAttribute="trailing" constant="30" id="1gb-yd-e3r"/>
+                        <constraint firstItem="6B5-Ka-uED" firstAttribute="leading" secondItem="nkd-bq-Ju3" secondAttribute="leading" constant="20" id="7Pc-2K-3GA"/>
+                        <constraint firstItem="BBs-HJ-bNW" firstAttribute="leading" secondItem="O3E-wc-nBV" secondAttribute="trailing" constant="20" id="Bss-xR-7i9"/>
+                        <constraint firstItem="Mlp-WB-DNU" firstAttribute="top" secondItem="P95-Eo-jBE" secondAttribute="bottom" id="EDz-IW-BiP"/>
+                        <constraint firstItem="P95-Eo-jBE" firstAttribute="centerX" secondItem="nkd-bq-Ju3" secondAttribute="centerX" id="HMg-w0-H36"/>
+                        <constraint firstItem="Rxw-SY-oZ6" firstAttribute="centerY" secondItem="k1a-6l-aIe" secondAttribute="centerY" id="Inq-xK-eSD"/>
+                        <constraint firstAttribute="trailing" secondItem="BBs-HJ-bNW" secondAttribute="trailing" constant="24" id="Utc-Ta-auc"/>
+                        <constraint firstItem="Mlp-WB-DNU" firstAttribute="leading" secondItem="P95-Eo-jBE" secondAttribute="leading" id="VV3-ng-Hhx"/>
+                        <constraint firstAttribute="bottom" secondItem="BBs-HJ-bNW" secondAttribute="bottom" constant="30" id="W1S-HT-Xjf"/>
+                        <constraint firstItem="ZW2-cR-TiA" firstAttribute="top" secondItem="k1a-6l-aIe" secondAttribute="bottom" constant="16" id="WAL-jw-FnU"/>
+                        <constraint firstItem="UwV-S6-YiG" firstAttribute="top" secondItem="P95-Eo-jBE" secondAttribute="bottom" constant="30" id="YCk-aL-FeI"/>
+                        <constraint firstItem="I92-83-FIM" firstAttribute="leading" secondItem="P95-Eo-jBE" secondAttribute="leading" id="ZCA-zD-uHE"/>
+                        <constraint firstAttribute="bottom" secondItem="6B5-Ka-uED" secondAttribute="bottom" constant="30" id="ZeV-VM-1hw"/>
+                        <constraint firstItem="k1a-6l-aIe" firstAttribute="leading" secondItem="nkd-bq-Ju3" secondAttribute="leading" constant="20" id="Zpa-YB-jrj"/>
+                        <constraint firstItem="UwV-S6-YiG" firstAttribute="centerX" secondItem="nkd-bq-Ju3" secondAttribute="centerX" id="ayv-ja-F1D"/>
+                        <constraint firstItem="Ttc-sm-ptR" firstAttribute="centerY" secondItem="Mlp-WB-DNU" secondAttribute="centerY" id="bSt-1Y-a42"/>
+                        <constraint firstAttribute="trailing" secondItem="Rxw-SY-oZ6" secondAttribute="trailing" constant="20" id="gRO-X7-KVf"/>
+                        <constraint firstItem="ZW2-cR-TiA" firstAttribute="centerX" secondItem="nkd-bq-Ju3" secondAttribute="centerX" id="qAK-pN-xwg"/>
+                        <constraint firstItem="k1a-6l-aIe" firstAttribute="top" secondItem="nkd-bq-Ju3" secondAttribute="top" constant="24" id="sfe-qJ-BIP"/>
+                        <constraint firstItem="P95-Eo-jBE" firstAttribute="top" secondItem="ZW2-cR-TiA" secondAttribute="bottom" constant="10" id="usp-rq-dmw"/>
+                        <constraint firstItem="I92-83-FIM" firstAttribute="top" secondItem="P95-Eo-jBE" secondAttribute="bottom" constant="1" id="x88-Oi-8kg"/>
+                        <constraint firstItem="BBs-HJ-bNW" firstAttribute="centerY" secondItem="O3E-wc-nBV" secondAttribute="centerY" id="yhS-WH-vVP"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="nkd-bq-Ju3" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="PiB-aC-QLi"/>
+                <constraint firstAttribute="bottom" secondItem="nkd-bq-Ju3" secondAttribute="bottom" id="XYG-2i-PqV"/>
+                <constraint firstItem="nkd-bq-Ju3" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="kUo-3A-SgQ"/>
+                <constraint firstAttribute="trailing" secondItem="nkd-bq-Ju3" secondAttribute="trailing" id="lNK-wN-3jk"/>
+            </constraints>
+            <point key="canvasLocation" x="-53" y="-123"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+        <image name="ImageNameDSignatureCustomImage" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomImageSelect" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomNone" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomNoneSelect" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomSign" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomSignSelect" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomText" width="20" height="20"/>
+        <image name="ImageNameDSignatureCustomTextSelect" width="20" height="20"/>
+        <image name="ImageNamePropertybarTextalignLeftNor" width="20" height="20"/>
+        <image name="ImageNamePropertybarTextalignRightNor" width="20" height="20"/>
+    </resources>
+</document>

+ 98 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateStateViewController.swift

@@ -0,0 +1,98 @@
+//
+//  CDSignatureCertificateStateViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/20.
+//
+
+import Cocoa
+
+class CDSignatureCertificateStateViewController: NSViewController {
+
+    @IBOutlet weak var titleLabel: NSTextField!
+    @IBOutlet weak var imageView: NSImageView!
+    @IBOutlet weak var subTitleLabel: NSTextField!
+    @IBOutlet weak var subDes1Label: NSTextField!
+    @IBOutlet weak var subDes2Label: NSTextField!
+    @IBOutlet weak var propertiesBtn: NSButton!
+    @IBOutlet weak var closeBtn: NSButton!
+    
+    var signature: CPDFSignature!
+    var pdfListView: CPDFDigtalView!
+    
+    var actionBlock: ((_ stateVC: CDSignatureCertificateStateViewController, _ actionType: DSignatureActionType)->Void)?
+ 
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        
+        self.reloadData()
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.titleLabel.stringValue = NSLocalizedString("Signature Validation Status", comment: "")
+        
+        self.reloadData()
+    }
+    
+    func reloadData () {
+        let signer = self.signature.signers.first
+        let isSignVerified = signer?.isSignVerified
+        let isCertTrusted = signer?.isCertTrusted
+        if isSignVerified == true && isCertTrusted == true {
+            self.imageView.image = NSImage(named: "ImageNameSigntureLargeVerifySuccess")
+            
+            let cer = signer?.certificates.first
+            let CNStr = cer?.subjectDict["CN"] as! String
+            self.subTitleLabel.stringValue = String(format: NSLocalizedString("Signature is VALID, signed by %@.", comment: ""), CNStr)
+            self.subDes1Label.stringValue = String(format: "- %@",NSLocalizedString("The document has not been modified since this signature was applied.", comment: ""))
+            self.subDes2Label.stringValue = String(format: "- %@",NSLocalizedString("The signer's identity is valid.", comment: ""))
+            
+        } else if isSignVerified == true && isCertTrusted == false {
+            self.imageView.image = NSImage(named: "ImageNameSigntureLargeTrustedFailure")
+            
+            self.subTitleLabel.stringValue = NSLocalizedString("Signature is invalid", comment: "")
+            self.subDes1Label.stringValue = String(format: "- %@",NSLocalizedString("The document has not been modified since this signature was applied.", comment: ""))
+            self.subDes2Label.stringValue = String(format: "- %@",NSLocalizedString("The signer's identity is unknown because it has not been included in your list of trusted certificates and none of its parent certificates are trusted certificates.", comment: ""))
+            
+        } else if isSignVerified == false && isCertTrusted == false {
+            self.imageView.image = NSImage(named: "ImageNameSigntureLargeVerifyFailure")
+            
+            self.subTitleLabel.stringValue = NSLocalizedString("Signature is invalid", comment: "")
+            self.subDes1Label.stringValue = String(format: "- %@",NSLocalizedString("The document has not been modified since this signature was applied.", comment: ""))
+            self.subDes2Label.stringValue = String(format: "- %@",NSLocalizedString("The signer's identity is invalid.", comment: ""))
+        } else {
+            self.imageView.image = NSImage(named: "ImageNameSigntureLargeVerifyFailure")
+            
+            self.subTitleLabel.stringValue = NSLocalizedString("Signature is invalid", comment: "")
+            self.subDes1Label.stringValue = String(format: "- %@",NSLocalizedString("The revision of the document that was covered by this signature has not been altered; however, there have been subsequent changes to the document.", comment: ""))
+            self.subDes2Label.stringValue = String(format: "- %@",NSLocalizedString("Click Signature Properties, then it will show what is covered by this signature.", comment: ""))
+        }
+        
+        self.propertiesBtn.title = NSLocalizedString("Signature Properties...", comment: "")
+        self.closeBtn.title = NSLocalizedString("Close", comment: "")
+        
+        self.subTitleLabel.textColor = NSColor.labelColor
+        self.titleLabel.textColor = NSColor.labelColor
+        self.subDes1Label.textColor = NSColor.labelColor
+        self.subDes2Label.textColor = NSColor.labelColor
+    }
+    
+    //MARK: IBAction
+    @IBAction func buttonItemClick_Properties(_ sender: NSButton) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .confirm)
+    }
+    
+    @IBAction func buttonItemClick_Close(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel)
+    }
+    
+}

+ 131 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateStateViewController.xib

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="CDSignatureCertificateStateViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="closeBtn" destination="hlZ-K5-OQR" id="cDH-gy-5HE"/>
+                <outlet property="imageView" destination="plH-z6-9Py" id="5lf-Ec-HTL"/>
+                <outlet property="propertiesBtn" destination="88I-WO-bcO" id="yFC-65-k8A"/>
+                <outlet property="subDes1Label" destination="gGh-2y-tLc" id="g7J-sD-eNR"/>
+                <outlet property="subDes2Label" destination="dKC-0p-sNp" id="wiW-kY-MXC"/>
+                <outlet property="subTitleLabel" destination="o09-am-WUc" id="gH3-ad-dqd"/>
+                <outlet property="titleLabel" destination="OkA-8v-TXa" id="amW-qa-g4F"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="764" height="203"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="Pya-kX-IBa">
+                    <rect key="frame" x="0.0" y="0.0" width="764" height="203"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OkA-8v-TXa">
+                            <rect key="frame" x="292" y="177" width="181" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Signature Validation Status" id="wLW-wd-zJ7">
+                                <font key="font" metaFont="systemBold"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="plH-z6-9Py">
+                            <rect key="frame" x="24" y="97" width="52" height="52"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="52" id="1Cc-fw-5LE"/>
+                                <constraint firstAttribute="height" constant="52" id="hJt-MV-hsE"/>
+                            </constraints>
+                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameSigntureVerifySuccess" id="Cgx-wT-KvM"/>
+                        </imageView>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="o09-am-WUc">
+                            <rect key="frame" x="84" y="130" width="253" height="19"/>
+                            <constraints>
+                                <constraint firstAttribute="width" relation="lessThanOrEqual" constant="640" id="cwL-53-Lwc"/>
+                            </constraints>
+                            <textFieldCell key="cell" title="Signature validity is UNKNOWN." id="pqL-kg-5rx">
+                                <font key="font" metaFont="systemBold" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gGh-2y-tLc">
+                            <rect key="frame" x="84" y="101" width="469" height="17"/>
+                            <constraints>
+                                <constraint firstAttribute="width" relation="lessThanOrEqual" constant="640" id="ZLC-Dg-CCd"/>
+                            </constraints>
+                            <textFieldCell key="cell" title="- The document has not been modified since this signature was applied." id="fVp-q5-egp">
+                                <font key="font" metaFont="system" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dKC-0p-sNp">
+                            <rect key="frame" x="84" y="72" width="403" height="17"/>
+                            <constraints>
+                                <constraint firstAttribute="width" relation="lessThanOrEqual" constant="640" id="bzC-dQ-d61"/>
+                            </constraints>
+                            <textFieldCell key="cell" title="- The signer's identity is unknown because it has not been inc" id="LPF-hm-2Hb">
+                                <font key="font" metaFont="system" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="88I-WO-bcO">
+                            <rect key="frame" x="469" y="18" width="168" height="40"/>
+                            <buttonCell key="cell" type="push" title="Signature Properties..." bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="SdI-0s-GaR">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="buttonItemClick_Properties:" target="-2" id="f02-Gb-kw6"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hlZ-K5-OQR">
+                            <rect key="frame" x="649" y="18" width="67" height="40"/>
+                            <buttonCell key="cell" type="push" title="Close" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="emu-PE-O1u">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="buttonItemClick_Close:" target="-2" id="3ef-hf-uad"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="OkA-8v-TXa" firstAttribute="centerX" secondItem="Pya-kX-IBa" secondAttribute="centerX" id="1WE-O2-g2b"/>
+                        <constraint firstItem="88I-WO-bcO" firstAttribute="top" relation="greaterThanOrEqual" secondItem="dKC-0p-sNp" secondAttribute="bottom" constant="20" id="3gy-2k-ZET"/>
+                        <constraint firstItem="gGh-2y-tLc" firstAttribute="top" secondItem="o09-am-WUc" secondAttribute="bottom" constant="12" id="C6p-G5-aTP"/>
+                        <constraint firstItem="plH-z6-9Py" firstAttribute="leading" secondItem="Pya-kX-IBa" secondAttribute="leading" constant="24" id="EIB-Yr-dSH"/>
+                        <constraint firstItem="o09-am-WUc" firstAttribute="top" secondItem="plH-z6-9Py" secondAttribute="top" id="Gvm-iJ-Jg2"/>
+                        <constraint firstItem="dKC-0p-sNp" firstAttribute="leading" secondItem="gGh-2y-tLc" secondAttribute="leading" id="PPE-4O-1xs"/>
+                        <constraint firstItem="o09-am-WUc" firstAttribute="leading" secondItem="plH-z6-9Py" secondAttribute="trailing" constant="10" id="ZUI-SU-Tqh"/>
+                        <constraint firstItem="gGh-2y-tLc" firstAttribute="leading" secondItem="plH-z6-9Py" secondAttribute="trailing" constant="10" id="bm6-NL-gSW"/>
+                        <constraint firstAttribute="trailing" secondItem="hlZ-K5-OQR" secondAttribute="trailing" constant="54" id="dZE-oc-dpG"/>
+                        <constraint firstItem="dKC-0p-sNp" firstAttribute="top" secondItem="gGh-2y-tLc" secondAttribute="bottom" constant="12" id="eqS-bD-neI"/>
+                        <constraint firstItem="plH-z6-9Py" firstAttribute="top" secondItem="Pya-kX-IBa" secondAttribute="top" constant="54" id="hoU-i7-r9M"/>
+                        <constraint firstItem="OkA-8v-TXa" firstAttribute="top" secondItem="Pya-kX-IBa" secondAttribute="top" constant="10" id="iiR-W9-JHn"/>
+                        <constraint firstAttribute="bottom" secondItem="88I-WO-bcO" secondAttribute="bottom" constant="24" id="pcY-mh-SpX"/>
+                        <constraint firstAttribute="bottom" secondItem="hlZ-K5-OQR" secondAttribute="bottom" constant="24" id="wcQ-Jz-HDm"/>
+                        <constraint firstItem="hlZ-K5-OQR" firstAttribute="leading" secondItem="88I-WO-bcO" secondAttribute="trailing" constant="24" id="z6D-rm-11M"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="Pya-kX-IBa" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="01V-Rc-qC3"/>
+                <constraint firstAttribute="bottom" secondItem="Pya-kX-IBa" secondAttribute="bottom" id="6GJ-sk-dBz"/>
+                <constraint firstAttribute="trailing" secondItem="Pya-kX-IBa" secondAttribute="trailing" id="I2l-ad-HHt"/>
+                <constraint firstItem="Pya-kX-IBa" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="Z4R-2a-eZb"/>
+            </constraints>
+            <point key="canvasLocation" x="-17" y="163"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameSigntureVerifySuccess" width="29" height="29"/>
+    </resources>
+</document>

+ 88 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureDrawViewController.swift

@@ -0,0 +1,88 @@
+//
+//  CDSignatureDrawViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/16.
+//
+
+import Cocoa
+
+class CDSignatureDrawViewController: NSViewController, CDSDrawViewDelegate {
+
+    
+    @IBOutlet weak var drawView: CDSDrawView!
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var applyButton: NSButton!
+    @IBOutlet weak var clearButton: NSButton!
+    
+    var drawImage: NSImage!
+    
+    var actionBlock: ((_ drawVC: CDSignatureDrawViewController, _ drawImage: NSImage)->Void)?
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        
+        self.view.window?.title = ""
+        self.view.window?.styleMask = [self.view.window!.styleMask, .fullSizeContentView]
+        self.view.window?.titlebarAppearsTransparent = true
+        self.view.window?.backgroundColor = NSColor(red: 252.0/255.0, green: 253.0/255.0, blue: 255.0/255.0, alpha: 1.0)
+        
+        self.view.window?.standardWindowButton(.closeButton)?.isHidden = true
+        self.view.window?.standardWindowButton(.miniaturizeButton)?.isHidden = true
+        self.view.window?.standardWindowButton(.zoomButton)?.isHidden = true
+        
+        self.drawView.clearImage()
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
+        self.applyButton.title = NSLocalizedString("Apply", comment: "")
+        self.clearButton.title = NSLocalizedString("Clear", comment: "")
+        
+        
+        self.drawView?.wantsLayer = true
+        self.drawView?.layer?.borderWidth = 1.0
+        self.drawView?.layer?.cornerRadius = 8.0
+        self.drawView?.layer?.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1.0).cgColor
+        self.drawView?.layer?.backgroundColor = NSColor(red: 1, green: 1, blue: 1, alpha: 1.0).cgColor
+        
+        self.drawView.delegate = self;
+        self.drawView.drawColor = NSColor.black
+        self.drawView.strokeRadius = 2.0;
+        
+        self.drawView.drawImage = self.drawImage
+        
+        
+    }
+    
+    //MARK: IBAction
+    @IBAction func closeAction(_ sender: NSButton) {
+        self.dismiss(self)
+    }
+    
+    @IBAction func clearAction(_ sender: NSButton) {
+        self.drawView.clearImage()
+    }
+    
+    @IBAction func cancelAction(_ sender: NSButton) {
+        self.dismiss(self)
+    }
+    
+    @IBAction func applyAction(_ sender: NSButton) {
+        var image = NSImage(size: CGSizeZero)
+        if self.drawView.signatureImage() != nil {
+            image = self.drawView.signatureImage()
+        }
+        
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, image)
+        
+        self.cancelAction(self.cancelButton)
+    }
+    
+}

+ 104 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureDrawViewController.xib

@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="CDSignatureDrawViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="applyButton" destination="jge-Wz-7GM" id="GbA-cg-Jx1"/>
+                <outlet property="cancelButton" destination="rux-4p-HmL" id="vVZ-cT-T0B"/>
+                <outlet property="clearButton" destination="c37-jl-UQg" id="hsx-p5-uxf"/>
+                <outlet property="drawView" destination="HP5-0O-nek" id="tW9-wA-hjq"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <button translatesAutoresizingMaskIntoConstraints="NO" id="XqJ-Ak-khf">
+                    <rect key="frame" x="570" y="262" width="16" height="16"/>
+                    <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="Czf-Xr-8hI">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="16" id="J0K-bF-Pmc"/>
+                    </constraints>
+                    <connections>
+                        <action selector="closeAction:" target="-2" id="4jl-tx-KGO"/>
+                    </connections>
+                </button>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="HP5-0O-nek" customClass="CDSDrawView">
+                    <rect key="frame" x="26" y="66" width="560" height="180"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="560" id="Irv-hs-BkJ"/>
+                        <constraint firstAttribute="height" constant="180" id="niM-tq-3or"/>
+                    </constraints>
+                </customView>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="c37-jl-UQg">
+                    <rect key="frame" x="20" y="16" width="64" height="40"/>
+                    <buttonCell key="cell" type="push" title="Clear" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IrD-Ve-zYZ">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                        <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                    </buttonCell>
+                    <connections>
+                        <action selector="clearAction:" target="-2" id="nI4-RM-yO8"/>
+                    </connections>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rux-4p-HmL">
+                    <rect key="frame" x="443" y="16" width="74" height="40"/>
+                    <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="BQE-p6-ChK">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                        <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                    </buttonCell>
+                    <connections>
+                        <action selector="cancelAction:" target="-2" id="1r0-ON-urG"/>
+                    </connections>
+                </button>
+                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jge-Wz-7GM">
+                    <rect key="frame" x="525" y="16" width="67" height="40"/>
+                    <buttonCell key="cell" type="push" title="Apply" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kvj-Un-nRo">
+                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                        <font key="font" metaFont="system"/>
+                        <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                    </buttonCell>
+                    <connections>
+                        <action selector="applyAction:" target="-2" id="9Fy-vY-Z5l"/>
+                    </connections>
+                </button>
+            </subviews>
+            <constraints>
+                <constraint firstItem="jge-Wz-7GM" firstAttribute="centerY" secondItem="rux-4p-HmL" secondAttribute="centerY" id="3Ed-6Y-l1g"/>
+                <constraint firstItem="XqJ-Ak-khf" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="22" id="4cK-or-WRn"/>
+                <constraint firstItem="c37-jl-UQg" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="26" id="5Sd-LB-FO9"/>
+                <constraint firstAttribute="trailing" secondItem="XqJ-Ak-khf" secondAttribute="trailing" constant="14" id="9Jg-JD-tmY"/>
+                <constraint firstItem="jge-Wz-7GM" firstAttribute="centerY" secondItem="c37-jl-UQg" secondAttribute="centerY" id="Ja3-HC-sH7"/>
+                <constraint firstItem="jge-Wz-7GM" firstAttribute="top" secondItem="HP5-0O-nek" secondAttribute="bottom" constant="16" id="LrP-x5-ddZ"/>
+                <constraint firstItem="jge-Wz-7GM" firstAttribute="leading" secondItem="rux-4p-HmL" secondAttribute="trailing" constant="20" id="NzL-RM-2dB"/>
+                <constraint firstAttribute="trailing" secondItem="jge-Wz-7GM" secondAttribute="trailing" constant="14" id="SkH-FB-p1h"/>
+                <constraint firstItem="c37-jl-UQg" firstAttribute="leading" secondItem="HP5-0O-nek" secondAttribute="leading" id="i4n-fM-Dhe"/>
+                <constraint firstAttribute="bottom" secondItem="jge-Wz-7GM" secondAttribute="bottom" constant="22" id="oiB-Q0-Rgy"/>
+                <constraint firstItem="jge-Wz-7GM" firstAttribute="leading" secondItem="rux-4p-HmL" secondAttribute="trailing" constant="20" id="qFl-Yi-htw"/>
+                <constraint firstItem="HP5-0O-nek" firstAttribute="top" secondItem="XqJ-Ak-khf" secondAttribute="bottom" constant="16" id="x5u-WN-4kZ"/>
+            </constraints>
+            <point key="canvasLocation" x="126" y="-72"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+    </resources>
+</document>

+ 69 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureTextViewController.swift

@@ -0,0 +1,69 @@
+//
+//  CDSignatureTextViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/16.
+//
+
+import Cocoa
+
+class CDSignatureTextViewController: NSViewController {
+
+    @IBOutlet weak var signTextField: NSTextField!
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var applyButton: NSButton!
+    @IBOutlet weak var clearButton: NSButton!
+    
+    var drawText: String!
+    
+    var actionBlock: ((_ textVC: CDSignatureTextViewController, _ inputText: String)->Void)?
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        
+        self.view.window?.title = "";
+//        self.view.window?.styleMask = [self.view.window?.styleMask, .fullSizeContentView]
+        self.view.window?.titlebarAppearsTransparent = true
+        self.view.window?.backgroundColor = NSColor(red: 252.0/255.0, green: 253.0/255.0, blue: 255.0/255.0, alpha: 1.0)
+        
+        self.view.window?.standardWindowButton(.closeButton)?.isHidden = true
+        self.view.window?.standardWindowButton(.miniaturizeButton)?.isHidden = true
+        self.view.window?.standardWindowButton(.zoomButton)?.isHidden = true
+        
+        self.signTextField.textColor = NSColor.labelColor
+        self.signTextField.stringValue = self.drawText! as String
+        
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
+        self.applyButton.title = NSLocalizedString("Save", comment: "")
+        self.clearButton.title = NSLocalizedString("Clear", comment: "")
+        
+    }
+    
+    //MARK: IBACtion
+    @IBAction func closeAction(_ sender: Any) {
+        self.dismiss(self)
+    }
+    
+    @IBAction func clearAction(_ sender: Any) {
+        self.signTextField.stringValue = ""
+    }
+    
+    @IBAction func cancelAction(_ sender: Any) {
+        self.dismiss(self)
+    }
+    
+    @IBAction func saveAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, self.signTextField.stringValue)
+        
+        self.cancelAction(NSButton())
+    }
+}

+ 121 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureTextViewController.xib

@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="CDSignatureTextViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="applyButton" destination="g3X-bp-cOk" id="IbV-9H-fNd"/>
+                <outlet property="cancelButton" destination="0gd-xO-tn0" id="nM1-Y4-AJZ"/>
+                <outlet property="clearButton" destination="TZi-7Q-cko" id="jaz-uA-Sdo"/>
+                <outlet property="signTextField" destination="Cbi-tv-MC8" id="d2s-5D-96g"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="zML-EL-ksk">
+                    <rect key="frame" x="0.0" y="0.0" width="600" height="300"/>
+                    <subviews>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="tJ8-yk-pPF">
+                            <rect key="frame" x="564" y="264" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="T43-Mg-exr">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="ZSo-ow-mU5"/>
+                            </connections>
+                        </button>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="cLJ-ce-n9r">
+                            <rect key="frame" x="20" y="60" width="560" height="180"/>
+                            <subviews>
+                                <textField focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Cbi-tv-MC8">
+                                    <rect key="frame" x="0.0" y="60" width="560" height="60"/>
+                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" focusRingType="none" alignment="center" placeholderString="Sign Here" drawsBackground="YES" id="tuv-kp-LAV">
+                                        <font key="font" size="40" name="Helvetica"/>
+                                        <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <color key="backgroundColor" red="0.94117647059999998" green="0.94117647059999998" blue="0.94117647059999998" alpha="0.0" colorSpace="calibratedRGB"/>
+                                    </textFieldCell>
+                                </textField>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="180" id="1rY-5l-cwF"/>
+                                <constraint firstAttribute="width" constant="560" id="isz-Is-twC"/>
+                            </constraints>
+                        </customView>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0gd-xO-tn0">
+                            <rect key="frame" x="442" y="18" width="74" height="40"/>
+                            <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Cwi-rc-jJo">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="cancelAction:" target="-2" id="wY6-Kc-jlH"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="g3X-bp-cOk">
+                            <rect key="frame" x="524" y="18" width="62" height="40"/>
+                            <buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="1p6-93-wpS">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="saveAction:" target="-2" id="afv-Os-jqV"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TZi-7Q-cko">
+                            <rect key="frame" x="14" y="18" width="64" height="40"/>
+                            <buttonCell key="cell" type="push" title="Clear" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="4lf-gu-65G">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="clearAction:" target="-2" id="vT6-OS-rI7"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="tJ8-yk-pPF" secondAttribute="trailing" constant="20" id="Bx7-e0-x9j"/>
+                        <constraint firstItem="cLJ-ce-n9r" firstAttribute="centerX" secondItem="zML-EL-ksk" secondAttribute="centerX" id="Dwx-9V-BcH"/>
+                        <constraint firstItem="tJ8-yk-pPF" firstAttribute="top" secondItem="zML-EL-ksk" secondAttribute="top" constant="20" id="HxB-49-p3Y"/>
+                        <constraint firstAttribute="trailing" secondItem="g3X-bp-cOk" secondAttribute="trailing" constant="20" id="KSC-Qc-4ny"/>
+                        <constraint firstItem="g3X-bp-cOk" firstAttribute="leading" secondItem="0gd-xO-tn0" secondAttribute="trailing" constant="20" id="SUz-MU-2BN"/>
+                        <constraint firstAttribute="bottom" secondItem="0gd-xO-tn0" secondAttribute="bottom" constant="24" id="V3O-1g-ZdF"/>
+                        <constraint firstItem="TZi-7Q-cko" firstAttribute="leading" secondItem="zML-EL-ksk" secondAttribute="leading" constant="20" id="hIk-vv-d3P"/>
+                        <constraint firstAttribute="bottom" secondItem="g3X-bp-cOk" secondAttribute="bottom" constant="24" id="m09-9w-ku9"/>
+                        <constraint firstItem="cLJ-ce-n9r" firstAttribute="top" secondItem="tJ8-yk-pPF" secondAttribute="bottom" constant="24" id="mXP-aT-fnW"/>
+                        <constraint firstAttribute="bottom" secondItem="TZi-7Q-cko" secondAttribute="bottom" constant="24" id="wNu-Gb-nuv"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="zML-EL-ksk" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="0Cw-Ez-YSx"/>
+                <constraint firstItem="zML-EL-ksk" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="0Ob-Md-iU1"/>
+                <constraint firstAttribute="trailing" secondItem="zML-EL-ksk" secondAttribute="trailing" id="3yR-13-ieX"/>
+                <constraint firstAttribute="bottom" secondItem="zML-EL-ksk" secondAttribute="bottom" id="zNt-6K-IxV"/>
+            </constraints>
+            <point key="canvasLocation" x="139" y="114"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+    </resources>
+</document>

+ 422 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCertifyDetailViewController.swift

@@ -0,0 +1,422 @@
+//
+//  DSignatureCertifyDetailViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureCertifyDetailViewController: NSViewController, NSTextFieldDelegate {
+
+    @IBOutlet weak var contendView: NSView!
+    @IBOutlet weak var titleLabel: NSTextField!
+    @IBOutlet weak var closeButton: NSButton!
+    @IBOutlet weak var appearanceLabel: NSTextField!
+    @IBOutlet weak var appearanceButton: NSPopUpButton!
+    
+    @IBOutlet weak var createButton: KMButton!
+    @IBOutlet weak var editButton: KMButton!
+    @IBOutlet weak var deleteButton: KMButton!
+    
+    @IBOutlet weak var lockDocButton: NSButton!
+    @IBOutlet weak var errorLabel: NSTextField!
+    
+    @IBOutlet weak var drawBox: NSBox!
+    @IBOutlet weak var drawImageView: NSImageView!
+    @IBOutlet weak var infoButton: NSButton!
+    
+    @IBOutlet weak var passwordBox: NSBox!
+    @IBOutlet weak var passwordLabel: NSTextField!
+    @IBOutlet weak var passwordTextField: NSSecureTextField!
+    
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+    
+    //证书+外观配置信息
+    var _cert: KMDSignatureModel!
+    var _appearanceData: DSignatureAppearanceData!
+    
+    var config: CPDFSignatureConfig!
+    var _signatureWidget: CPDFSignatureWidgetAnnotation!
+    
+    var isLock: Bool = false
+    
+    var actionBlock: ((_ detailVC: DSignatureCertifyDetailViewController, _ actionType: DSignatureActionType, _ appearanceData: DSignatureAppearanceData, _ config: CPDFSignatureConfig, _ password: String, _ isLock: Bool)->Void)?
+ 
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.passwordTextField.delegate = self;
+        self.localizedLanguage()
+        
+        if self.appearanceData == nil {
+            self.appearanceData = DSignatureApperanceManager.manager.getLastDSignatureAppearanceData()
+        }
+        self.reloadSignatures()
+    }
+    
+    //MARK: Setter
+    var cert: KMDSignatureModel? {
+        set {
+            _cert = newValue
+        }
+        get {
+            return _cert
+        }
+    }
+    
+    var appearanceData: DSignatureAppearanceData? {
+        set {
+            _appearanceData = newValue
+            if _appearanceData.appearanceName.length > 0 && _appearanceData.appearanceName as String == NSLocalizedString("Standard Text", comment: "") {
+                self.deleteButton.isEnabled = false
+                self.editButton.isEnabled = false
+            } else {
+                self.deleteButton.isEnabled = true
+                self.editButton.isEnabled = true
+            }
+        }
+        get {
+            return _appearanceData
+        }
+    }
+    
+    var signatureWidget: CPDFSignatureWidgetAnnotation? {
+        set {
+            _signatureWidget = newValue
+        }
+        get {
+            return _signatureWidget
+        }
+    }
+    
+    //MARK: Method
+    
+    func reloadSignatures () {
+        
+        self.appearanceButton.removeAllItems()
+
+        let datas = DSignatureApperanceManager.manager.loadDSignatureAppearanceDatas()
+        
+        var dex = 0;
+        let titles = NSMutableArray.init()
+        
+        if datas.count > 0 {
+            for i in 0...datas.count-1 {
+                let data = datas[i] as! DSignatureAppearanceData
+                if data.appearanceName.isEqual(to: self.appearanceData?.appearanceName) {
+                    dex = i
+                }
+                titles.add(data.appearanceName as Any)
+            }
+        }
+        self.errorLabel.isHidden = true
+        
+        self.appearanceButton.addItems(withTitles: titles as! [String])
+        self.appearanceButton.selectItem(at: dex)
+        self.appearanceData = datas[dex] as? DSignatureAppearanceData
+        
+        if self.appearanceData?.isInputDSignatureText == false {
+            self.appearanceData?.signatureConfig.text = _cert.name;
+        }
+        
+        if self.cert?.isFormKeyChain == true {
+            self.passwordBox.isHidden = true;
+        } else {
+            self.passwordBox.isHidden = false;
+        }
+        
+        self.reloadData()
+    }
+    
+    
+    func reloadData() {
+        
+        self.config = CPDFSignatureConfig.init()
+        self.config.isDrawKey = self.appearanceData!.signatureConfig.isDrawKey
+        self.config.isDrawLogo = self.appearanceData!.signatureConfig.isDrawLogo
+        self.config.isContentAlginLeft = self.appearanceData!.signatureConfig.isContentAlginLeft
+        
+        var textStr = ""
+        if self.appearanceData?.signatureConfig.text != nil {
+            if (self.appearanceData?.signatureConfig.text.count)! > 0 {
+                textStr = (self.appearanceData?.signatureConfig.text)!
+            }
+        }
+        if (textStr.count > 0) {
+            self.config.text = self.cert?.name
+        } else if (self.appearanceData!.signatureConfig.image != nil) {
+            self.config.image = self.appearanceData!.signatureConfig.image
+        } else {
+            self.config.text = nil
+            self.config.image = nil
+            self.config.isDrawOnlyContent = true
+        }
+        self.config.logo = self.appearanceData!.signatureConfig.logo;
+
+        let contens = NSMutableArray.init()
+        for configItem in self.appearanceData!.signatureConfig.contents {
+            if configItem.key == NAME_KEY && !_cert.name.isEmpty {
+                let tConfigItem = CPDFSignatureConfigItem.init()
+                tConfigItem.key = configItem.key
+                tConfigItem.value = self.cert?.name
+                contens.add(tConfigItem)
+            } else if configItem.key == DN_KEY && !_cert.dn.isEmpty {
+                let tConfigItem = CPDFSignatureConfigItem.init()
+                tConfigItem.key = configItem.key
+                tConfigItem.value = _cert.dn
+                contens.add(tConfigItem)
+            } else if configItem.key == REASON_KEY {
+                let tConfigItem = CPDFSignatureConfigItem.init()
+                tConfigItem.key = configItem.key
+                tConfigItem.value = configItem.value
+                contens.add(tConfigItem)
+            } else if configItem.key == LOCATION_KEY {
+                let tConfigItem = CPDFSignatureConfigItem.init()
+                tConfigItem.key = configItem.key
+                tConfigItem.value = configItem.value
+                contens.add(tConfigItem)
+            } else if configItem.key == NSLocalizedString(DATE_KEY, comment: "") {
+                let tConfigItem = CPDFSignatureConfigItem.init()
+                tConfigItem.key = configItem.key
+                
+                let dateFormatter = DateFormatter.init()
+                dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
+                tConfigItem.value = dateFormatter.string(from: NSDate() as Date)
+                contens.add(tConfigItem)
+            } else if configItem.key == VERSION_KEY && _cert.name.isEmpty == false {
+                let tConfigItem = CPDFSignatureConfigItem.init()
+                                tConfigItem.key = configItem.key
+                
+                let infoDictionary = NSMutableDictionary(dictionary: Bundle.main.infoDictionary!)
+                CFShow(infoDictionary)
+                let app_Version = infoDictionary.object(forKey: "CFBundleShortVersionString")
+                tConfigItem.value = app_Version as? String
+                
+                contens.add(tConfigItem)
+            }
+        }
+        
+        self.config.contents = contens as? [CPDFSignatureConfigItem]
+        self.signatureWidget?.signAppearanceConfig(self.config)
+        self.drawImageView.image = self.signatureWidget?.contentImage()
+    }
+    
+    func updateTextFiedState () {
+        self.passwordTextField.layer?.borderColor = NSColor.systemRed.cgColor;
+    }
+    
+    func localizedLanguage () {
+        
+        self.contendView.wantsLayer = true
+        self.contendView.layer?.backgroundColor = NSColor.clear.cgColor
+        
+        if self.cert?.name != nil {
+            self.titleLabel.stringValue = NSLocalizedString("Sign as", comment: "") + " " + (self.cert?.name)!
+        } else {
+            self.titleLabel.stringValue = NSLocalizedString("Sign as", comment: "") 
+        }
+    
+        self.appearanceLabel.stringValue = NSLocalizedString("Appearance", comment: "") + ":"
+        self.passwordTextField.placeholderString = NSLocalizedString("Enter the digital signature ID card PIN or password", comment: "")
+        
+        self.passwordLabel.stringValue = NSLocalizedString("Password", comment: "") + ":"
+
+        self.editButton.toolTip = NSLocalizedString("Edit", comment: "")
+        self.createButton.toolTip = NSLocalizedString("Create", comment: "")
+        self.deleteButton.toolTip = NSLocalizedString("Delete", comment: "")
+        
+        self.continueButton.title = NSLocalizedString("Continue", comment: "");
+        self.cancelButton.title = NSLocalizedString("Previous Step",comment: "");
+        self.infoButton.title = NSLocalizedString("View Certificate Details",comment: "");
+        self.lockDocButton.title = NSLocalizedString("Lock document after signing", comment: "");
+        
+        let txtColor = KMAppearance.Interactive.a0Color()
+        self.infoButton.setTitleColor(txtColor)
+        
+        self.lockDocButton.isHidden = true
+        
+        self.createButton.wantsLayer = true
+        self.editButton.wantsLayer = true
+        self.deleteButton.wantsLayer = true
+        
+        self.createButton.layer?.borderWidth = 0.5
+        self.editButton.layer?.borderWidth = 0.5
+        self.deleteButton.layer?.borderWidth = 0.5
+        
+        self.createButton.layer?.cornerRadius = 5
+        self.editButton.layer?.cornerRadius = 5
+        self.deleteButton.layer?.cornerRadius = 5
+        
+        self.createButton.layer?.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1).cgColor
+        self.editButton.layer?.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1).cgColor
+        self.deleteButton.layer?.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1).cgColor
+
+        let creatFileLayer = CALayer()
+        creatFileLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.createButton.bounds), CGRectGetHeight(self.createButton.bounds));
+        self.createButton.layer?.addSublayer(creatFileLayer)
+        
+        let editFileLayer = CALayer()
+        editFileLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.editButton.bounds), CGRectGetHeight(self.editButton.bounds));
+        self.editButton.layer?.addSublayer(editFileLayer)
+        
+        let deleteFileLayer = CALayer()
+        deleteFileLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.deleteButton.bounds), CGRectGetHeight(self.deleteButton.bounds));
+        self.deleteButton.layer?.addSublayer(deleteFileLayer)
+        
+        self.titleLabel.textColor = NSColor.labelColor
+        self.appearanceLabel.textColor = NSColor.labelColor
+        self.passwordLabel.textColor = NSColor.labelColor
+        self.passwordTextField.textColor = NSColor.labelColor
+        
+        self.drawBox.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1)
+
+        self.passwordTextField.wantsLayer = true
+        self.passwordTextField.layer?.borderWidth = 1.0
+        self.passwordTextField.layer?.cornerRadius = 5.0
+        self.passwordTextField.placeholderString = NSLocalizedString("Enter the Digital ID PIN or Password...", comment: "")
+        self.passwordTextField.updateState(false)
+        
+        self.errorLabel.stringValue = NSLocalizedString("Password is incorrect. Please re-enter the password.", comment: "")
+
+    }
+    
+    
+    //MARK: IBAction
+    @IBAction func buttonItemClick_Appearence(_ sender: NSPopUpButton) {
+        self.appearanceButton.title = sender.title;
+        
+        let datas = DSignatureApperanceManager.manager.loadDSignatureAppearanceDatas()
+        self.appearanceData = datas.object(at: self.appearanceButton.indexOfSelectedItem) as? DSignatureAppearanceData
+        if self.appearanceData?.isInputDSignatureText == false {
+            self.appearanceData?.signatureConfig.text = _cert.name
+        }
+        self.reloadData()
+    }
+    
+    @IBAction func buttonItemClick_Creat(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .create, self.appearanceData!, self.config, "", self.isLock)
+    }
+    
+    @IBAction func buttonItemClick_Edit(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .edit, self.appearanceData!, self.config, "", self.isLock)
+    }
+    
+    @IBAction func buttonItemClick_Delete(_ sender: Any) {
+        _ = DSignatureApperanceManager.manager.removeDSignatureAppearanceData(watermark: self.appearanceData!)
+        
+        let datas = DSignatureApperanceManager.manager.loadDSignatureAppearanceDatas() as! [DSignatureAppearanceData]
+        let titles = NSMutableArray()
+        for i in 0..<datas.count {
+            let data = datas[i]
+            if data.appearanceName.length > 0 {
+                titles.add(data.appearanceName as Any)
+            }
+        }
+        self.appearanceButton.removeAllItems()
+        self.appearanceButton.addItems(withTitles: titles as! [String])
+        self.appearanceButton.selectItem(at: 0)
+        self.appearanceData = datas.first
+        self.reloadData()
+        
+    }
+    
+    @IBAction func lockDocumentButtonAction(_ sender: NSButton) {
+        self.isLock = true
+    }
+    
+    @IBAction func buttonItemViewDetail(_ sender: NSButton) {
+        var filePath: String = ""
+        var save: Bool = true
+        var password: String = ""
+        
+        if self.cert!.isFormKeyChain == true {
+            let folderPath = kDSignatureFolderPath
+            if FileManager.default.fileExists(atPath: folderPath) == false {
+                let success: ()? = try?FileManager.default.createDirectory(atPath: folderPath, withIntermediateDirectories: false)
+                if success == nil {
+                    save = false
+                }
+            }
+            filePath = kDSignatureFolderPath.appending("/KMDSignatures.p12") as String
+            save = KMDSignatureManager.exportKeyChain(withP12FilePath: filePath as String?, signatureModel: self.cert, passWord: password as String?)
+            self.cert?.filePath = filePath as String
+        } else {
+            password = self.passwordTextField.stringValue
+            filePath = (self.cert?.filePath)!
+        }
+        if save {
+            let certificate = CPDFSignatureCertificate(pkcs12Path: filePath, password: password)
+            if certificate != nil {
+                let signatureDetailVC = DSignatureDetailsViewController.init()
+                signatureDetailVC.isDigitalFile = ((self.cert?.isFormKeyChain) == nil)
+                signatureDetailVC.certificates = [certificate!]
+                self.presentAsSheet(signatureDetailVC)
+                return
+            }
+        }
+        let alert = NSAlert.init()
+        alert.messageText = NSLocalizedString("Failed to get certificate details!", comment: "")
+        alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+        alert.runModal()
+        
+    }
+    
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, self.appearanceData!, self.config, "", self.isLock)
+    }
+    
+    @IBAction func cancelAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, self.appearanceData!, self.config, "", self.isLock)
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        
+        if self.cert?.isFormKeyChain == true {
+            DSignatureApperanceManager.manager.saveDSignatureAppearanceData(watermark: self.appearanceData!)
+            callBack(self, .confirm, self.appearanceData!, self.config, self.passwordTextField.stringValue, self.isLock)
+        } else {
+            let certificate = CPDFSignatureCertificate(pkcs12Path: self.cert?.filePath, password: self.passwordTextField.stringValue)
+            if certificate == nil {
+                self.errorLabel.isHidden = false
+                self.passwordTextField.updateState(true)
+            } else {
+                DSignatureApperanceManager.manager.saveDSignatureAppearanceData(watermark: self.appearanceData!)
+                callBack(self, .confirm, self.appearanceData!, self.config, self.passwordTextField.stringValue, self.isLock)
+            }
+        }
+    }
+    
+    
+    //MARK: NSTextFieldDelegate
+    func controlTextDidChange(_ obj: Notification) {
+        if obj.object == nil {
+            return
+        }
+        let textField = obj.object as! NSTextField
+        if self.passwordTextField.isEqual(textField) {
+            self.errorLabel.isHidden = true
+        }
+        
+        self.passwordTextField.updateState(false)
+    }
+    
+    
+}

+ 287 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCertifyDetailViewController.xib

@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureCertifyDetailViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="appearanceButton" destination="b1o-Cn-AgX" id="611-IU-juk"/>
+                <outlet property="appearanceLabel" destination="ehf-i0-b7M" id="iYD-yz-9tR"/>
+                <outlet property="cancelButton" destination="Oie-xM-gLR" id="SJh-9b-pNW"/>
+                <outlet property="closeButton" destination="yy9-y6-k6V" id="8yT-Be-qX0"/>
+                <outlet property="contendView" destination="kiO-SJ-P6W" id="5G3-yG-YIU"/>
+                <outlet property="continueButton" destination="mDt-4v-bdg" id="UPf-TK-n1i"/>
+                <outlet property="createButton" destination="gE8-Js-IPU" id="Zf5-Cb-kkc"/>
+                <outlet property="deleteButton" destination="nwT-ft-sQV" id="h0m-aT-8VC"/>
+                <outlet property="drawBox" destination="FER-ai-YFe" id="HCX-3A-bMw"/>
+                <outlet property="drawImageView" destination="2sj-qT-Tkn" id="bAg-4U-atv"/>
+                <outlet property="editButton" destination="lUm-6D-N34" id="cgf-iR-ayS"/>
+                <outlet property="errorLabel" destination="omZ-sg-pvz" id="83I-It-BXY"/>
+                <outlet property="infoButton" destination="72V-1A-K8N" id="YTH-ue-gih"/>
+                <outlet property="lockDocButton" destination="cur-i7-MJ7" id="zla-2F-4ea"/>
+                <outlet property="passwordBox" destination="XHe-g6-mw0" id="LVd-Qb-Sbc"/>
+                <outlet property="passwordLabel" destination="AN6-C2-sFG" id="gPN-ZM-iZ2"/>
+                <outlet property="passwordTextField" destination="nrP-Bg-9Um" id="tf7-rP-mLd"/>
+                <outlet property="titleLabel" destination="uCZ-1k-Gfy" id="rgu-ZG-dG8"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="608" height="450"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="kiO-SJ-P6W">
+                    <rect key="frame" x="0.0" y="0.0" width="608" height="450"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uCZ-1k-Gfy">
+                            <rect key="frame" x="22" y="399" width="59" height="19"/>
+                            <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Sign as" id="ynh-H2-3Ro">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="yy9-y6-k6V">
+                            <rect key="frame" x="568" y="401" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="overlaps" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="4Ap-TK-keS">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="XWh-Y1-3Fi"/>
+                            </connections>
+                        </button>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ehf-i0-b7M">
+                            <rect key="frame" x="22" y="354" width="89" height="17"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Appearance:" id="TVG-oH-c6W">
+                                <font key="font" metaFont="systemMedium" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="b1o-Cn-AgX">
+                            <rect key="frame" x="112" y="345" width="319" height="35"/>
+                            <popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="fBt-Ds-Zul">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="menu"/>
+                                <menu key="menu" id="bLX-hh-udC"/>
+                            </popUpButtonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="RPQ-EK-1Zy"/>
+                            </constraints>
+                            <connections>
+                                <action selector="buttonItemClick_Appearence:" target="-2" id="ePr-6m-Ot5"/>
+                            </connections>
+                        </popUpButton>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gE8-Js-IPU" customClass="KMButton">
+                            <rect key="frame" x="448" y="349" width="40" height="28"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatAddAppearance" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="e4c-ug-29m">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="S8U-eJ-TB1"/>
+                                <constraint firstAttribute="width" constant="40" id="r71-is-qgY"/>
+                            </constraints>
+                            <connections>
+                                <action selector="buttonItemClick_Creat:" target="-2" id="oWl-qI-Nab"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nwT-ft-sQV" customClass="KMButton">
+                            <rect key="frame" x="544" y="349" width="40" height="28"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatDeleteAppearance" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="aHI-ug-IZD">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="ESW-Q5-KOs"/>
+                                <constraint firstAttribute="width" constant="40" id="yCm-gI-4H3"/>
+                            </constraints>
+                            <connections>
+                                <action selector="buttonItemClick_Delete:" target="-2" id="nRq-Im-4DJ"/>
+                            </connections>
+                        </button>
+                        <box boxType="custom" cornerRadius="8" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="FER-ai-YFe">
+                            <rect key="frame" x="24" y="153" width="560" height="180"/>
+                            <view key="contentView" id="8ZX-6t-RAG">
+                                <rect key="frame" x="1" y="1" width="558" height="178"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2sj-qT-Tkn">
+                                        <rect key="frame" x="0.0" y="0.0" width="558" height="178"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="DK9-zO-9v2"/>
+                                    </imageView>
+                                </subviews>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="180" id="0Jl-Uy-u3g"/>
+                            </constraints>
+                            <color key="fillColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cur-i7-MJ7">
+                            <rect key="frame" x="22" y="126.5" width="188" height="18"/>
+                            <buttonCell key="cell" type="check" title="Lock document after signing" bezelStyle="regularSquare" imagePosition="left" inset="2" id="8zr-Ql-4xi">
+                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                <font key="font" metaFont="cellTitle"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="lockDocumentButtonAction:" target="-2" id="bJz-5m-yPi"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="72V-1A-K8N">
+                            <rect key="frame" x="429" y="126" width="155" height="17"/>
+                            <buttonCell key="cell" type="bevel" title="View Certificate Details" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="s6i-2W-qYh">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system" size="14"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="buttonItemViewDetail:" target="-2" id="HFN-r6-shK"/>
+                            </connections>
+                        </button>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="XHe-g6-mw0">
+                            <rect key="frame" x="24" y="86" width="560" height="28"/>
+                            <view key="contentView" id="DCU-Ko-d06">
+                                <rect key="frame" x="0.0" y="0.0" width="560" height="28"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AN6-C2-sFG">
+                                        <rect key="frame" x="-2" y="5" width="68" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Password" id="8sM-uG-QS0">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nrP-Bg-9Um">
+                                        <rect key="frame" x="70" y="0.0" width="490" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="kjn-bK-nYH"/>
+                                        </constraints>
+                                        <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" drawsBackground="YES" usesSingleLineMode="YES" id="Hdx-qM-CQd" customClass="KMVerticallySecureTextFieldCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <allowedInputSourceLocales>
+                                                <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+                                            </allowedInputSourceLocales>
+                                        </secureTextFieldCell>
+                                    </secureTextField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="AN6-C2-sFG" firstAttribute="centerY" secondItem="DCU-Ko-d06" secondAttribute="centerY" id="39Z-DA-XhE"/>
+                                    <constraint firstItem="nrP-Bg-9Um" firstAttribute="leading" secondItem="AN6-C2-sFG" secondAttribute="trailing" constant="6" id="GmG-rp-6U3"/>
+                                    <constraint firstAttribute="trailing" secondItem="nrP-Bg-9Um" secondAttribute="trailing" id="OvR-wF-Eh1"/>
+                                    <constraint firstItem="AN6-C2-sFG" firstAttribute="leading" secondItem="DCU-Ko-d06" secondAttribute="leading" id="b1X-92-Am5"/>
+                                    <constraint firstItem="nrP-Bg-9Um" firstAttribute="centerY" secondItem="DCU-Ko-d06" secondAttribute="centerY" id="iea-fc-cvU"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="cgc-Xk-Xin"/>
+                            </constraints>
+                        </box>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="omZ-sg-pvz">
+                            <rect key="frame" x="22" y="60" width="153" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Passwords do not match" id="hbN-R1-fCG">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" red="0.74901960779999999" green="0.18823529410000001" blue="0.18823529410000001" alpha="1" colorSpace="calibratedRGB"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Oie-xM-gLR">
+                            <rect key="frame" x="421" y="22" width="74" height="40"/>
+                            <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="bUK-5v-6RQ">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="cancelAction:" target="-2" id="ZJ6-33-MKy"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mDt-4v-bdg">
+                            <rect key="frame" x="503" y="22" width="87" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Pxw-aE-MTT">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="Oys-Qb-O5f"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lUm-6D-N34" customClass="KMButton">
+                            <rect key="frame" x="496" y="349" width="40" height="28"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatEditAppearance" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="B0t-Op-BQX">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="0x6-ff-4Oc"/>
+                                <constraint firstAttribute="width" constant="40" id="C1Q-uk-saj"/>
+                            </constraints>
+                            <connections>
+                                <action selector="buttonItemClick_Edit:" target="-2" id="SKc-Vf-qIv"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="gE8-Js-IPU" firstAttribute="leading" secondItem="b1o-Cn-AgX" secondAttribute="trailing" constant="20" id="1Rs-aH-w1c"/>
+                        <constraint firstAttribute="trailing" secondItem="FER-ai-YFe" secondAttribute="trailing" constant="24" id="2BR-FJ-bbr"/>
+                        <constraint firstItem="nwT-ft-sQV" firstAttribute="centerY" secondItem="ehf-i0-b7M" secondAttribute="centerY" id="3B9-ZR-eoI"/>
+                        <constraint firstItem="lUm-6D-N34" firstAttribute="leading" secondItem="gE8-Js-IPU" secondAttribute="trailing" constant="8" id="4Pj-B6-FDD"/>
+                        <constraint firstItem="FER-ai-YFe" firstAttribute="leading" secondItem="kiO-SJ-P6W" secondAttribute="leading" constant="24" id="9nd-KK-qp9"/>
+                        <constraint firstItem="FER-ai-YFe" firstAttribute="top" secondItem="b1o-Cn-AgX" secondAttribute="bottom" constant="16" id="Af6-CC-ZHS"/>
+                        <constraint firstItem="nwT-ft-sQV" firstAttribute="leading" secondItem="lUm-6D-N34" secondAttribute="trailing" constant="8" id="BOa-xO-qjh"/>
+                        <constraint firstAttribute="trailing" secondItem="mDt-4v-bdg" secondAttribute="trailing" constant="24" id="IGg-Tz-2SA"/>
+                        <constraint firstAttribute="trailing" secondItem="XHe-g6-mw0" secondAttribute="trailing" constant="24" id="J7K-rr-0SW"/>
+                        <constraint firstItem="omZ-sg-pvz" firstAttribute="leading" secondItem="kiO-SJ-P6W" secondAttribute="leading" constant="24" id="Jnt-yw-Dkl"/>
+                        <constraint firstAttribute="trailing" secondItem="nwT-ft-sQV" secondAttribute="trailing" constant="24" id="N3l-rX-1W7"/>
+                        <constraint firstItem="omZ-sg-pvz" firstAttribute="top" secondItem="XHe-g6-mw0" secondAttribute="bottom" constant="10" id="QHG-n2-g8d"/>
+                        <constraint firstItem="XHe-g6-mw0" firstAttribute="top" secondItem="72V-1A-K8N" secondAttribute="bottom" constant="12" id="RG9-LT-f7a"/>
+                        <constraint firstAttribute="bottom" secondItem="mDt-4v-bdg" secondAttribute="bottom" constant="28" id="SfL-tY-GBq"/>
+                        <constraint firstItem="ehf-i0-b7M" firstAttribute="leading" secondItem="kiO-SJ-P6W" secondAttribute="leading" constant="24" id="Tk1-mQ-f81"/>
+                        <constraint firstItem="yy9-y6-k6V" firstAttribute="centerY" secondItem="uCZ-1k-Gfy" secondAttribute="centerY" id="W3x-bl-5AD"/>
+                        <constraint firstItem="mDt-4v-bdg" firstAttribute="leading" secondItem="Oie-xM-gLR" secondAttribute="trailing" constant="20" id="Wq7-3T-4VZ"/>
+                        <constraint firstItem="mDt-4v-bdg" firstAttribute="centerY" secondItem="Oie-xM-gLR" secondAttribute="centerY" id="ZT0-tb-j49"/>
+                        <constraint firstItem="b1o-Cn-AgX" firstAttribute="leading" secondItem="ehf-i0-b7M" secondAttribute="trailing" constant="6" id="ZnW-7p-OIx"/>
+                        <constraint firstItem="XHe-g6-mw0" firstAttribute="leading" secondItem="kiO-SJ-P6W" secondAttribute="leading" constant="24" id="aoM-kS-ibR"/>
+                        <constraint firstItem="uCZ-1k-Gfy" firstAttribute="leading" secondItem="kiO-SJ-P6W" secondAttribute="leading" constant="24" id="eFa-E8-PB2"/>
+                        <constraint firstItem="cur-i7-MJ7" firstAttribute="top" secondItem="FER-ai-YFe" secondAttribute="bottom" constant="10" id="f9G-gC-Myi"/>
+                        <constraint firstAttribute="trailing" secondItem="72V-1A-K8N" secondAttribute="trailing" constant="24" id="gTh-0x-aM6"/>
+                        <constraint firstItem="uCZ-1k-Gfy" firstAttribute="top" secondItem="kiO-SJ-P6W" secondAttribute="top" constant="32" id="itu-Te-res"/>
+                        <constraint firstAttribute="trailing" secondItem="yy9-y6-k6V" secondAttribute="trailing" constant="24" id="nYf-y3-OVV"/>
+                        <constraint firstItem="ehf-i0-b7M" firstAttribute="top" secondItem="uCZ-1k-Gfy" secondAttribute="bottom" constant="28" id="pwi-UG-nr2"/>
+                        <constraint firstItem="72V-1A-K8N" firstAttribute="top" secondItem="FER-ai-YFe" secondAttribute="bottom" constant="10" id="rs7-r2-RTN"/>
+                        <constraint firstItem="cur-i7-MJ7" firstAttribute="leading" secondItem="kiO-SJ-P6W" secondAttribute="leading" constant="24" id="sfN-v6-eoc"/>
+                        <constraint firstItem="nwT-ft-sQV" firstAttribute="centerY" secondItem="lUm-6D-N34" secondAttribute="centerY" id="t7R-Wi-U7h"/>
+                        <constraint firstItem="lUm-6D-N34" firstAttribute="centerY" secondItem="gE8-Js-IPU" secondAttribute="centerY" id="zTm-sW-nVh"/>
+                        <constraint firstItem="b1o-Cn-AgX" firstAttribute="centerY" secondItem="ehf-i0-b7M" secondAttribute="centerY" id="zvV-L0-977"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="kiO-SJ-P6W" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="OOT-Hx-lQy"/>
+                <constraint firstItem="kiO-SJ-P6W" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="eO3-th-8o2"/>
+                <constraint firstAttribute="trailing" secondItem="kiO-SJ-P6W" secondAttribute="trailing" id="nHZ-xc-GER"/>
+                <constraint firstAttribute="bottom" secondItem="kiO-SJ-P6W" secondAttribute="bottom" id="xba-SL-zg2"/>
+            </constraints>
+            <point key="canvasLocation" x="168" y="124.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatAddAppearance" width="20" height="20"/>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+        <image name="ImageNameDSignatDeleteAppearance" width="20" height="20"/>
+        <image name="ImageNameDSignatEditAppearance" width="20" height="20"/>
+    </resources>
+</document>

+ 291 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateInfoViewController.swift

@@ -0,0 +1,291 @@
+//
+//  DSignatureCreateInfoViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureCreateInfoViewController: NSViewController, NSTextFieldDelegate {
+
+    @IBOutlet weak var contendView: NSView!
+    
+    @IBOutlet weak var titleLabel: NSTextField!
+
+    @IBOutlet weak var nameLabel: NSTextField!
+    @IBOutlet weak var organizationLabel: NSTextField!
+    @IBOutlet weak var organizationUnitLabel: NSTextField!
+    @IBOutlet weak var emailLabel: NSTextField!
+    @IBOutlet weak var countryLabel: NSTextField!
+    @IBOutlet weak var purposeLabel: NSTextField!
+    
+    @IBOutlet weak var nameTextFiled: NSTextField!
+    @IBOutlet weak var organizationTextFiled: NSTextField!
+    @IBOutlet weak var organizationUnitTextFiled: NSTextField!
+    @IBOutlet weak var emailTextFiled: NSTextField!
+    @IBOutlet weak var countryButton: NSPopUpButton!
+    @IBOutlet weak var purposeButton: NSPopUpButton!
+    @IBOutlet weak var errorLabel: NSTextField!
+    
+    @IBOutlet weak var promptBox: NSBox!
+    @IBOutlet var promptTextView: NSTextView!
+    
+    @IBOutlet weak var previousStepButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+
+    @IBOutlet weak var textFieldLeftConst: NSLayoutConstraint!
+    @IBOutlet weak var countryBtnTopConst: NSLayoutConstraint!
+    
+    
+//    @property(nonatomic) IBOutlet NSLayoutConstraint *bottomOffset;
+//
+//    @property(nonatomic) IBOutlet NSLayoutConstraint *leftBottomOffset;
+    
+    var codes: [String] = []
+    var actionBlock: ((_ createVC:DSignatureCreateInfoViewController, _ action:DSignatureActionType, _ cer:NSDictionary, _ certUsage:Int)->Void)?
+    
+    
+    override func viewWillAppear() {
+        super.viewWillAppear()
+        
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.updateButtonState()
+        self.errorLabel.isHidden = true
+        
+        self.nameTextFiled.delegate = self
+        self.emailTextFiled.delegate = self
+        self.organizationTextFiled.delegate = self
+        self.organizationUnitTextFiled.delegate = self
+        
+        self.purposeButton.addItems(withTitles: [NSLocalizedString("Digital Signature", comment: ""),
+                                                 NSLocalizedString("Data Encryption", comment: ""),
+                                                 NSLocalizedString("Digital Signatures and Data Encryption", comment: "")])
+        
+        self.reloadData()
+        
+        self.nameTextFiled.wantsLayer = true
+        self.organizationTextFiled.wantsLayer = true
+        self.organizationUnitTextFiled.wantsLayer = true
+        self.emailTextFiled.wantsLayer = true
+        
+        self.nameTextFiled.layer?.borderWidth = 1.0
+        self.organizationTextFiled.layer?.borderWidth = 1.0
+        self.organizationUnitTextFiled.layer?.borderWidth = 1.0
+        self.emailTextFiled.layer?.borderWidth = 1.0
+        
+        self.nameTextFiled.layer?.cornerRadius = 5.0
+        self.organizationTextFiled.layer?.cornerRadius = 5.0
+        self.organizationUnitTextFiled.layer?.cornerRadius = 5.0
+        self.emailTextFiled.layer?.cornerRadius = 5.0
+        
+        self.organizationTextFiled.layer?.borderColor = NSColor(red: 2.0/255.0, green: 8.0/255.0, blue: 38.0/255.0, alpha: 0.15).cgColor
+        self.organizationUnitTextFiled.layer?.borderColor = NSColor(red: 2.0/255.0, green: 8.0/255.0, blue: 38.0/255.0, alpha: 0.15).cgColor
+        
+        self.localizedLanguage()
+        
+        self.nameTextFiled.layer?.borderColor = NSColor.clear.cgColor
+        self.emailTextFiled.layer?.borderColor = NSColor.clear.cgColor
+    }
+    
+    func reloadData() {
+        
+        var countryCodes = NSLocale.isoCountryCodes 
+        self.codes = countryCodes
+        
+        var codes: [String] = []
+        let localeID = NSLocale.current.identifier
+        let components = NSLocale.components(fromLocaleIdentifier: localeID)
+        let countryCode = components[NSLocale.Key.countryCode.rawValue]
+        
+        for countryCode in countryCodes {
+            let identifier = NSLocale.localeIdentifier(fromComponents: [NSLocale.Key.countryCode.rawValue: countryCode])
+            let local = NSLocale(localeIdentifier: localeID)
+            
+            let country = local.displayName(forKey: NSLocale.Key.identifier, value: identifier)
+            codes.append(String(format: "%@ - %@", countryCode, (country ?? "")))
+        }
+        
+        self.countryButton.addItems(withTitles: codes)
+        
+        for index in 0...countryCodes.count-1 {
+            let cCode = countryCodes[index]
+            if countryCode == cCode {
+                self.countryButton.selectItem(at: index)
+            }
+        }
+        
+        let sud = UserDefaults.standard
+        let loginName = NSFullUserName()
+        if loginName.isEmpty == false {
+            self.nameTextFiled.stringValue = loginName
+        }
+        
+        self.organizationTextFiled.stringValue = sud.string(forKey: CAuthenticationDepartmentKey) ?? ""
+        self.organizationUnitTextFiled.stringValue = sud.string(forKey: CAuthenticationCompanyNameKey) ?? ""
+        self.emailTextFiled.stringValue = sud.string(forKey: CAuthenticationEmailAddressKey) ?? ""
+        
+    }
+    
+    func localizedLanguage() {
+        self.titleLabel.stringValue = NSLocalizedString("Create a Self-signed Digital ID", comment: "")
+        
+        self.nameLabel.stringValue = NSLocalizedString("Name", comment: "")
+        self.organizationLabel.stringValue = NSLocalizedString("Organization Name", comment: "")
+        self.organizationUnitLabel.stringValue = NSLocalizedString("Organization Unit", comment: "")
+        self.emailLabel.stringValue = NSLocalizedString("Email Address", comment: "")
+        self.countryLabel.stringValue = NSLocalizedString("Country/Region", comment: "")
+        self.purposeLabel.stringValue = NSLocalizedString("Purpose", comment: "")
+        
+        var maxLabelWidth = self.nameLabel.sizeThatFits(CGSize(width: 1000, height: self.nameLabel.frame.size.height)).width
+        if self.organizationLabel.sizeThatFits(CGSize(width: 1000, height: self.organizationLabel.frame.size.height)).width > maxLabelWidth {
+            maxLabelWidth = self.organizationLabel.sizeThatFits(CGSize(width: 1000, height: self.organizationLabel.frame.size.height)).width
+        }
+        if self.organizationUnitLabel.sizeThatFits(CGSize(width: 1000, height: self.organizationUnitLabel.frame.size.height)).width > maxLabelWidth {
+            maxLabelWidth = self.organizationUnitLabel.sizeThatFits(CGSize(width: 1000, height: self.organizationUnitLabel.frame.size.height)).width
+        }
+        if self.emailLabel.sizeThatFits(CGSize(width: 1000, height: self.emailLabel.frame.size.height)).width > maxLabelWidth {
+            maxLabelWidth = self.emailLabel.sizeThatFits(CGSize(width: 1000, height: self.emailLabel.frame.size.height)).width
+        }
+        if self.countryLabel.sizeThatFits(CGSize(width: 1000, height: self.countryLabel.frame.size.height)).width > maxLabelWidth {
+            maxLabelWidth = self.countryLabel.sizeThatFits(CGSize(width: 1000, height: self.countryLabel.frame.size.height)).width
+        }
+        if self.purposeLabel.sizeThatFits(CGSize(width: 1000, height: self.purposeLabel.frame.size.height)).width > maxLabelWidth {
+            maxLabelWidth = self.purposeLabel.sizeThatFits(CGSize(width: 1000, height: self.purposeLabel.frame.size.height)).width
+        }
+        if maxLabelWidth < 90 {
+            maxLabelWidth = 90
+        }
+        self.textFieldLeftConst.constant = maxLabelWidth + 10
+
+        self.promptTextView.string = String(format: "%@\n\n%@",NSLocalizedString("Enter the identity information to be used for creating the self-signed digital ID.",  comment: ""), NSLocalizedString("Digital IDs that are self-signed by individuals do not provide the assurance that the identity information is valid. For this reason they may not be accepted in some use cases.", comment: ""))
+        self.nameTextFiled.placeholderString = NSLocalizedString("Enter name...", comment: "");
+        self.errorLabel.stringValue = NSLocalizedString("Email address is not valid", comment: "");
+        self.organizationTextFiled.placeholderString = NSLocalizedString("Enter organization name...", comment: "");
+        self.organizationUnitTextFiled.placeholderString = NSLocalizedString("Enter organization unit...", comment: "");
+        self.emailTextFiled.placeholderString = NSLocalizedString("Enter Email", comment: "");
+
+        self.previousStepButton.title = NSLocalizedString("Previous Step", comment: "");
+        self.continueButton.title = NSLocalizedString("Continue",  comment: "");
+    }
+    
+    func validateEmail(_ strEmail: String) -> Bool {
+        let emailRegex = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"
+        let emailTest: NSPredicate = NSPredicate(format: "SELF MATCHES %@", emailRegex)
+        return emailTest.evaluate(with: strEmail)
+    }
+    
+    func updateButtonState() {
+        if self.nameTextFiled.stringValue.isEmpty == false && self.validateEmail(self.emailTextFiled.stringValue) {
+            self.continueButton.isEnabled = true
+        } else {
+            self.continueButton.isEnabled = false
+        }
+    }
+    
+    func updateTextFiedState() {
+        if self.nameTextFiled.stringValue.isEmpty == false {
+            self.nameTextFiled.updateState(false)
+        } else {
+            self.nameTextFiled.updateState(true)
+        }
+        
+        if self.emailTextFiled.stringValue.isEmpty == false {
+            self.emailTextFiled.updateState(false)
+        } else {
+            self.emailTextFiled.updateState(true)
+        }
+    }
+    
+    
+    //MARK: IBAction
+    
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, NSDictionary(), 0)
+    }
+    
+    @IBAction func previousAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, NSDictionary(), 0)
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        self.view.window?.makeFirstResponder(nil)
+        
+        if self.validateEmail(self.emailTextFiled.stringValue) == false {
+            return
+        }
+        
+        let cer = NSMutableDictionary.init()
+        
+        cer.setValue(self.nameTextFiled.stringValue, forKey: "CN")
+        cer.setObject(self.emailTextFiled.stringValue, forKey: "emailAddress" as NSCopying)
+        if self.codes.count > self.countryButton.indexOfSelectedItem {
+            let string = self.codes[self.countryButton.indexOfSelectedItem]
+            cer.setValue(string, forKey: "C")
+        }
+        if self.organizationTextFiled.stringValue.isEmpty == false {
+            cer.setValue(self.organizationTextFiled.stringValue, forKey: "O")
+        }
+        if self.organizationUnitTextFiled.stringValue.isEmpty == false {
+            cer.setValue(self.organizationUnitTextFiled.stringValue, forKey: "OU")
+        }
+        
+        let dex = self.purposeButton.index(of: self.purposeButton.selectedItem!)
+        
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .confirm, cer, dex)
+    }
+    
+    //MARK: NSTextFieldDelegate
+    func controlTextDidChange(_ obj: Notification) {
+
+        self.updateButtonState()
+        
+        if obj.object == nil {
+            return
+        }
+            
+        let textField = obj.object as! NSTextField
+        if self.emailTextFiled.isEqual(textField) ||
+            self.nameTextFiled.isEqual(textField) {
+            if (textField.stringValue.isEmpty == false) {
+                textField.updateState(false)
+            } else {
+                textField.updateState(true)
+            }
+        }
+        
+        if self.emailTextFiled.isEqual(textField) {
+            self.errorLabel.isHidden = true
+            
+            self.countryBtnTopConst.constant = 16.0;
+        }
+    }
+
+    func controlTextDidEndEditing(_ obj: Notification) {
+
+        let fied: NSTextField = obj.object as! NSTextField;
+        if fied.isEqual(self.emailTextFiled) {
+            if self.validateEmail(self.emailTextFiled.stringValue) == true {
+                self.errorLabel.isHidden = true
+                self.countryBtnTopConst.constant = 16.0;
+            } else {
+                self.errorLabel.isHidden = false;
+                self.countryBtnTopConst.constant = self.errorLabel.frame.size.height + 12;
+            }
+        }
+    }
+}

+ 359 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateInfoViewController.xib

@@ -0,0 +1,359 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureCreateInfoViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="contendView" destination="hY4-zY-c9z" id="ZYH-hi-9Cb"/>
+                <outlet property="continueButton" destination="dSu-Sg-ba6" id="Ka7-RD-2gL"/>
+                <outlet property="countryBtnTopConst" destination="cjB-eh-0GU" id="iul-Df-S3V"/>
+                <outlet property="countryButton" destination="gi8-tp-KZz" id="a5z-Eg-lhS"/>
+                <outlet property="countryLabel" destination="fap-ni-Cyz" id="dow-He-tDt"/>
+                <outlet property="emailLabel" destination="S11-dh-p5R" id="OC1-mk-e2w"/>
+                <outlet property="emailTextFiled" destination="nSk-el-cio" id="Jvh-UC-BL6"/>
+                <outlet property="errorLabel" destination="6b9-8s-f24" id="Uwd-1U-oE3"/>
+                <outlet property="nameLabel" destination="EJn-Nh-AJt" id="yQT-Tp-Agk"/>
+                <outlet property="nameTextFiled" destination="UV2-e0-2WR" id="ydx-xz-sJC"/>
+                <outlet property="organizationLabel" destination="SzB-Zi-l4g" id="7Oq-er-u7B"/>
+                <outlet property="organizationTextFiled" destination="ugH-nQ-Rb3" id="s2R-gv-cV8"/>
+                <outlet property="organizationUnitLabel" destination="tlM-EQ-Ffb" id="AiE-e9-aHI"/>
+                <outlet property="organizationUnitTextFiled" destination="ONY-EY-Mq8" id="0y2-wv-ueJ"/>
+                <outlet property="previousStepButton" destination="YT7-wP-rmf" id="8Fc-Mn-TqX"/>
+                <outlet property="promptBox" destination="b94-Iz-pLJ" id="1cC-SF-0K4"/>
+                <outlet property="promptTextView" destination="uSw-H3-Zk5" id="XQh-7R-IcA"/>
+                <outlet property="purposeButton" destination="oOZ-Jr-OyY" id="PKi-S6-Kxh"/>
+                <outlet property="purposeLabel" destination="26J-28-Waw" id="NlW-QB-26E"/>
+                <outlet property="textFieldLeftConst" destination="U00-Cf-yKe" id="DsJ-YI-UWo"/>
+                <outlet property="titleLabel" destination="qVw-t6-1Hc" id="z4O-2e-71Q"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="698" height="507"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="hY4-zY-c9z">
+                    <rect key="frame" x="0.0" y="0.0" width="698" height="507"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qVw-t6-1Hc">
+                            <rect key="frame" x="18" y="464" width="226" height="19"/>
+                            <textFieldCell key="cell" title="Create a self-signed Digital ID" id="cHq-86-0cb">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="qAc-a5-zV7">
+                            <rect key="frame" x="662" y="466" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="8VJ-h2-HZ9">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="SeP-YL-20E"/>
+                            </connections>
+                        </button>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="FWE-0s-1Hs">
+                            <rect key="frame" x="20" y="179" width="658" height="270"/>
+                            <view key="contentView" id="DnG-rP-VC1">
+                                <rect key="frame" x="0.0" y="0.0" width="658" height="270"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yV3-Zo-OMM">
+                                        <rect key="frame" x="89" y="249" width="11" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="*" id="ZOw-Uz-U3b">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A25-Lp-T28">
+                                        <rect key="frame" x="89" y="119" width="11" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="*" id="iDH-FH-0b9">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EJn-Nh-AJt">
+                                        <rect key="frame" x="-2" y="248" width="94" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Name" id="DO3-Xb-Tgb">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UV2-e0-2WR">
+                                        <rect key="frame" x="100" y="242" width="558" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="9NN-iE-ayQ"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" drawsBackground="YES" id="TVe-GA-GqM" customClass="KMTextFieldCenterCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SzB-Zi-l4g">
+                                        <rect key="frame" x="-2" y="204" width="94" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Organization Name" id="Gvn-kO-HmY">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ugH-nQ-Rb3">
+                                        <rect key="frame" x="100" y="198" width="558" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="pSz-6O-9Y1"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" drawsBackground="YES" id="54y-uw-u0e" customClass="KMTextFieldCenterCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tlM-EQ-Ffb">
+                                        <rect key="frame" x="-2" y="160" width="94" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Organization Unit" id="TX5-Pc-JqM">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ONY-EY-Mq8">
+                                        <rect key="frame" x="100" y="154" width="558" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="wax-Ii-3IH"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" drawsBackground="YES" id="F3R-7I-wsH" customClass="KMTextFieldCenterCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S11-dh-p5R">
+                                        <rect key="frame" x="52" y="116" width="40" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Email" id="g8B-ni-Wpe">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nSk-el-cio">
+                                        <rect key="frame" x="100" y="110" width="558" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="pT3-WA-24L"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" drawsBackground="YES" id="fEl-QH-9tW" customClass="KMTextFieldCenterCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6b9-8s-f24">
+                                        <rect key="frame" x="98" y="89" width="157" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Email address is not valid" id="Mxt-a3-dWJ">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" red="0.74901960779999999" green="0.18823529410000001" blue="0.18823529410000001" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fap-ni-Cyz">
+                                        <rect key="frame" x="-2" y="72" width="94" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Country/Region" id="c5E-Ja-eU0">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="gi8-tp-KZz">
+                                        <rect key="frame" x="97" y="62" width="564" height="35"/>
+                                        <popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3Tt-p7-hD2">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="9B3-kl-4lu"/>
+                                        </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="O7s-hq-bLb"/>
+                                        </constraints>
+                                    </popUpButton>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="26J-28-Waw">
+                                        <rect key="frame" x="32" y="28" width="60" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Purpose" id="wus-VQ-ObE">
+                                            <font key="font" metaFont="systemMedium" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="oOZ-Jr-OyY">
+                                        <rect key="frame" x="97" y="18" width="564" height="35"/>
+                                        <popUpButtonCell key="cell" type="bevel" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="dvt-un-YZJ">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="Uyx-qS-zp9"/>
+                                        </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="Mwr-78-tz5"/>
+                                        </constraints>
+                                    </popUpButton>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="oOZ-Jr-OyY" firstAttribute="leading" secondItem="gi8-tp-KZz" secondAttribute="leading" id="159-AD-3zk"/>
+                                    <constraint firstItem="EJn-Nh-AJt" firstAttribute="leading" secondItem="DnG-rP-VC1" secondAttribute="leading" id="1do-kh-Ssy"/>
+                                    <constraint firstItem="gi8-tp-KZz" firstAttribute="leading" secondItem="fap-ni-Cyz" secondAttribute="trailing" constant="10" id="2fs-Xl-1eN"/>
+                                    <constraint firstItem="ONY-EY-Mq8" firstAttribute="top" secondItem="ugH-nQ-Rb3" secondAttribute="bottom" constant="16" id="46S-Ff-paa"/>
+                                    <constraint firstItem="oOZ-Jr-OyY" firstAttribute="leading" secondItem="26J-28-Waw" secondAttribute="trailing" constant="10" id="4Dr-gZ-dsx"/>
+                                    <constraint firstItem="tlM-EQ-Ffb" firstAttribute="centerY" secondItem="ONY-EY-Mq8" secondAttribute="centerY" id="4ED-LP-XGh"/>
+                                    <constraint firstItem="EJn-Nh-AJt" firstAttribute="centerY" secondItem="UV2-e0-2WR" secondAttribute="centerY" id="50a-zx-Iww"/>
+                                    <constraint firstItem="nSk-el-cio" firstAttribute="leading" secondItem="S11-dh-p5R" secondAttribute="trailing" constant="10" id="6r1-5V-sLu"/>
+                                    <constraint firstItem="ugH-nQ-Rb3" firstAttribute="leading" secondItem="UV2-e0-2WR" secondAttribute="leading" id="9eP-IH-3kb"/>
+                                    <constraint firstItem="ugH-nQ-Rb3" firstAttribute="top" secondItem="UV2-e0-2WR" secondAttribute="bottom" constant="16" id="B9L-Us-mIM"/>
+                                    <constraint firstItem="UV2-e0-2WR" firstAttribute="top" secondItem="DnG-rP-VC1" secondAttribute="top" id="Bmm-gr-zTc"/>
+                                    <constraint firstItem="tlM-EQ-Ffb" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="DnG-rP-VC1" secondAttribute="leading" id="Gbi-Vj-kxc"/>
+                                    <constraint firstItem="SzB-Zi-l4g" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="DnG-rP-VC1" secondAttribute="leading" id="IXB-Ob-x7t"/>
+                                    <constraint firstItem="ONY-EY-Mq8" firstAttribute="leading" secondItem="tlM-EQ-Ffb" secondAttribute="trailing" constant="10" id="JfS-4A-RKa"/>
+                                    <constraint firstItem="6b9-8s-f24" firstAttribute="leading" secondItem="nSk-el-cio" secondAttribute="leading" id="Jjb-KH-FTq"/>
+                                    <constraint firstItem="26J-28-Waw" firstAttribute="centerY" secondItem="oOZ-Jr-OyY" secondAttribute="centerY" id="Jlz-ml-u0d"/>
+                                    <constraint firstItem="ugH-nQ-Rb3" firstAttribute="leading" secondItem="SzB-Zi-l4g" secondAttribute="trailing" constant="10" id="M40-zB-9nb"/>
+                                    <constraint firstItem="oOZ-Jr-OyY" firstAttribute="top" secondItem="gi8-tp-KZz" secondAttribute="bottom" constant="16" id="MQs-e9-8Sf"/>
+                                    <constraint firstAttribute="trailing" secondItem="UV2-e0-2WR" secondAttribute="trailing" id="Pci-ML-xz5"/>
+                                    <constraint firstAttribute="trailing" secondItem="oOZ-Jr-OyY" secondAttribute="trailing" id="Rcl-SS-hRn"/>
+                                    <constraint firstItem="6b9-8s-f24" firstAttribute="top" secondItem="nSk-el-cio" secondAttribute="bottom" constant="5" id="TmK-JF-Cnr"/>
+                                    <constraint firstItem="UV2-e0-2WR" firstAttribute="leading" secondItem="DnG-rP-VC1" secondAttribute="leading" constant="100" id="U00-Cf-yKe"/>
+                                    <constraint firstItem="A25-Lp-T28" firstAttribute="top" secondItem="S11-dh-p5R" secondAttribute="top" constant="-2" id="U0r-i8-7XA"/>
+                                    <constraint firstItem="A25-Lp-T28" firstAttribute="trailing" secondItem="S11-dh-p5R" secondAttribute="trailing" constant="8" id="VKH-7w-OwP"/>
+                                    <constraint firstAttribute="trailing" secondItem="ONY-EY-Mq8" secondAttribute="trailing" id="XL7-Sx-KoW"/>
+                                    <constraint firstItem="nSk-el-cio" firstAttribute="top" secondItem="ONY-EY-Mq8" secondAttribute="bottom" constant="16" id="Ygb-vV-pCf"/>
+                                    <constraint firstItem="yV3-Zo-OMM" firstAttribute="top" secondItem="EJn-Nh-AJt" secondAttribute="top" id="bUT-dk-r9u"/>
+                                    <constraint firstItem="gi8-tp-KZz" firstAttribute="top" secondItem="nSk-el-cio" secondAttribute="bottom" constant="16" id="cjB-eh-0GU"/>
+                                    <constraint firstItem="ONY-EY-Mq8" firstAttribute="leading" secondItem="ugH-nQ-Rb3" secondAttribute="leading" id="dWd-w1-NTD"/>
+                                    <constraint firstItem="fap-ni-Cyz" firstAttribute="centerY" secondItem="gi8-tp-KZz" secondAttribute="centerY" id="iRS-kJ-myb"/>
+                                    <constraint firstItem="S11-dh-p5R" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="DnG-rP-VC1" secondAttribute="leading" id="jhv-hx-mO1"/>
+                                    <constraint firstItem="yV3-Zo-OMM" firstAttribute="trailing" secondItem="EJn-Nh-AJt" secondAttribute="trailing" constant="8" id="kak-26-1Xu"/>
+                                    <constraint firstItem="UV2-e0-2WR" firstAttribute="leading" secondItem="EJn-Nh-AJt" secondAttribute="trailing" constant="10" id="laN-ix-diU"/>
+                                    <constraint firstItem="gi8-tp-KZz" firstAttribute="leading" secondItem="nSk-el-cio" secondAttribute="leading" id="mJJ-Cg-ph1"/>
+                                    <constraint firstItem="SzB-Zi-l4g" firstAttribute="centerY" secondItem="ugH-nQ-Rb3" secondAttribute="centerY" id="n2x-xY-XMp"/>
+                                    <constraint firstItem="fap-ni-Cyz" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="DnG-rP-VC1" secondAttribute="leading" id="r5H-lU-TSB"/>
+                                    <constraint firstAttribute="trailing" secondItem="nSk-el-cio" secondAttribute="trailing" id="wD0-fE-zw8"/>
+                                    <constraint firstAttribute="trailing" secondItem="gi8-tp-KZz" secondAttribute="trailing" id="xPc-Ki-vHQ"/>
+                                    <constraint firstAttribute="trailing" secondItem="ugH-nQ-Rb3" secondAttribute="trailing" id="yqZ-pQ-Fyn"/>
+                                    <constraint firstItem="S11-dh-p5R" firstAttribute="centerY" secondItem="nSk-el-cio" secondAttribute="centerY" id="yv9-Sj-3gP"/>
+                                    <constraint firstItem="nSk-el-cio" firstAttribute="leading" secondItem="ONY-EY-Mq8" secondAttribute="leading" id="zHy-8f-CLh"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="270" id="gw0-Pj-Ai2"/>
+                            </constraints>
+                        </box>
+                        <box titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="b94-Iz-pLJ">
+                            <rect key="frame" x="17" y="59" width="664" height="112"/>
+                            <view key="contentView" id="FFJ-fv-YD7">
+                                <rect key="frame" x="4" y="5" width="656" height="104"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0BQ-8w-I6s">
+                                        <rect key="frame" x="12" y="12" width="534" height="80"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                        <clipView key="contentView" drawsBackground="NO" id="3pY-cz-Vyt">
+                                            <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textView editable="NO" selectable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="uSw-H3-Zk5">
+                                                    <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <size key="minSize" width="534" height="80"/>
+                                                    <size key="maxSize" width="1658" height="10000000"/>
+                                                    <attributedString key="textStorage">
+                                                        <fragment>
+                                                            <string key="content">Digital ID files generally have a PFX or P12 extension and contain the public key file (Certificate) and the associated private key file./n/nTo sign with a digital ID available as a file, follow the prompts to browse and select the file and type the password protecting the private key.</string>
+                                                            <attributes>
+                                                                <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                                <font key="NSFont" size="12" name="Helvetica"/>
+                                                                <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                                            </attributes>
+                                                        </fragment>
+                                                    </attributedString>
+                                                    <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                </textView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                        </clipView>
+                                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="oOj-xR-CZ6">
+                                            <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                        <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="YsE-2X-Gva">
+                                            <rect key="frame" x="-100" y="-100" width="15" height="135"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                    </scrollView>
+                                </subviews>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="106" id="aEr-s0-D4A"/>
+                            </constraints>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YT7-wP-rmf">
+                            <rect key="frame" x="474" y="14" width="115" height="40"/>
+                            <buttonCell key="cell" type="push" title="Previous step" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Pyc-7K-Edu">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="previousAction:" target="-2" id="bjD-jS-LFr"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dSu-Sg-ba6">
+                            <rect key="frame" x="597" y="14" width="87" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="K6U-Rx-9cq">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="q3n-F4-5tu"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="FWE-0s-1Hs" firstAttribute="top" secondItem="qVw-t6-1Hc" secondAttribute="bottom" constant="15" id="KeL-3O-WbD"/>
+                        <constraint firstAttribute="trailing" secondItem="b94-Iz-pLJ" secondAttribute="trailing" constant="20" id="NZO-mF-wX8"/>
+                        <constraint firstAttribute="trailing" secondItem="dSu-Sg-ba6" secondAttribute="trailing" constant="20" id="Nay-vM-lpz"/>
+                        <constraint firstItem="FWE-0s-1Hs" firstAttribute="leading" secondItem="hY4-zY-c9z" secondAttribute="leading" constant="20" id="RdS-dC-akU"/>
+                        <constraint firstItem="qAc-a5-zV7" firstAttribute="centerY" secondItem="qVw-t6-1Hc" secondAttribute="centerY" id="TzA-dG-Qwc"/>
+                        <constraint firstAttribute="bottom" secondItem="dSu-Sg-ba6" secondAttribute="bottom" constant="20" id="YFw-My-oEI"/>
+                        <constraint firstItem="b94-Iz-pLJ" firstAttribute="top" secondItem="FWE-0s-1Hs" secondAttribute="bottom" constant="10" id="ZEN-yz-AOJ"/>
+                        <constraint firstItem="dSu-Sg-ba6" firstAttribute="leading" secondItem="YT7-wP-rmf" secondAttribute="trailing" constant="20" id="cyU-Ci-1zN"/>
+                        <constraint firstItem="qVw-t6-1Hc" firstAttribute="top" secondItem="hY4-zY-c9z" secondAttribute="top" constant="24" id="fVp-ju-5wJ"/>
+                        <constraint firstItem="dSu-Sg-ba6" firstAttribute="centerY" secondItem="YT7-wP-rmf" secondAttribute="centerY" id="fwI-re-clg"/>
+                        <constraint firstAttribute="trailing" secondItem="FWE-0s-1Hs" secondAttribute="trailing" constant="20" id="j37-zA-bsr"/>
+                        <constraint firstItem="b94-Iz-pLJ" firstAttribute="leading" secondItem="hY4-zY-c9z" secondAttribute="leading" constant="20" id="po6-dH-RBd"/>
+                        <constraint firstItem="qVw-t6-1Hc" firstAttribute="leading" secondItem="hY4-zY-c9z" secondAttribute="leading" constant="20" id="whC-IY-vaH"/>
+                        <constraint firstAttribute="trailing" secondItem="qAc-a5-zV7" secondAttribute="trailing" constant="20" id="zOe-Nf-MTm"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="hY4-zY-c9z" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="6wr-3y-N6q"/>
+                <constraint firstAttribute="trailing" secondItem="hY4-zY-c9z" secondAttribute="trailing" id="DtB-qK-ftK"/>
+                <constraint firstAttribute="bottom" secondItem="hY4-zY-c9z" secondAttribute="bottom" id="KPv-BL-uJw"/>
+                <constraint firstItem="hY4-zY-c9z" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="osw-yz-lbG"/>
+            </constraints>
+            <point key="canvasLocation" x="248" y="233.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+    </resources>
+</document>

+ 134 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateViewController.swift

@@ -0,0 +1,134 @@
+//
+//  DSignatureCreateViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureCreateViewController: NSViewController {
+
+    
+    @IBOutlet weak var configureLabel: NSTextField!
+    @IBOutlet weak var selectLabel: NSTextField!
+    
+    @IBOutlet weak var fileBox: NSBox!
+    @IBOutlet weak var fileLabel: NSTextField!
+    @IBOutlet weak var fileSubLabel: NSTextField!
+    @IBOutlet weak var createFileButton: NSButton!
+    
+    @IBOutlet weak var createButton: NSButton!
+    @IBOutlet weak var creatBox: NSBox!
+    @IBOutlet weak var creatLabel: NSTextField!
+    @IBOutlet weak var creatSubLabel: NSTextField!
+    
+    @IBOutlet weak var promptBox: NSBox!
+    @IBOutlet var promptTextView: NSTextView!
+
+    @IBOutlet weak var previousStepButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+    
+    var isCreatDS: Bool = false
+    var _type: CDSignatureCreatType = .createNone
+    
+    var actionBlock: ((_ createVC:DSignatureCreateViewController, _ actionType:DSignatureActionType, _ createType: CDSignatureCreatType)->Void)?
+    
+    
+    override func viewWillAppear() {
+        super.viewWillAppear()
+        
+        if self.isCreatDS {
+            self.previousStepButton.isHidden = true
+        }
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.localizedLanguage()
+        
+        self.configureLabel.textColor = NSColor.labelColor
+        self.selectLabel.textColor = NSColor.labelColor
+        self.fileLabel.textColor = NSColor.labelColor
+        self.creatLabel.textColor = NSColor.labelColor
+        
+        self.fileSubLabel.textColor = NSColor.labelColor
+        self.creatSubLabel.textColor = NSColor.labelColor
+        self.promptTextView.textColor = NSColor.labelColor
+        
+        self.fileBox.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1.0)
+        self.creatBox.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1.0)
+        
+        self.type = .fromFile
+        
+    }
+    
+    //MARK: Setter
+    var type: CDSignatureCreatType {
+        set {
+            _type = newValue;
+             
+            if _type == .signCreate {
+                self.createButton.state = .on
+                self.createFileButton.state = .off
+            } else if _type == .fromFile {
+                self.createButton.state = .off
+                self.createFileButton.state = .on
+            }
+        }
+        
+        get {
+            return _type;
+        }
+    }
+    
+    func localizedLanguage() {
+        
+        self.configureLabel.stringValue = NSLocalizedString("Configure a Digital ID for Signing", comment: "")
+        self.selectLabel.stringValue = NSLocalizedString("Select the type of Digital ID:", comment: "")
+        self.fileLabel.stringValue = NSLocalizedString("Use a Digital ID from a File", comment: "")
+        self.fileSubLabel.stringValue = NSLocalizedString("Import an existing digital ID that you have obtained as a file", comment: "")
+        self.creatLabel.stringValue = NSLocalizedString("Create a New Digital ID", comment: "")
+        self.creatSubLabel.stringValue = NSLocalizedString("Create your self-signed digital ID", comment: "")
+        
+        self.promptTextView.string = String(format:"%@\n\n%@",NSLocalizedString("A digital ID is required to create a digital signature.The most secure digital ID are issued by trusted Certificate authorities and are based on secure devices like smart card or token. Some are based on files.", comment: ""),NSLocalizedString("You can also create a new digital ID, but they provide a low level of identity assurance.", comment: ""))
+        self.previousStepButton.title = NSLocalizedString("Previous Step", comment: "")
+        self.continueButton.title = NSLocalizedString("Continue", comment: "")
+    }
+    
+    //MARK: IBAction
+    
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, self.type)
+    }
+    
+    @IBAction func previousAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, self.type)
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .confirm, self.type)
+    }
+ 
+    @IBAction func buttonItemClick_CreatType(_ sender: Any) {
+        let button: NSButton = sender as! NSButton
+        if button.tag == 0 {
+            self.type = .fromFile
+        } else if button.tag == 1 {
+            self.type = .signCreate
+        }
+    }
+    
+    
+}

+ 342 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCreateViewController.xib

@@ -0,0 +1,342 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureCreateViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="configureLabel" destination="tIy-PW-hI7" id="PZ3-e6-unw"/>
+                <outlet property="continueButton" destination="QuB-ee-8uI" id="2H4-TA-2JU"/>
+                <outlet property="creatBox" destination="ohm-dc-bBu" id="wlc-32-mh2"/>
+                <outlet property="creatLabel" destination="eeZ-h8-EMl" id="zRX-Yp-cC5"/>
+                <outlet property="creatSubLabel" destination="g8a-2X-XI0" id="SN7-Ui-zPM"/>
+                <outlet property="createButton" destination="bX1-MI-GNV" id="j3i-L9-euC"/>
+                <outlet property="createFileButton" destination="Ebe-Ua-SE4" id="dGn-rh-tbU"/>
+                <outlet property="fileBox" destination="jZo-8W-kVM" id="WuK-7u-0Gf"/>
+                <outlet property="fileLabel" destination="jcz-X9-IQi" id="s12-9h-Var"/>
+                <outlet property="fileSubLabel" destination="vQJ-j3-aKE" id="pZe-ra-Kph"/>
+                <outlet property="previousStepButton" destination="DAf-uh-jDJ" id="qVF-UO-k6W"/>
+                <outlet property="promptBox" destination="AqW-8z-eSW" id="3Sx-I1-9cb"/>
+                <outlet property="promptTextView" destination="OtI-Yu-oZ7" id="Bcg-Cc-mIW"/>
+                <outlet property="selectLabel" destination="fyO-bA-e8Y" id="f49-KM-OuJ"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="603" height="500"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="bsQ-uI-2MA">
+                    <rect key="frame" x="0.0" y="0.0" width="603" height="500"/>
+                    <subviews>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="80O-vK-SeW">
+                            <rect key="frame" x="563" y="451" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="WoI-FP-cY0">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="bp3-qH-KIw"/>
+                            </connections>
+                        </button>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tIy-PW-hI7">
+                            <rect key="frame" x="22" y="449" width="245" height="19"/>
+                            <textFieldCell key="cell" title="Configure a Digital ID for signing" id="j5H-sy-FC8">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fyO-bA-e8Y">
+                            <rect key="frame" x="22" y="418" width="189" height="17"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Select the type of Digital ID:" id="GKF-tF-HSC">
+                                <font key="font" metaFont="systemMedium" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="kPN-vQ-JoS">
+                            <rect key="frame" x="24" y="329" width="555" height="68"/>
+                            <view key="contentView" id="eq1-wg-If4">
+                                <rect key="frame" x="0.0" y="0.0" width="555" height="68"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <box boxType="custom" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="jZo-8W-kVM">
+                                        <rect key="frame" x="30" y="0.0" width="525" height="68"/>
+                                        <view key="contentView" id="nUz-vx-D7O">
+                                            <rect key="frame" x="1" y="1" width="523" height="66"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="AXf-96-ICM">
+                                                    <rect key="frame" x="18" y="17" width="32" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="32" id="0vt-q4-pd4"/>
+                                                        <constraint firstAttribute="width" constant="32" id="DGQ-BK-QM2"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameDSignatureFromFile" id="hDH-u7-9aY"/>
+                                                </imageView>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jcz-X9-IQi">
+                                                    <rect key="frame" x="53" y="37" width="462" height="17"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Use a Digital ID from a file" id="eVx-Gl-T7d">
+                                                        <font key="font" metaFont="systemMedium" size="14"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vQJ-j3-aKE">
+                                                    <rect key="frame" x="53" y="12" width="462" height="15"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Import an existing Digital ID that you have obtained as a file" id="G1E-OD-50G">
+                                                        <font key="font" metaFont="cellTitle"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="vQJ-j3-aKE" firstAttribute="leading" secondItem="AXf-96-ICM" secondAttribute="trailing" constant="5" id="8d4-J9-aEu"/>
+                                                <constraint firstAttribute="trailing" secondItem="jcz-X9-IQi" secondAttribute="trailing" constant="10" id="Chs-sC-ZEr"/>
+                                                <constraint firstItem="AXf-96-ICM" firstAttribute="leading" secondItem="nUz-vx-D7O" secondAttribute="leading" constant="18" id="Eg6-nF-7hN"/>
+                                                <constraint firstAttribute="trailing" secondItem="vQJ-j3-aKE" secondAttribute="trailing" constant="10" id="Zjf-BF-3db"/>
+                                                <constraint firstItem="jcz-X9-IQi" firstAttribute="top" secondItem="nUz-vx-D7O" secondAttribute="top" constant="12" id="aId-Py-z6u"/>
+                                                <constraint firstItem="vQJ-j3-aKE" firstAttribute="top" secondItem="jcz-X9-IQi" secondAttribute="bottom" constant="10" id="cud-nF-JbN"/>
+                                                <constraint firstItem="AXf-96-ICM" firstAttribute="centerY" secondItem="nUz-vx-D7O" secondAttribute="centerY" id="e8L-0a-jEk"/>
+                                                <constraint firstItem="jcz-X9-IQi" firstAttribute="leading" secondItem="AXf-96-ICM" secondAttribute="trailing" constant="5" id="thd-rq-KjN"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ebe-Ua-SE4">
+                                        <rect key="frame" x="-2" y="25" width="18" height="18"/>
+                                        <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="czP-l7-pT4">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                    </button>
+                                    <button verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="tNF-9Z-T3N">
+                                        <rect key="frame" x="0.0" y="0.0" width="555" height="68"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="yMs-aT-yYn">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_CreatType:" target="-2" id="NvP-MN-SJR"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="tNF-9Z-T3N" secondAttribute="bottom" id="2TK-70-VVT"/>
+                                    <constraint firstItem="tNF-9Z-T3N" firstAttribute="leading" secondItem="eq1-wg-If4" secondAttribute="leading" id="8hk-IP-zlC"/>
+                                    <constraint firstItem="tNF-9Z-T3N" firstAttribute="top" secondItem="eq1-wg-If4" secondAttribute="top" id="Gen-eQ-mud"/>
+                                    <constraint firstItem="jZo-8W-kVM" firstAttribute="leading" secondItem="eq1-wg-If4" secondAttribute="leading" constant="30" id="O3R-nY-Kgh"/>
+                                    <constraint firstItem="jZo-8W-kVM" firstAttribute="top" secondItem="eq1-wg-If4" secondAttribute="top" id="RVK-FN-UT0"/>
+                                    <constraint firstAttribute="trailing" secondItem="tNF-9Z-T3N" secondAttribute="trailing" id="U5x-8h-UvS"/>
+                                    <constraint firstAttribute="trailing" secondItem="jZo-8W-kVM" secondAttribute="trailing" id="XHb-NS-UTa"/>
+                                    <constraint firstItem="Ebe-Ua-SE4" firstAttribute="leading" secondItem="eq1-wg-If4" secondAttribute="leading" id="XWL-fX-Ndq"/>
+                                    <constraint firstItem="Ebe-Ua-SE4" firstAttribute="centerY" secondItem="eq1-wg-If4" secondAttribute="centerY" id="iZs-JL-rPX"/>
+                                    <constraint firstAttribute="bottom" secondItem="jZo-8W-kVM" secondAttribute="bottom" id="svd-es-VP5"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="68" id="TPY-rU-fxv"/>
+                            </constraints>
+                        </box>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="34T-Ca-VW4">
+                            <rect key="frame" x="24" y="246" width="555" height="68"/>
+                            <view key="contentView" id="ixX-Be-vLJ">
+                                <rect key="frame" x="0.0" y="0.0" width="555" height="68"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bX1-MI-GNV">
+                                        <rect key="frame" x="-2" y="25" width="18" height="18"/>
+                                        <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" inset="2" id="AcX-Wa-8F3">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                    </button>
+                                    <box boxType="custom" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ohm-dc-bBu">
+                                        <rect key="frame" x="30" y="0.0" width="525" height="68"/>
+                                        <view key="contentView" id="bok-in-I6q">
+                                            <rect key="frame" x="1" y="1" width="523" height="66"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XdZ-Wl-F3G">
+                                                    <rect key="frame" x="18" y="17" width="32" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="32" id="UtS-iU-DU7"/>
+                                                        <constraint firstAttribute="height" constant="32" id="k2S-qI-Vmo"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameDSignatureCreat" id="Mnm-T8-Cj1"/>
+                                                </imageView>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eeZ-h8-EMl">
+                                                    <rect key="frame" x="53" y="37" width="467" height="17"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Create a new Digital ID" id="6ed-3I-14Z">
+                                                        <font key="font" metaFont="systemMedium" size="14"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="g8a-2X-XI0">
+                                                    <rect key="frame" x="53" y="12" width="467" height="15"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Create your self-signed Digital ID" id="pv0-Rx-bo9">
+                                                        <font key="font" metaFont="cellTitle"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="g8a-2X-XI0" firstAttribute="leading" secondItem="XdZ-Wl-F3G" secondAttribute="trailing" constant="5" id="3y5-gF-9Ak"/>
+                                                <constraint firstItem="g8a-2X-XI0" firstAttribute="top" secondItem="eeZ-h8-EMl" secondAttribute="bottom" constant="10" id="4Ru-eW-VIo"/>
+                                                <constraint firstItem="eeZ-h8-EMl" firstAttribute="leading" secondItem="XdZ-Wl-F3G" secondAttribute="trailing" constant="5" id="7F0-yv-SiU"/>
+                                                <constraint firstAttribute="trailing" secondItem="g8a-2X-XI0" secondAttribute="trailing" constant="5" id="J7x-1Q-6u3"/>
+                                                <constraint firstItem="XdZ-Wl-F3G" firstAttribute="leading" secondItem="bok-in-I6q" secondAttribute="leading" constant="18" id="KKe-NC-5yH"/>
+                                                <constraint firstItem="eeZ-h8-EMl" firstAttribute="top" secondItem="bok-in-I6q" secondAttribute="top" constant="12" id="Rwu-Ca-5o0"/>
+                                                <constraint firstAttribute="trailing" secondItem="eeZ-h8-EMl" secondAttribute="trailing" constant="5" id="pqH-Ev-Sgw"/>
+                                                <constraint firstItem="XdZ-Wl-F3G" firstAttribute="centerY" secondItem="bok-in-I6q" secondAttribute="centerY" id="szM-ZU-bPm"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <button tag="1" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="DE5-RU-X4X">
+                                        <rect key="frame" x="0.0" y="0.0" width="555" height="68"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="wZD-HL-e8V">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="buttonItemClick_CreatType:" target="-2" id="poE-rj-9aX"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="bX1-MI-GNV" firstAttribute="leading" secondItem="ixX-Be-vLJ" secondAttribute="leading" id="1Mc-dI-MUl"/>
+                                    <constraint firstAttribute="trailing" secondItem="DE5-RU-X4X" secondAttribute="trailing" id="8Z9-M3-n1L"/>
+                                    <constraint firstItem="DE5-RU-X4X" firstAttribute="leading" secondItem="ixX-Be-vLJ" secondAttribute="leading" id="D9o-9C-DuI"/>
+                                    <constraint firstAttribute="trailing" secondItem="ohm-dc-bBu" secondAttribute="trailing" id="JY1-On-Ecl"/>
+                                    <constraint firstItem="ohm-dc-bBu" firstAttribute="top" secondItem="ixX-Be-vLJ" secondAttribute="top" id="Lqi-1p-mUc"/>
+                                    <constraint firstItem="bX1-MI-GNV" firstAttribute="centerY" secondItem="ixX-Be-vLJ" secondAttribute="centerY" id="R1K-Cj-NWL"/>
+                                    <constraint firstAttribute="bottom" secondItem="DE5-RU-X4X" secondAttribute="bottom" id="Wld-a6-qCf"/>
+                                    <constraint firstAttribute="bottom" secondItem="ohm-dc-bBu" secondAttribute="bottom" id="d74-dr-6gO"/>
+                                    <constraint firstItem="ohm-dc-bBu" firstAttribute="leading" secondItem="ixX-Be-vLJ" secondAttribute="leading" constant="30" id="eKN-bL-5Jj"/>
+                                    <constraint firstItem="DE5-RU-X4X" firstAttribute="top" secondItem="ixX-Be-vLJ" secondAttribute="top" id="vJ1-kD-ISa"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="68" id="7nk-o2-fXp"/>
+                            </constraints>
+                        </box>
+                        <box titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="AqW-8z-eSW">
+                            <rect key="frame" x="21" y="116" width="561" height="112"/>
+                            <view key="contentView" id="Bmu-1K-CMB">
+                                <rect key="frame" x="4" y="5" width="553" height="104"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oj9-ad-HEW">
+                                        <rect key="frame" x="12" y="12" width="534" height="80"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <clipView key="contentView" drawsBackground="NO" id="FOc-KO-kGt">
+                                            <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textView editable="NO" selectable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="OtI-Yu-oZ7">
+                                                    <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <size key="minSize" width="534" height="80"/>
+                                                    <size key="maxSize" width="1658" height="10000000"/>
+                                                    <attributedString key="textStorage">
+                                                        <fragment>
+                                                            <string key="content">A Digital ID is required to create a digital signature.The most secure Digital ID are issued by trusted Certificate authorities and are based on secure devices like smart card or token. Some are based on files.\n You can also create a new Digital ID, but they provide a low level of identity assurance.</string>
+                                                            <attributes>
+                                                                <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                                <font key="NSFont" size="12" name="Helvetica"/>
+                                                                <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                                            </attributes>
+                                                        </fragment>
+                                                    </attributedString>
+                                                    <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                </textView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                        </clipView>
+                                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="gOf-py-r1C">
+                                            <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                        <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="WlN-uw-tvc">
+                                            <rect key="frame" x="-100" y="-100" width="15" height="135"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                    </scrollView>
+                                </subviews>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="106" id="JC0-lP-hfP"/>
+                            </constraints>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QuB-ee-8uI">
+                            <rect key="frame" x="498" y="27" width="87" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Twm-Rp-8jz">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="2I1-uU-eOK"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DAf-uh-jDJ">
+                            <rect key="frame" x="384" y="27" width="115" height="40"/>
+                            <buttonCell key="cell" type="push" title="Previous step" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Gmj-MS-aJc">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="previousAction:" target="-2" id="8bH-P0-fQg"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="AqW-8z-eSW" firstAttribute="leading" secondItem="bsQ-uI-2MA" secondAttribute="leading" constant="24" id="0Ip-Tc-Yzf"/>
+                        <constraint firstAttribute="trailing" secondItem="80O-vK-SeW" secondAttribute="trailing" constant="24" id="9oG-Lh-BhB"/>
+                        <constraint firstAttribute="trailing" secondItem="34T-Ca-VW4" secondAttribute="trailing" constant="24" id="GpV-mc-Wm3"/>
+                        <constraint firstAttribute="trailing" secondItem="QuB-ee-8uI" secondAttribute="trailing" constant="24" id="KGG-EX-NvP"/>
+                        <constraint firstAttribute="bottom" secondItem="QuB-ee-8uI" secondAttribute="bottom" constant="33" id="MCf-ih-ZCt"/>
+                        <constraint firstItem="tIy-PW-hI7" firstAttribute="leading" secondItem="bsQ-uI-2MA" secondAttribute="leading" constant="24" id="MrB-cO-xU1"/>
+                        <constraint firstItem="kPN-vQ-JoS" firstAttribute="top" secondItem="fyO-bA-e8Y" secondAttribute="bottom" constant="21" id="SGA-06-KwG"/>
+                        <constraint firstItem="fyO-bA-e8Y" firstAttribute="top" secondItem="tIy-PW-hI7" secondAttribute="bottom" constant="14" id="TvW-M6-eC3"/>
+                        <constraint firstItem="34T-Ca-VW4" firstAttribute="top" secondItem="kPN-vQ-JoS" secondAttribute="bottom" constant="15" id="X2a-hr-RZT"/>
+                        <constraint firstItem="fyO-bA-e8Y" firstAttribute="leading" secondItem="bsQ-uI-2MA" secondAttribute="leading" constant="24" id="d6N-gD-Txg"/>
+                        <constraint firstItem="AqW-8z-eSW" firstAttribute="top" secondItem="34T-Ca-VW4" secondAttribute="bottom" constant="20" id="eLw-ly-viz"/>
+                        <constraint firstAttribute="bottom" secondItem="DAf-uh-jDJ" secondAttribute="bottom" constant="33" id="eMj-vC-1Ag"/>
+                        <constraint firstItem="QuB-ee-8uI" firstAttribute="leading" secondItem="DAf-uh-jDJ" secondAttribute="trailing" constant="11" id="egd-03-bp9"/>
+                        <constraint firstItem="kPN-vQ-JoS" firstAttribute="leading" secondItem="bsQ-uI-2MA" secondAttribute="leading" constant="24" id="hph-v9-0yX"/>
+                        <constraint firstAttribute="trailing" secondItem="AqW-8z-eSW" secondAttribute="trailing" constant="24" id="jrn-J3-kCS"/>
+                        <constraint firstItem="tIy-PW-hI7" firstAttribute="top" secondItem="bsQ-uI-2MA" secondAttribute="top" constant="32" id="pfY-w1-SsR"/>
+                        <constraint firstItem="34T-Ca-VW4" firstAttribute="leading" secondItem="bsQ-uI-2MA" secondAttribute="leading" constant="24" id="qKN-37-e9y"/>
+                        <constraint firstItem="80O-vK-SeW" firstAttribute="centerY" secondItem="tIy-PW-hI7" secondAttribute="centerY" id="rie-u9-vcf"/>
+                        <constraint firstAttribute="trailing" secondItem="kPN-vQ-JoS" secondAttribute="trailing" constant="24" id="xT9-Xw-Ehw"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="bsQ-uI-2MA" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="Q61-Gg-Bqc"/>
+                <constraint firstItem="bsQ-uI-2MA" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="U17-JF-Xg0"/>
+                <constraint firstAttribute="trailing" secondItem="bsQ-uI-2MA" secondAttribute="trailing" id="XAA-kj-FNn"/>
+                <constraint firstAttribute="bottom" secondItem="bsQ-uI-2MA" secondAttribute="bottom" id="nuM-XA-1kQ"/>
+            </constraints>
+            <point key="canvasLocation" x="200.5" y="225"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+        <image name="ImageNameDSignatureCreat" width="32" height="32"/>
+        <image name="ImageNameDSignatureFromFile" width="32" height="32"/>
+    </resources>
+</document>

File diff suppressed because it is too large
+ 679 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureDetailsViewController.swift


+ 789 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureDetailsViewController.xib

@@ -0,0 +1,789 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureDetailsViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="closeButton" destination="t4H-lY-mGx" id="aQa-WC-SPb"/>
+                <outlet property="detailsDatasLabel" destination="FdT-4a-rv4" id="uEK-EI-1ed"/>
+                <outlet property="detailsTableView" destination="Tmz-vp-NdW" id="ril-k8-v3x"/>
+                <outlet property="detailsTextView" destination="2Qa-9e-K4F" id="5al-1c-zKi"/>
+                <outlet property="leftScrollView" destination="XlH-77-6Id" id="NPX-aB-AwZ"/>
+                <outlet property="legalSubLabel" destination="aow-2p-9t6" id="4CM-cp-d00"/>
+                <outlet property="legalTitleLabel" destination="FoI-XZ-tOx" id="oWG-YE-sDn"/>
+                <outlet property="policiesSubLabel" destination="tsQ-xX-nnq" id="emt-wM-NEx"/>
+                <outlet property="subTitleLabel" destination="88m-bn-D0j" id="cox-b4-RqK"/>
+                <outlet property="summaryExportBtn" destination="LK1-m5-IfJ" id="87y-Yt-yAz"/>
+                <outlet property="summaryImageView" destination="yXa-Q5-5LF" id="ceJ-k8-V3R"/>
+                <outlet property="summaryIssuesLabel" destination="fXk-LB-0VE" id="OcR-KC-IzE"/>
+                <outlet property="summaryIssuesTextField" destination="aR1-aa-Ot5" id="zYo-XF-tp5"/>
+                <outlet property="summaryNameTextField" destination="cd3-zE-Vcj" id="3VU-bz-FnL"/>
+                <outlet property="summaryUsageLabel" destination="0fc-wo-RGb" id="gLX-rQ-pR0"/>
+                <outlet property="summaryUsageTextView" destination="II3-FK-uZe" id="knX-hr-O6q"/>
+                <outlet property="summaryVaildFromLabel" destination="2Xa-5V-lKq" id="UYH-wP-Z6u"/>
+                <outlet property="summaryVaildFromTextField" destination="qbF-hu-VI0" id="S5a-8d-z09"/>
+                <outlet property="summaryVaildtoLabel" destination="fzi-fD-ONF" id="Caf-8c-Wwl"/>
+                <outlet property="summaryVaildtoTextField" destination="qmq-XA-ieu" id="0L3-3T-r6o"/>
+                <outlet property="tabView" destination="L4Z-kX-F16" id="XPA-6o-L3z"/>
+                <outlet property="tableView" destination="cSO-jO-Mt3" id="3Ns-tY-9Ev"/>
+                <outlet property="titleLabel" destination="z83-GF-kEx" id="svh-UR-Eas"/>
+                <outlet property="trustButton" destination="x52-IR-gai" id="OJL-0X-nma"/>
+                <outlet property="trustDes1ImageView" destination="9jZ-GA-23C" id="Fcq-WU-emP"/>
+                <outlet property="trustDes1Label" destination="Zwa-tD-ChV" id="W9m-Yh-iZt"/>
+                <outlet property="trustDes2ImageView" destination="t29-CD-OUu" id="Q3z-Zt-Zgs"/>
+                <outlet property="trustDes2Label" destination="ywT-Oi-hLQ" id="bIy-KZ-2bk"/>
+                <outlet property="trustDesBox" destination="NDJ-i8-3uk" id="hAj-PL-9N8"/>
+                <outlet property="trustDesTitleLabel" destination="bHb-ox-Dgw" id="j6i-2Z-2tx"/>
+                <outlet property="trustSubtitleLabel" destination="oe1-zb-had" id="HDI-vc-SB9"/>
+                <outlet property="trustTitleLabel" destination="rx7-Av-ryW" id="9wM-5w-hIv"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="683" height="617"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="pra-B5-Nqw">
+                    <rect key="frame" x="0.0" y="0.0" width="683" height="617"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="z83-GF-kEx">
+                            <rect key="frame" x="285" y="598" width="113" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Certificate Viewer" id="POJ-lN-Lj4">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="88m-bn-D0j">
+                            <rect key="frame" x="70" y="532" width="544" height="51"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="540" id="7h9-qi-kVQ"/>
+                            </constraints>
+                            <textFieldCell key="cell" id="5jL-ik-Sya">
+                                <font key="font" metaFont="system" size="14"/>
+                                <string key="title">This dialog allows you to view the details of a certificate and its entire issuance chain. The details correspond to the selected entry. Multiple issuance chains are being displayed because none of the chains were issued by a trust anchor.</string>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <scrollView horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XlH-77-6Id">
+                            <rect key="frame" x="24" y="89" width="158" height="433"/>
+                            <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="LF3-aJ-v9X">
+                                <rect key="frame" x="1" y="1" width="156" height="416"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="cSO-jO-Mt3">
+                                        <rect key="frame" x="0.0" y="0.0" width="156" height="416"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <size key="intercellSpacing" width="17" height="0.0"/>
+                                        <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                        <tableColumns>
+                                            <tableColumn width="144" minWidth="40" maxWidth="1000" id="4Wh-EC-Lyu">
+                                                <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+                                                    <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                                </tableHeaderCell>
+                                                <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="mJQ-eZ-w8i">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                                <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
+                                                <prototypeCellViews>
+                                                    <tableCellView identifier="KMSignatureTableViewCell" id="2r9-BS-Z9R" customClass="KMSignatureTableViewCell">
+                                                        <rect key="frame" x="8" y="0.0" width="139" height="24"/>
+                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                        <subviews>
+                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5Jg-mN-i42">
+                                                                <rect key="frame" x="8" y="5" width="148" height="15"/>
+                                                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                                <textFieldCell key="cell" title="Label" id="VWA-jJ-tZ6">
+                                                                    <font key="font" metaFont="cellTitle"/>
+                                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                </textFieldCell>
+                                                            </textField>
+                                                        </subviews>
+                                                        <connections>
+                                                            <outlet property="contentLabel" destination="5Jg-mN-i42" id="GV6-M4-dnX"/>
+                                                        </connections>
+                                                    </tableCellView>
+                                                </prototypeCellViews>
+                                            </tableColumn>
+                                        </tableColumns>
+                                    </tableView>
+                                </subviews>
+                                <nil key="backgroundColor"/>
+                            </clipView>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="158" id="9WL-fg-ono"/>
+                                <constraint firstAttribute="height" constant="433" id="fgA-GT-H42"/>
+                            </constraints>
+                            <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="nm8-QB-NxS">
+                                <rect key="frame" x="1" y="417" width="156" height="15"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                            </scroller>
+                            <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="rzs-VD-rQv">
+                                <rect key="frame" x="-100" y="-100" width="15" height="102"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                            </scroller>
+                        </scrollView>
+                        <tabView translatesAutoresizingMaskIntoConstraints="NO" id="L4Z-kX-F16">
+                            <rect key="frame" x="195" y="79" width="471" height="449"/>
+                            <font key="font" metaFont="system"/>
+                            <tabViewItems>
+                                <tabViewItem label="Summary" identifier="" id="33J-sB-CxQ">
+                                    <view key="view" id="TYF-jh-R0h">
+                                        <rect key="frame" x="10" y="33" width="451" height="403"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZPv-Qz-zW6">
+                                                <rect key="frame" x="20" y="15" width="101" height="373"/>
+                                                <subviews>
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="K2d-Xu-BYb">
+                                                        <rect key="frame" x="-2" y="357" width="105" height="16"/>
+                                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Issued by:" id="N6R-H9-WhB">
+                                                            <font key="font" metaFont="system"/>
+                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                        </textFieldCell>
+                                                    </textField>
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bLw-o2-oGL">
+                                                        <rect key="frame" x="-2" y="341" width="105" height="16"/>
+                                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Valid from:" id="UCl-B5-ScM">
+                                                            <font key="font" metaFont="system"/>
+                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                        </textFieldCell>
+                                                    </textField>
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lTp-SH-KfZ">
+                                                        <rect key="frame" x="-2" y="325" width="105" height="16"/>
+                                                        <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Valid to:" id="dNN-m4-aWg">
+                                                            <font key="font" metaFont="system"/>
+                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                        </textFieldCell>
+                                                    </textField>
+                                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Wf-xV-6VG">
+                                                        <rect key="frame" x="-2" y="309" width="105" height="16"/>
+                                                        <textFieldCell key="cell" alignment="right" title="Intended usage:" id="fzi-IW-kHm">
+                                                            <font key="font" metaFont="system"/>
+                                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                        </textFieldCell>
+                                                    </textField>
+                                                </subviews>
+                                                <constraints>
+                                                    <constraint firstItem="4Wf-xV-6VG" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="0a2-Qu-5dd"/>
+                                                    <constraint firstItem="lTp-SH-KfZ" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="9bx-Yp-ljL"/>
+                                                    <constraint firstItem="K2d-Xu-BYb" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="D2o-sU-0MK"/>
+                                                    <constraint firstItem="lTp-SH-KfZ" firstAttribute="top" secondItem="bLw-o2-oGL" secondAttribute="bottom" id="Kts-96-l78"/>
+                                                    <constraint firstAttribute="trailing" secondItem="4Wf-xV-6VG" secondAttribute="trailing" id="N53-1h-Ck4"/>
+                                                    <constraint firstAttribute="trailing" secondItem="lTp-SH-KfZ" secondAttribute="trailing" id="Wle-ZA-Cxg"/>
+                                                    <constraint firstAttribute="trailing" secondItem="K2d-Xu-BYb" secondAttribute="trailing" id="dQw-rn-DXX"/>
+                                                    <constraint firstItem="4Wf-xV-6VG" firstAttribute="top" secondItem="lTp-SH-KfZ" secondAttribute="bottom" id="f8a-rH-Sjy"/>
+                                                    <constraint firstItem="K2d-Xu-BYb" firstAttribute="top" secondItem="ZPv-Qz-zW6" secondAttribute="top" id="fw9-pB-6CP"/>
+                                                    <constraint firstItem="bLw-o2-oGL" firstAttribute="top" secondItem="K2d-Xu-BYb" secondAttribute="bottom" id="hHh-WU-W7R"/>
+                                                    <constraint firstAttribute="trailing" secondItem="bLw-o2-oGL" secondAttribute="trailing" id="oQ1-ws-CI4"/>
+                                                    <constraint firstItem="bLw-o2-oGL" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="u8N-Op-4Lk"/>
+                                                </constraints>
+                                            </customView>
+                                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="yXa-Q5-5LF">
+                                                <rect key="frame" x="89" y="357" width="32" height="32"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="32" id="GPk-FX-xG1"/>
+                                                    <constraint firstAttribute="height" constant="32" id="fR8-oY-S3F"/>
+                                                </constraints>
+                                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameSigntureVerifySuccess" id="4eI-uP-Czl"/>
+                                            </imageView>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fXk-LB-0VE">
+                                                <rect key="frame" x="18" y="335" width="105" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Issued by:" id="OTf-Wi-Po0">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2Xa-5V-lKq">
+                                                <rect key="frame" x="18" y="293" width="105" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Valid from:" id="cs1-Yl-Ln5">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fzi-fD-ONF">
+                                                <rect key="frame" x="18" y="269" width="105" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Valid to:" id="jE8-D7-bu7">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0fc-wo-RGb">
+                                                <rect key="frame" x="18" y="241" width="105" height="16"/>
+                                                <textFieldCell key="cell" alignment="right" title="Intended usage:" id="hxW-9x-xeD">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cd3-zE-Vcj">
+                                                <rect key="frame" x="129" y="357" width="314" height="32"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="32" id="T4R-1A-4gb"/>
+                                                </constraints>
+                                                <textFieldCell key="cell" title="123" id="O3i-2K-ucL">
+                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aR1-aa-Ot5">
+                                                <rect key="frame" x="129" y="317" width="314" height="34"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="34" id="kSB-v2-th6"/>
+                                                </constraints>
+                                                <textFieldCell key="cell" id="hDl-vP-FTa">
+                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qbF-hu-VI0">
+                                                <rect key="frame" x="129" y="293" width="314" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="111" id="5Lr-HI-o8B">
+                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qmq-XA-ieu">
+                                                <rect key="frame" x="129" y="269" width="22" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="111" id="1Lh-XD-c1S">
+                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <scrollView horizontalLineScroll="24" horizontalPageScroll="0.0" verticalLineScroll="24" verticalPageScroll="0.0" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="yHA-mf-4fP">
+                                                <rect key="frame" x="131" y="202" width="310" height="55"/>
+                                                <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="EBl-wK-7Su">
+                                                    <rect key="frame" x="1" y="1" width="308" height="53"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="h33-WG-cES">
+                                                            <rect key="frame" x="0.0" y="0.0" width="308" height="53"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                            <size key="intercellSpacing" width="17" height="0.0"/>
+                                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                                            <tableColumns>
+                                                                <tableColumn width="296" minWidth="40" maxWidth="1000" id="YJj-Vp-feU">
+                                                                    <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+                                                                        <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                                                    </tableHeaderCell>
+                                                                    <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="nwB-hi-wox">
+                                                                        <font key="font" metaFont="system"/>
+                                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                    </textFieldCell>
+                                                                    <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
+                                                                    <prototypeCellViews>
+                                                                        <tableCellView identifier="KMSignatureTableViewCell" id="eai-cK-784" customClass="KMSignatureTableViewCell">
+                                                                            <rect key="frame" x="8" y="0.0" width="291" height="24"/>
+                                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                                            <subviews>
+                                                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R0X-g0-OhG">
+                                                                                    <rect key="frame" x="8" y="5" width="240" height="15"/>
+                                                                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                                                    <textFieldCell key="cell" title="Label" id="9aG-bp-m0i">
+                                                                                        <font key="font" metaFont="cellTitle"/>
+                                                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                                    </textFieldCell>
+                                                                                </textField>
+                                                                            </subviews>
+                                                                            <connections>
+                                                                                <outlet property="contentLabel" destination="R0X-g0-OhG" id="dIp-Lt-NCb"/>
+                                                                            </connections>
+                                                                        </tableCellView>
+                                                                    </prototypeCellViews>
+                                                                </tableColumn>
+                                                            </tableColumns>
+                                                        </tableView>
+                                                    </subviews>
+                                                    <nil key="backgroundColor"/>
+                                                </clipView>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="U2p-CE-233">
+                                                    <rect key="frame" x="-100" y="-100" width="248" height="15"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="EL9-Qh-E6b">
+                                                    <rect key="frame" x="-100" y="-100" width="15" height="102"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                            </scrollView>
+                                            <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hvu-zC-Stx">
+                                                <rect key="frame" x="131" y="202" width="310" height="55"/>
+                                                <clipView key="contentView" drawsBackground="NO" id="0Dx-pR-mjA">
+                                                    <rect key="frame" x="0.0" y="0.0" width="295" height="55"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="II3-FK-uZe">
+                                                            <rect key="frame" x="0.0" y="0.0" width="295" height="55"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            <size key="minSize" width="295" height="55"/>
+                                                            <size key="maxSize" width="346" height="10000000"/>
+                                                            <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
+                                                        </textView>
+                                                    </subviews>
+                                                </clipView>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="55" id="Zzc-yA-CIa"/>
+                                                </constraints>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="f7M-4D-J5K">
+                                                    <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="8VT-Xe-xiF">
+                                                    <rect key="frame" x="295" y="0.0" width="15" height="55"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                            </scrollView>
+                                            <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="LK1-m5-IfJ">
+                                                <rect key="frame" x="183" y="73" width="85" height="32"/>
+                                                <buttonCell key="cell" type="push" title="Export..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="WcS-L6-itL">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="exportAction:" target="-2" id="lIc-GY-XgJ"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="trailing" secondItem="cd3-zE-Vcj" secondAttribute="trailing" id="0UY-Wd-6aM"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="top" secondItem="0fc-wo-RGb" secondAttribute="top" id="0rd-YA-1qv"/>
+                                            <constraint firstItem="cd3-zE-Vcj" firstAttribute="top" secondItem="yXa-Q5-5LF" secondAttribute="top" id="2B7-Ud-qaq"/>
+                                            <constraint firstAttribute="trailing" secondItem="cd3-zE-Vcj" secondAttribute="trailing" constant="10" id="A19-iD-zeb"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="leading" secondItem="yHA-mf-4fP" secondAttribute="leading" id="AJ0-Xr-qMU"/>
+                                            <constraint firstItem="cd3-zE-Vcj" firstAttribute="top" secondItem="TYF-jh-R0h" secondAttribute="top" constant="14" id="Cw7-TQ-nZk"/>
+                                            <constraint firstItem="aR1-aa-Ot5" firstAttribute="top" secondItem="cd3-zE-Vcj" secondAttribute="bottom" constant="6" id="EGC-JX-PM4"/>
+                                            <constraint firstItem="qbF-hu-VI0" firstAttribute="centerY" secondItem="2Xa-5V-lKq" secondAttribute="centerY" id="EYV-Ib-S3t"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="trailing" secondItem="yHA-mf-4fP" secondAttribute="trailing" id="IBf-vQ-jCV"/>
+                                            <constraint firstItem="qmq-XA-ieu" firstAttribute="top" secondItem="qbF-hu-VI0" secondAttribute="bottom" constant="8" id="Ib0-4c-EM2"/>
+                                            <constraint firstItem="LK1-m5-IfJ" firstAttribute="top" relation="greaterThanOrEqual" secondItem="yHA-mf-4fP" secondAttribute="bottom" constant="10" id="K4b-kI-Q5M"/>
+                                            <constraint firstItem="fzi-fD-ONF" firstAttribute="trailing" secondItem="ZPv-Qz-zW6" secondAttribute="trailing" id="Kcd-xZ-YV8"/>
+                                            <constraint firstAttribute="bottom" secondItem="LK1-m5-IfJ" secondAttribute="bottom" constant="80" id="ONQ-0m-tKZ"/>
+                                            <constraint firstItem="aR1-aa-Ot5" firstAttribute="leading" secondItem="cd3-zE-Vcj" secondAttribute="leading" id="QTE-M3-45x"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="top" secondItem="qmq-XA-ieu" secondAttribute="bottom" constant="12" id="Qsd-ax-90H"/>
+                                            <constraint firstItem="qbF-hu-VI0" firstAttribute="leading" secondItem="cd3-zE-Vcj" secondAttribute="leading" id="Rwc-FW-Wdm"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="bottom" secondItem="yHA-mf-4fP" secondAttribute="bottom" id="ST9-e0-oWn"/>
+                                            <constraint firstItem="aR1-aa-Ot5" firstAttribute="trailing" secondItem="cd3-zE-Vcj" secondAttribute="trailing" id="TDf-eM-4vx"/>
+                                            <constraint firstItem="qmq-XA-ieu" firstAttribute="top" secondItem="fzi-fD-ONF" secondAttribute="top" id="TIV-OS-r32"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="top" secondItem="yHA-mf-4fP" secondAttribute="top" id="U5u-nz-L1l"/>
+                                            <constraint firstItem="qbF-hu-VI0" firstAttribute="top" secondItem="2Xa-5V-lKq" secondAttribute="top" id="U7S-Np-Pvk"/>
+                                            <constraint firstItem="fXk-LB-0VE" firstAttribute="trailing" secondItem="ZPv-Qz-zW6" secondAttribute="trailing" id="UOP-XA-KMc"/>
+                                            <constraint firstItem="qmq-XA-ieu" firstAttribute="leading" secondItem="qbF-hu-VI0" secondAttribute="leading" id="Xhh-5M-XdP"/>
+                                            <constraint firstItem="qbF-hu-VI0" firstAttribute="trailing" secondItem="cd3-zE-Vcj" secondAttribute="trailing" id="ZcX-Tg-tSM"/>
+                                            <constraint firstItem="aR1-aa-Ot5" firstAttribute="top" secondItem="fXk-LB-0VE" secondAttribute="top" id="auS-y9-oYO"/>
+                                            <constraint firstItem="LK1-m5-IfJ" firstAttribute="centerX" secondItem="TYF-jh-R0h" secondAttribute="centerX" id="bJg-9g-QFx"/>
+                                            <constraint firstItem="yXa-Q5-5LF" firstAttribute="trailing" secondItem="ZPv-Qz-zW6" secondAttribute="trailing" id="fs5-8a-8Kx"/>
+                                            <constraint firstItem="fXk-LB-0VE" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="g34-RT-0dW"/>
+                                            <constraint firstItem="0fc-wo-RGb" firstAttribute="trailing" secondItem="ZPv-Qz-zW6" secondAttribute="trailing" id="iNb-xI-q2s"/>
+                                            <constraint firstAttribute="bottom" secondItem="ZPv-Qz-zW6" secondAttribute="bottom" constant="15" id="jjX-L5-PEf"/>
+                                            <constraint firstItem="2Xa-5V-lKq" firstAttribute="trailing" secondItem="ZPv-Qz-zW6" secondAttribute="trailing" id="lxX-pI-xBM"/>
+                                            <constraint firstItem="fzi-fD-ONF" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="oN9-qz-boo"/>
+                                            <constraint firstItem="0fc-wo-RGb" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="pVG-BX-j79"/>
+                                            <constraint firstItem="ZPv-Qz-zW6" firstAttribute="leading" secondItem="TYF-jh-R0h" secondAttribute="leading" constant="20" id="s4G-is-TcC"/>
+                                            <constraint firstItem="hvu-zC-Stx" firstAttribute="leading" secondItem="cd3-zE-Vcj" secondAttribute="leading" id="uFl-Y7-7En"/>
+                                            <constraint firstItem="qmq-XA-ieu" firstAttribute="centerY" secondItem="fzi-fD-ONF" secondAttribute="centerY" id="w2m-li-X0i"/>
+                                            <constraint firstItem="qbF-hu-VI0" firstAttribute="top" secondItem="aR1-aa-Ot5" secondAttribute="bottom" constant="8" id="wMm-WV-iFy"/>
+                                            <constraint firstItem="ZPv-Qz-zW6" firstAttribute="top" secondItem="TYF-jh-R0h" secondAttribute="top" constant="15" id="xGs-A0-HNQ"/>
+                                            <constraint firstItem="2Xa-5V-lKq" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="leading" id="xRR-qW-2OD"/>
+                                            <constraint firstItem="cd3-zE-Vcj" firstAttribute="leading" secondItem="ZPv-Qz-zW6" secondAttribute="trailing" constant="10" id="yh5-Z6-KDq"/>
+                                        </constraints>
+                                    </view>
+                                </tabViewItem>
+                                <tabViewItem label="Details" identifier="" id="1o0-cO-4EB">
+                                    <view key="view" id="gIb-t9-9Fv">
+                                        <rect key="frame" x="10" y="33" width="451" height="403"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <scrollView autohidesScrollers="YES" horizontalLineScroll="52" horizontalPageScroll="10" verticalLineScroll="52" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fWR-PY-Tza">
+                                                <rect key="frame" x="10" y="232" width="431" height="150"/>
+                                                <clipView key="contentView" id="zXP-74-cX2">
+                                                    <rect key="frame" x="1" y="1" width="429" height="148"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="52" rowSizeStyle="automatic" headerView="xwy-Kv-uzW" viewBased="YES" id="Tmz-vp-NdW">
+                                                            <rect key="frame" x="0.0" y="0.0" width="429" height="120"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                            <size key="intercellSpacing" width="17" height="0.0"/>
+                                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                                            <tableColumns>
+                                                                <tableColumn identifier="name" width="120" minWidth="40" maxWidth="1000" id="Hle-iG-W9X">
+                                                                    <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Name">
+                                                                        <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                                                    </tableHeaderCell>
+                                                                    <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="G6k-mJ-tSC">
+                                                                        <font key="font" metaFont="system"/>
+                                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                    </textFieldCell>
+                                                                    <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                                                    <prototypeCellViews>
+                                                                        <tableCellView id="wvh-5U-TVZ">
+                                                                            <rect key="frame" x="8" y="0.0" width="118" height="52"/>
+                                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                                            <subviews>
+                                                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="71s-2w-sMP">
+                                                                                    <rect key="frame" x="0.0" y="18" width="118" height="16"/>
+                                                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+                                                                                    <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="K93-do-h8M">
+                                                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                                    </textFieldCell>
+                                                                                </textField>
+                                                                            </subviews>
+                                                                            <connections>
+                                                                                <outlet property="textField" destination="71s-2w-sMP" id="g0D-t1-uas"/>
+                                                                            </connections>
+                                                                        </tableCellView>
+                                                                    </prototypeCellViews>
+                                                                </tableColumn>
+                                                                <tableColumn identifier="value" width="280" minWidth="40" maxWidth="1000" id="qbw-MV-92Y">
+                                                                    <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Value">
+                                                                        <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                                                    </tableHeaderCell>
+                                                                    <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="5ro-VK-2wM">
+                                                                        <font key="font" metaFont="system"/>
+                                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                    </textFieldCell>
+                                                                    <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                                                    <prototypeCellViews>
+                                                                        <tableCellView id="mgK-KW-A9B">
+                                                                            <rect key="frame" x="143" y="0.0" width="277" height="52"/>
+                                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                                            <subviews>
+                                                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WO5-Sh-Maq">
+                                                                                    <rect key="frame" x="0.0" y="18" width="277" height="16"/>
+                                                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+                                                                                    <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="cum-Vy-HN2">
+                                                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                                    </textFieldCell>
+                                                                                </textField>
+                                                                            </subviews>
+                                                                            <connections>
+                                                                                <outlet property="textField" destination="WO5-Sh-Maq" id="IfB-5J-1xG"/>
+                                                                            </connections>
+                                                                        </tableCellView>
+                                                                    </prototypeCellViews>
+                                                                </tableColumn>
+                                                            </tableColumns>
+                                                        </tableView>
+                                                    </subviews>
+                                                </clipView>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="150" id="mnn-rU-hBy"/>
+                                                </constraints>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Mdf-a1-PF8">
+                                                    <rect key="frame" x="1" y="134" width="429" height="15"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="Sef-2t-L1m">
+                                                    <rect key="frame" x="224" y="17" width="15" height="102"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <tableHeaderView key="headerView" wantsLayer="YES" id="xwy-Kv-uzW">
+                                                    <rect key="frame" x="0.0" y="0.0" width="429" height="28"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </tableHeaderView>
+                                            </scrollView>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FdT-4a-rv4">
+                                                <rect key="frame" x="8" y="387" width="103" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="Certificate Data:" id="aN0-lx-ZA3">
+                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BDy-8j-u72">
+                                                <rect key="frame" x="10" y="74" width="431" height="150"/>
+                                                <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="n4t-rk-guB">
+                                                    <rect key="frame" x="0.0" y="0.0" width="416" height="150"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <textView editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="2Qa-9e-K4F">
+                                                            <rect key="frame" x="0.0" y="0.0" width="416" height="150"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            <size key="minSize" width="416" height="150"/>
+                                                            <size key="maxSize" width="1294" height="10000000"/>
+                                                            <color key="insertionPointColor" name="textInsertionPointColor" catalog="System" colorSpace="catalog"/>
+                                                        </textView>
+                                                    </subviews>
+                                                </clipView>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="150" id="ogO-qB-HXO"/>
+                                                </constraints>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="aIz-D8-PgV">
+                                                    <rect key="frame" x="-100" y="-100" width="359" height="15"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="l34-J5-9Ma">
+                                                    <rect key="frame" x="416" y="0.0" width="15" height="150"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                            </scrollView>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstAttribute="trailing" secondItem="fWR-PY-Tza" secondAttribute="trailing" constant="10" id="2ZL-cm-Ikx"/>
+                                            <constraint firstItem="BDy-8j-u72" firstAttribute="top" secondItem="fWR-PY-Tza" secondAttribute="bottom" constant="8" id="PND-pm-f3C"/>
+                                            <constraint firstItem="fWR-PY-Tza" firstAttribute="top" secondItem="FdT-4a-rv4" secondAttribute="bottom" constant="5" id="Sy9-ea-Thx"/>
+                                            <constraint firstItem="fWR-PY-Tza" firstAttribute="leading" secondItem="gIb-t9-9Fv" secondAttribute="leading" constant="10" id="Zba-Qa-qml"/>
+                                            <constraint firstAttribute="trailing" secondItem="BDy-8j-u72" secondAttribute="trailing" constant="10" id="asS-ie-SA6"/>
+                                            <constraint firstItem="FdT-4a-rv4" firstAttribute="top" secondItem="gIb-t9-9Fv" secondAttribute="top" id="dcC-ct-MH3"/>
+                                            <constraint firstItem="FdT-4a-rv4" firstAttribute="leading" secondItem="gIb-t9-9Fv" secondAttribute="leading" constant="10" id="huZ-H7-ysO"/>
+                                            <constraint firstItem="BDy-8j-u72" firstAttribute="leading" secondItem="gIb-t9-9Fv" secondAttribute="leading" constant="10" id="xH8-vM-T0X"/>
+                                        </constraints>
+                                    </view>
+                                </tabViewItem>
+                                <tabViewItem label="Trust" identifier="" id="vzE-ib-eoL">
+                                    <view key="view" id="h3u-8E-0DA">
+                                        <rect key="frame" x="10" y="33" width="451" height="403"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rx7-Av-ryW">
+                                                <rect key="frame" x="18" y="378" width="425" height="15"/>
+                                                <textFieldCell key="cell" title="This certificate is trusted because you have the corresponding private key." id="dC9-Tf-xUO">
+                                                    <font key="font" metaFont="cellTitle"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oe1-zb-had">
+                                                <rect key="frame" x="28" y="358" width="415" height="15"/>
+                                                <textFieldCell key="cell" title="Trust Settings" id="REy-nH-UC4">
+                                                    <font key="font" metaFont="cellTitle"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="NDJ-i8-3uk">
+                                                <rect key="frame" x="16" y="215" width="428" height="140"/>
+                                                <view key="contentView" id="M7F-Og-A0n">
+                                                    <rect key="frame" x="4" y="5" width="420" height="132"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bHb-ox-Dgw">
+                                                            <rect key="frame" x="8" y="112" width="164" height="15"/>
+                                                            <textFieldCell key="cell" title="This certificate is trusted to:" id="HDs-sS-kYg">
+                                                                <font key="font" metaFont="cellTitle"/>
+                                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            </textFieldCell>
+                                                        </textField>
+                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9jZ-GA-23C">
+                                                            <rect key="frame" x="10" y="82" width="20" height="20"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="width" constant="20" id="42J-6z-XtE"/>
+                                                                <constraint firstAttribute="height" constant="20" id="Nds-pe-wam"/>
+                                                            </constraints>
+                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameSigntureTrustedIcon" id="14u-Gk-mcD"/>
+                                                        </imageView>
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Zwa-tD-ChV">
+                                                            <rect key="frame" x="43" y="85" width="374" height="15"/>
+                                                            <textFieldCell key="cell" title="Sign documents or data" id="y1K-Nc-tl4">
+                                                                <font key="font" metaFont="cellTitle"/>
+                                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            </textFieldCell>
+                                                        </textField>
+                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="t29-CD-OUu">
+                                                            <rect key="frame" x="10" y="52" width="20" height="20"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="20" id="lrA-FO-Uv2"/>
+                                                                <constraint firstAttribute="width" constant="20" id="oGg-23-ejn"/>
+                                                            </constraints>
+                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameSigntureTrustedIcon" id="0wa-rW-EmR"/>
+                                                        </imageView>
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ywT-Oi-hLQ">
+                                                            <rect key="frame" x="43" y="55" width="109" height="15"/>
+                                                            <textFieldCell key="cell" title="Certify documents" id="1wt-vF-vbj">
+                                                                <font key="font" metaFont="cellTitle"/>
+                                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            </textFieldCell>
+                                                        </textField>
+                                                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="x52-IR-gai">
+                                                            <rect key="frame" x="106" y="3" width="209" height="32"/>
+                                                            <buttonCell key="cell" type="push" title="Add to Trusted Certificates..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="o6t-bW-sGB">
+                                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                                <font key="font" metaFont="system"/>
+                                                            </buttonCell>
+                                                            <connections>
+                                                                <action selector="buttonItemClick_TrustCer:" target="-2" id="Enw-df-byV"/>
+                                                            </connections>
+                                                        </button>
+                                                    </subviews>
+                                                    <constraints>
+                                                        <constraint firstItem="t29-CD-OUu" firstAttribute="leading" secondItem="9jZ-GA-23C" secondAttribute="leading" id="3Ew-4h-6ZQ"/>
+                                                        <constraint firstAttribute="trailing" secondItem="Zwa-tD-ChV" secondAttribute="trailing" constant="5" id="A37-xK-gRM"/>
+                                                        <constraint firstAttribute="bottom" secondItem="x52-IR-gai" secondAttribute="bottom" constant="10" id="J7r-yb-FKs"/>
+                                                        <constraint firstItem="bHb-ox-Dgw" firstAttribute="leading" secondItem="M7F-Og-A0n" secondAttribute="leading" constant="10" id="b5U-Ja-7b9"/>
+                                                        <constraint firstItem="9jZ-GA-23C" firstAttribute="top" secondItem="bHb-ox-Dgw" secondAttribute="bottom" constant="10" id="cqk-2b-uvZ"/>
+                                                        <constraint firstItem="t29-CD-OUu" firstAttribute="top" secondItem="9jZ-GA-23C" secondAttribute="bottom" constant="10" id="eWu-58-GK7"/>
+                                                        <constraint firstItem="ywT-Oi-hLQ" firstAttribute="centerY" secondItem="t29-CD-OUu" secondAttribute="centerY" id="hdK-8B-V2Z"/>
+                                                        <constraint firstItem="ywT-Oi-hLQ" firstAttribute="leading" secondItem="t29-CD-OUu" secondAttribute="trailing" constant="15" id="kr6-n1-EAJ"/>
+                                                        <constraint firstItem="x52-IR-gai" firstAttribute="top" secondItem="ywT-Oi-hLQ" secondAttribute="bottom" constant="25" id="nAp-16-GAq"/>
+                                                        <constraint firstItem="Zwa-tD-ChV" firstAttribute="leading" secondItem="9jZ-GA-23C" secondAttribute="trailing" constant="15" id="qpa-zq-Uux"/>
+                                                        <constraint firstItem="x52-IR-gai" firstAttribute="centerX" secondItem="M7F-Og-A0n" secondAttribute="centerX" id="taC-Fg-jOQ"/>
+                                                        <constraint firstItem="bHb-ox-Dgw" firstAttribute="top" secondItem="M7F-Og-A0n" secondAttribute="top" constant="5" id="u1z-Dn-KBY"/>
+                                                        <constraint firstItem="9jZ-GA-23C" firstAttribute="leading" secondItem="M7F-Og-A0n" secondAttribute="leading" constant="10" id="v7G-5q-PVe"/>
+                                                        <constraint firstItem="Zwa-tD-ChV" firstAttribute="centerY" secondItem="9jZ-GA-23C" secondAttribute="centerY" id="yZr-uv-HKS"/>
+                                                    </constraints>
+                                                </view>
+                                                <font key="titleFont" metaFont="system" size="10"/>
+                                            </box>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="NDJ-i8-3uk" firstAttribute="trailing" secondItem="oe1-zb-had" secondAttribute="trailing" id="6bC-Th-TMF"/>
+                                            <constraint firstAttribute="trailing" secondItem="oe1-zb-had" secondAttribute="trailing" constant="10" id="D3t-Zz-bBB"/>
+                                            <constraint firstItem="NDJ-i8-3uk" firstAttribute="leading" secondItem="h3u-8E-0DA" secondAttribute="leading" constant="19" id="E0K-CJ-oBU"/>
+                                            <constraint firstAttribute="trailing" secondItem="rx7-Av-ryW" secondAttribute="trailing" constant="10" id="G7B-9z-Keb"/>
+                                            <constraint firstItem="oe1-zb-had" firstAttribute="top" secondItem="rx7-Av-ryW" secondAttribute="bottom" constant="5" id="Gq6-vu-qSL"/>
+                                            <constraint firstItem="NDJ-i8-3uk" firstAttribute="top" secondItem="oe1-zb-had" secondAttribute="bottom" constant="5" id="IGA-yt-5V6"/>
+                                            <constraint firstItem="oe1-zb-had" firstAttribute="leading" secondItem="h3u-8E-0DA" secondAttribute="leading" constant="30" id="b64-tJ-YyX"/>
+                                            <constraint firstItem="rx7-Av-ryW" firstAttribute="leading" secondItem="h3u-8E-0DA" secondAttribute="leading" constant="20" id="cQo-zL-Fy7"/>
+                                            <constraint firstItem="rx7-Av-ryW" firstAttribute="top" secondItem="h3u-8E-0DA" secondAttribute="top" constant="10" id="g1U-3w-g4x"/>
+                                        </constraints>
+                                    </view>
+                                </tabViewItem>
+                                <tabViewItem label="Policies" identifier="" id="ccY-Vh-Cfg">
+                                    <view key="view" id="wTV-zl-mnj">
+                                        <rect key="frame" x="10" y="33" width="451" height="403"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tsQ-xX-nnq">
+                                                <rect key="frame" x="8" y="273" width="435" height="120"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="431" id="EHb-bb-V4I"/>
+                                                </constraints>
+                                                <textFieldCell key="cell" id="gxp-AO-iLN">
+                                                    <font key="font" metaFont="cellTitle"/>
+                                                    <string key="title">Signatures will be valid if the certificate matches this policy restriction.
+Policy restrictions are provided by your computer administrator or the
+certificate authority that issued this certificate. Certificates sometimes
+contain an identifier to indicate the certificate authority's policy for
+issuing the certificate. An example policy might be one which indicates
+that the signer was required to be personally present when issued his or
+her certificate. Only certificates that have been directly trusted (see the
+Trust tab) can have policy restrictions.</string>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstAttribute="trailing" secondItem="tsQ-xX-nnq" secondAttribute="trailing" constant="10" id="BXC-nI-Urt"/>
+                                            <constraint firstItem="tsQ-xX-nnq" firstAttribute="leading" secondItem="wTV-zl-mnj" secondAttribute="leading" constant="10" id="POn-pw-gMN"/>
+                                            <constraint firstItem="tsQ-xX-nnq" firstAttribute="top" secondItem="wTV-zl-mnj" secondAttribute="top" constant="10" id="rJa-l0-sIT"/>
+                                        </constraints>
+                                    </view>
+                                </tabViewItem>
+                                <tabViewItem label="Legal Notice" identifier="" id="E61-9J-dqr">
+                                    <view key="view" id="rWD-ns-8Ez">
+                                        <rect key="frame" x="10" y="33" width="451" height="403"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FoI-XZ-tOx">
+                                                <rect key="frame" x="18" y="387" width="105" height="16"/>
+                                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="Legal Disclamer:" id="dXG-fC-d9F">
+                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aow-2p-9t6">
+                                                <rect key="frame" x="8" y="176" width="428" height="201"/>
+                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                                                <textFieldCell key="cell" id="tNd-Pe-rfL">
+                                                    <font key="font" metaFont="cellTitle"/>
+                                                    <string key="title">Validation of a digitally signed document may require certificate-related services provided by independent third-party service vendors (see Issuer's User Notice below). ComPDFKit does not provide any warranties of any kind with respect to digitally signed documents, certificates used to create digitally signed documents, and any related services. </string>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                        </subviews>
+                                    </view>
+                                </tabViewItem>
+                            </tabViewItems>
+                        </tabView>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="t4H-lY-mGx">
+                            <rect key="frame" x="549" y="18" width="116" height="40"/>
+                            <buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="CYU-0d-tfn">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="104" id="VSJ-CA-qGS"/>
+                            </constraints>
+                            <connections>
+                                <action selector="actionClose:" target="-2" id="rd5-Y5-0zL"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="L4Z-kX-F16" firstAttribute="bottom" secondItem="XlH-77-6Id" secondAttribute="bottom" id="D2m-pL-eGm"/>
+                        <constraint firstItem="88m-bn-D0j" firstAttribute="top" secondItem="z83-GF-kEx" secondAttribute="bottom" constant="15" id="FpP-nB-miL"/>
+                        <constraint firstAttribute="trailing" secondItem="L4Z-kX-F16" secondAttribute="trailing" constant="24" id="IUA-Sa-ROw"/>
+                        <constraint firstItem="88m-bn-D0j" firstAttribute="centerX" secondItem="pra-B5-Nqw" secondAttribute="centerX" id="JpB-LX-66l"/>
+                        <constraint firstItem="z83-GF-kEx" firstAttribute="top" secondItem="pra-B5-Nqw" secondAttribute="top" constant="3" id="Ye6-F5-o2P"/>
+                        <constraint firstItem="XlH-77-6Id" firstAttribute="top" secondItem="88m-bn-D0j" secondAttribute="bottom" constant="10" id="d8G-rc-GVB"/>
+                        <constraint firstAttribute="trailing" secondItem="t4H-lY-mGx" secondAttribute="trailing" constant="24" id="fvw-2x-Xyj"/>
+                        <constraint firstItem="L4Z-kX-F16" firstAttribute="top" secondItem="XlH-77-6Id" secondAttribute="top" id="gPP-tm-Fhu"/>
+                        <constraint firstAttribute="bottom" secondItem="t4H-lY-mGx" secondAttribute="bottom" constant="24" id="mCb-hF-g83"/>
+                        <constraint firstItem="z83-GF-kEx" firstAttribute="centerX" secondItem="pra-B5-Nqw" secondAttribute="centerX" id="sG3-6P-c9i"/>
+                        <constraint firstItem="L4Z-kX-F16" firstAttribute="leading" secondItem="XlH-77-6Id" secondAttribute="trailing" constant="20" id="upb-Ta-ZzF"/>
+                        <constraint firstItem="XlH-77-6Id" firstAttribute="leading" secondItem="pra-B5-Nqw" secondAttribute="leading" constant="24" id="w7r-nA-3sW"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="pra-B5-Nqw" secondAttribute="trailing" id="Aep-za-uFz"/>
+                <constraint firstItem="pra-B5-Nqw" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="PFT-Kh-8H1"/>
+                <constraint firstItem="pra-B5-Nqw" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="Qtm-Yl-9ST"/>
+                <constraint firstAttribute="bottom" secondItem="pra-B5-Nqw" secondAttribute="bottom" id="vyg-mQ-KuX"/>
+            </constraints>
+            <point key="canvasLocation" x="109.5" y="173.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameSigntureTrustedIcon" width="20" height="20"/>
+        <image name="ImageNameSigntureVerifySuccess" width="29" height="29"/>
+    </resources>
+</document>

+ 307 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFileListViewController.swift

@@ -0,0 +1,307 @@
+//
+//  DSignatureFileListViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/27.
+//
+
+import Cocoa
+
+@objcMembers class DSignatureFileListViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSource, NSMenuDelegate {
+    
+    @IBOutlet weak var contendView: NSView!
+    @IBOutlet weak var titleLabel: NSTextField!
+    @IBOutlet weak var subTitleLabel: NSTextField!
+    @IBOutlet weak var tableView: NSTableView!
+    @IBOutlet weak var updateButton: NSButton!
+    @IBOutlet weak var closeButton: NSButton!
+    @IBOutlet weak var createButton: NSButton!
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+    
+    @IBOutlet weak var progressMaskView: NSView!
+    @IBOutlet weak var progressIndicator: NSProgressIndicator!
+    
+    var _isFileList: Bool = false
+    var currentModel: KMDSignatureModel!
+    
+    private var signatureArrays: NSArray!
+    
+    var actionBlock: ((_ fileListVC: DSignatureFileListViewController, _ type: DSignatureActionType)->Void)?
+    var viewCertDetailBlock: ((_ fileListVC: DSignatureFileListViewController, _ certificate: CPDFSignatureCertificate, _ isDigitalFile: Bool)->Void)?
+
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+    }
+    
+    override func viewWillAppear() {
+        super.viewWillAppear()
+        
+        self.reloadData()
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.tableView.delegate = self
+        self.tableView.dataSource = self
+        self.tableView.backgroundColor = NSColor.clear
+        self.tableView.allowsEmptySelection = false
+
+        self.localizedLanguage()
+        
+        self.progressMaskView.isHidden = true
+        
+        let menu = NSMenu.init()
+        menu.delegate = self;
+        self.tableView.menu = menu
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(signatureDidStartLoadNoti), name: NSNotification.Name(rawValue: DSignatureDidStartLoadNotification), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(signatureDidFinishLoadNoti), name: NSNotification.Name(rawValue: DSignatureDidFinishLoadNotification), object: nil)
+        
+    }
+    
+    //MARK: Setter
+    var isFileList: Bool {
+        set {
+            _isFileList = newValue;
+            if(_isFileList) {
+                self.titleLabel.stringValue = NSLocalizedString("Add digital IDs from a file:", comment: "")
+                self.subTitleLabel.stringValue = NSLocalizedString("The following digital ID will be added to your list of digital ID that you can use for digitally signing:", comment: "")
+                self.cancelButton.title = NSLocalizedString("Previous Step", comment: "")
+                self.createButton.isHidden = true
+                self.updateButton.isHidden = true
+            }else {
+                self.titleLabel.stringValue = NSLocalizedString("Sign with a Digital ID", comment: "")
+                self.subTitleLabel.stringValue = NSLocalizedString("Choose the digital ID that you want to use for signing:", comment: "")
+                self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
+                self.createButton.isHidden = false
+                self.updateButton.isHidden = false
+            }
+            self.reloadData()
+        }
+        get {
+            return _isFileList;
+        }
+    }
+    
+    //MARK: Public Method
+    func localizedLanguage() {
+        
+        self.titleLabel.stringValue = NSLocalizedString("Sign with a Digital ID", comment: "")
+        self.subTitleLabel.stringValue = NSLocalizedString("Choose the digital ID that you want to use for signing:", comment: "")
+        self.createButton.title = NSLocalizedString("Configure New Digital ID", comment: "")
+        self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
+        self.updateButton.isHidden = false
+        
+        self.titleLabel.textColor = NSColor.labelColor
+        self.subTitleLabel.textColor = NSColor.labelColor
+        
+        self.continueButton.title = NSLocalizedString("Continue", comment: "")
+        self.updateButton.title = NSLocalizedString("Refresh", comment: "")
+    }
+    
+    func reloadData() {
+        self.signatureArrays = KMDSignatureManager.default().signatures
+        self.tableView.reloadData()
+        if self.signatureArrays.count > 0 {
+            self.tableView.selectRowIndexes([0], byExtendingSelection: true)
+            self.currentModel = self.signatureArrays.firstObject as? KMDSignatureModel
+            self.continueButton.isEnabled = true
+        } else {
+            self.continueButton.isEnabled = false
+        }
+    }
+    
+    func refreshSelectedState() {
+        let selectRow = self.tableView.selectedRow
+        
+        for index in 0...self.tableView.numberOfRows-1 {
+            let rowView = self.tableView.rowView(atRow: index, makeIfNecessary: true)
+            let cellView: DSignatureFileListCellView = rowView?.view(atColumn: 0) as! DSignatureFileListCellView
+            if (index == selectRow) {
+                cellView.radioBtn.state = .on
+            } else {
+                cellView.radioBtn.state = .off
+            }
+        }
+    }
+    
+    func menuItemClick_Delete() {
+        let row = self.tableView.clickedRow
+        
+        if row > -1 && row < self.signatureArrays.count {
+            let model = self.signatureArrays[row] as! KMDSignatureModel
+            if self.isFileList == false && model.isFormKeyChain == false {
+                KMDSignatureManager.default().removeSignatureCertPath(model.filePath)
+            }
+            self.reloadData()
+        }
+    }
+    
+    //MARK: IBAction
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel)
+    }
+    
+    @IBAction func refreshAction(_ sender: Any) {
+        DispatchQueue.main.async {
+            self.progressIndicator.startAnimation(nil)
+            self.progressMaskView.isHidden = false
+            DispatchQueue.global().async {
+                KMDSignatureManager.default().loadAllKeyChainCertificates()
+                DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 1) {
+                    self.progressIndicator.stopAnimation(nil)
+                    self.progressMaskView.isHidden = true
+                }
+            }
+        }
+    }
+    
+    @IBAction func configNewAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .createNewDsign)
+    }
+    
+    @IBAction func cancelAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel)
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .confirm)
+    }
+    
+    //MARK: NSTableViewDelegate
+    func numberOfRows(in tableView: NSTableView) -> Int {
+        if self.isFileList {
+            return 1
+        }
+        return self.signatureArrays?.count ?? 0
+    }
+    
+    func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
+        return 66.0
+    }
+    
+    func tableView(_ tableView: NSTableView, rowViewForRow row: Int) -> NSTableRowView? {
+        let row = KMCustomTableRowView.init()
+        
+        return row
+    }
+    
+    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
+        let cellView = DSignatureFileListCellView()
+        cellView.itemIndex = row
+        if (self.signatureArrays.count > row) {
+            let model = self.signatureArrays[row] as! KMDSignatureModel
+            cellView.signModel = model
+        }
+        if (cellView.signModel == self.currentModel) {
+            cellView.radioBtn.state = .on
+        } else {
+            cellView.radioBtn.state = .off
+        }
+        
+        weak var weakSelf = self
+        cellView.radioActionHandle = {_ in
+            if weakSelf!.tableView.numberOfRows > cellView.itemIndex {
+                weakSelf!.tableView.selectRowIndexes([cellView.itemIndex], byExtendingSelection: false)
+            }
+            weakSelf!.currentModel = weakSelf!.signatureArrays[weakSelf!.tableView.selectedRow] as? KMDSignatureModel
+            weakSelf!.refreshSelectedState()
+        }
+        cellView.viewDetailBlock = {cellView in
+            var filePath: NSString!
+            var save: Bool = true
+            var password: String = ""
+            
+            if cellView.signModel?.isFormKeyChain == true {
+                let folderPath = kDSignatureFolderPath
+                if FileManager.default.fileExists(atPath: folderPath) == false {
+                    let success: ()? = try?FileManager.default.createDirectory(atPath: folderPath, withIntermediateDirectories: false)
+                    if success == nil {
+                        save = false
+                    }
+                }
+                filePath = kDSignatureFolderPath.appending("/KMDSignatures.p12") as NSString
+                save = KMDSignatureManager.exportKeyChain(withP12FilePath: filePath as String?, signatureModel: cellView.signModel, passWord: password as String?)
+                cellView.signModel?.filePath = filePath as? String
+            } else {
+                if cellView.signModel?.password != nil {
+                    password = (cellView.signModel?.password)!
+                }
+                if cellView.signModel?.filePath != nil {
+                    filePath = cellView.signModel?.filePath as? NSString
+                }
+            }
+            
+            if save {
+                var certificate: CPDFSignatureCertificate!
+                certificate = CPDFSignatureCertificate(pkcs12Path: filePath as String?, password: password as String?)
+                if certificate != nil {
+                    guard let callBack = self.viewCertDetailBlock else {
+                        return
+                    }
+                    callBack(self, certificate, !cellView.signModel!.isFormKeyChain)
+                }
+            } else {
+                let alert = NSAlert.init()
+                alert.messageText = NSLocalizedString("Failed to get certificate details!", comment: "")
+                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                alert.runModal()
+            }
+        }
+        return cellView
+    }
+    
+    func tableViewSelectionDidChange(_ notification: Notification) {
+        
+        if (self.signatureArrays.count > self.tableView.selectedRow) {
+            self.currentModel = self.signatureArrays[self.tableView.selectedRow] as? KMDSignatureModel
+            
+            self.refreshSelectedState()
+        }
+    }
+    
+    //MARK: NSMenuDelegate
+    func menuNeedsUpdate(_ menu: NSMenu) {
+        menu.removeAllItems()
+        
+        let row = self.tableView.clickedRow
+        if row > -1 && row < self.signatureArrays.count {
+            let model = self.signatureArrays[row] as! KMDSignatureModel
+            if self.isFileList == false && model.isFormKeyChain == false {
+                menu.addItem(withTitle: NSLocalizedString("Delete", comment: ""), action: #selector(menuItemClick_Delete), keyEquivalent: "")
+            }
+        }
+    }
+    
+    //MARK: Noti
+    func signatureDidStartLoadNoti() {
+        DispatchQueue.main.async {
+            self.progressIndicator.startAnimation(nil)
+            self.progressMaskView.isHidden = false
+        }
+    }
+    
+    func signatureDidFinishLoadNoti() {
+        DispatchQueue.main.async {
+            self.progressIndicator.stopAnimation(nil)
+            self.progressMaskView.isHidden = true
+            
+            self.reloadData()
+        }
+    }
+}

+ 219 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFileListViewController.xib

@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureFileListViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="cancelButton" destination="uAr-fQ-J8e" id="0C4-VZ-Dyb"/>
+                <outlet property="closeButton" destination="1hO-ON-uHC" id="mfb-Nu-kLh"/>
+                <outlet property="contendView" destination="bdx-Yv-xpK" id="wJ4-Pg-r3V"/>
+                <outlet property="continueButton" destination="AsW-Fk-a47" id="gi5-JM-9u1"/>
+                <outlet property="createButton" destination="LVD-av-gkh" id="8Fd-u9-0Ki"/>
+                <outlet property="progressIndicator" destination="ITQ-gd-9dO" id="JZm-8b-8Id"/>
+                <outlet property="progressMaskView" destination="13c-K6-zrj" id="mvm-PM-xHh"/>
+                <outlet property="subTitleLabel" destination="KPA-Xo-Psd" id="Jbf-eV-URx"/>
+                <outlet property="tableView" destination="gNd-x8-q2f" id="ouJ-sC-ZZS"/>
+                <outlet property="titleLabel" destination="xge-pu-Mio" id="WWw-I6-obF"/>
+                <outlet property="updateButton" destination="rYs-VW-zZF" id="61W-oW-A20"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="608" height="499"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="bdx-Yv-xpK">
+                    <rect key="frame" x="0.0" y="0.0" width="608" height="499"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xge-pu-Mio">
+                            <rect key="frame" x="22" y="448" width="184" height="19"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="使用数字身份证进行签名" id="fMR-CV-w2g">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KPA-Xo-Psd">
+                            <rect key="frame" x="18" y="403" width="197" height="17"/>
+                            <constraints>
+                                <constraint firstAttribute="width" relation="lessThanOrEqual" constant="550" id="1NA-ge-TSA"/>
+                            </constraints>
+                            <textFieldCell key="cell" title="选择要用于签名的数字身份证:" id="69m-I5-ryS">
+                                <font key="font" metaFont="systemMedium" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="1hO-ON-uHC">
+                            <rect key="frame" x="568" y="450" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="Jfe-E6-55a">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="A0A-2X-71I"/>
+                            </connections>
+                        </button>
+                        <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hUG-dg-16h">
+                            <rect key="frame" x="24" y="128" width="560" height="268"/>
+                            <clipView key="contentView" drawsBackground="NO" id="DVu-jO-LYj">
+                                <rect key="frame" x="0.0" y="0.0" width="560" height="268"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="gNd-x8-q2f">
+                                        <rect key="frame" x="0.0" y="0.0" width="560" height="268"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <size key="intercellSpacing" width="17" height="0.0"/>
+                                        <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                        <tableColumns>
+                                            <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="548" minWidth="40" maxWidth="1000" id="Tap-IH-ucc">
+                                                <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+                                                    <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                                </tableHeaderCell>
+                                                <textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" title="Text Cell" id="nhH-Jj-SF2">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                                <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                                <prototypeCellViews>
+                                                    <tableCellView id="flJ-cX-vTx">
+                                                        <rect key="frame" x="8" y="0.0" width="543" height="24"/>
+                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                        <subviews>
+                                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MgJ-r1-RZk">
+                                                                <rect key="frame" x="0.0" y="4" width="543" height="16"/>
+                                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+                                                                <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="xBU-Sl-3BR">
+                                                                    <font key="font" usesAppearanceFont="YES"/>
+                                                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                </textFieldCell>
+                                                            </textField>
+                                                        </subviews>
+                                                        <connections>
+                                                            <outlet property="textField" destination="MgJ-r1-RZk" id="4wi-wu-aFG"/>
+                                                        </connections>
+                                                    </tableCellView>
+                                                </prototypeCellViews>
+                                            </tableColumn>
+                                        </tableColumns>
+                                    </tableView>
+                                </subviews>
+                                <nil key="backgroundColor"/>
+                            </clipView>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="560" id="f6D-s2-rgV"/>
+                            </constraints>
+                            <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="TLS-TO-09x">
+                                <rect key="frame" x="-100" y="-100" width="223" height="15"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                            </scroller>
+                            <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Aeq-5A-wnx">
+                                <rect key="frame" x="-100" y="-100" width="15" height="102"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                            </scroller>
+                        </scrollView>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="LVD-av-gkh">
+                            <rect key="frame" x="316" y="14" width="152" height="40"/>
+                            <buttonCell key="cell" type="push" title="配置新的数字身份证" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="RjV-Ls-ZhQ">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="configNewAction:" target="-2" id="QEq-kL-5uT"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uAr-fQ-J8e">
+                            <rect key="frame" x="468" y="14" width="59" height="40"/>
+                            <buttonCell key="cell" type="push" title="取消" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="QPt-kH-X5G">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="cancelAction:" target="-2" id="DqT-v5-X2p"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AsW-Fk-a47">
+                            <rect key="frame" x="527" y="14" width="59" height="40"/>
+                            <buttonCell key="cell" type="push" title="继续" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="jp8-d2-Gbh">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="uvd-UK-hHF"/>
+                            </connections>
+                        </button>
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="13c-K6-zrj">
+                            <rect key="frame" x="0.0" y="0.0" width="608" height="420"/>
+                            <subviews>
+                                <progressIndicator maxValue="100" indeterminate="YES" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="ITQ-gd-9dO">
+                                    <rect key="frame" x="288" y="194" width="32" height="32"/>
+                                </progressIndicator>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="ITQ-gd-9dO" firstAttribute="centerY" secondItem="13c-K6-zrj" secondAttribute="centerY" id="clN-UE-l1f"/>
+                                <constraint firstItem="ITQ-gd-9dO" firstAttribute="centerX" secondItem="13c-K6-zrj" secondAttribute="centerX" id="n5e-R2-IhR"/>
+                            </constraints>
+                        </customView>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rYs-VW-zZF">
+                            <rect key="frame" x="531" y="392" width="59" height="40"/>
+                            <buttonCell key="cell" type="push" title="刷新" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="V8b-uk-Lgi">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="refreshAction:" target="-2" id="UIe-wd-dGD"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="rYs-VW-zZF" secondAttribute="trailing" constant="24" id="07Z-ro-ZdP"/>
+                        <constraint firstItem="uAr-fQ-J8e" firstAttribute="leading" secondItem="LVD-av-gkh" secondAttribute="trailing" constant="12" id="17l-yZ-KtX"/>
+                        <constraint firstItem="KPA-Xo-Psd" firstAttribute="leading" secondItem="bdx-Yv-xpK" secondAttribute="leading" constant="20" id="9Mx-0V-O7u"/>
+                        <constraint firstAttribute="bottom" secondItem="13c-K6-zrj" secondAttribute="bottom" id="CjV-O7-Bp3"/>
+                        <constraint firstItem="AsW-Fk-a47" firstAttribute="leading" secondItem="uAr-fQ-J8e" secondAttribute="trailing" constant="12" id="Clg-7R-MsO"/>
+                        <constraint firstAttribute="trailing" secondItem="AsW-Fk-a47" secondAttribute="trailing" constant="28" id="JsL-jd-ZiB"/>
+                        <constraint firstItem="1hO-ON-uHC" firstAttribute="centerY" secondItem="xge-pu-Mio" secondAttribute="centerY" id="KdA-Hd-kMM"/>
+                        <constraint firstItem="AsW-Fk-a47" firstAttribute="centerY" secondItem="uAr-fQ-J8e" secondAttribute="centerY" id="N7D-vS-fcr"/>
+                        <constraint firstAttribute="bottom" secondItem="AsW-Fk-a47" secondAttribute="bottom" constant="20" id="Ng3-oa-LIS"/>
+                        <constraint firstItem="hUG-dg-16h" firstAttribute="centerX" secondItem="bdx-Yv-xpK" secondAttribute="centerX" id="Ny5-kb-34P"/>
+                        <constraint firstItem="AsW-Fk-a47" firstAttribute="top" secondItem="hUG-dg-16h" secondAttribute="bottom" constant="80" id="O3T-98-IgH"/>
+                        <constraint firstItem="13c-K6-zrj" firstAttribute="leading" secondItem="bdx-Yv-xpK" secondAttribute="leading" id="PFR-3A-L1n"/>
+                        <constraint firstItem="hUG-dg-16h" firstAttribute="top" secondItem="KPA-Xo-Psd" secondAttribute="bottom" constant="7" id="YNy-uG-eIc"/>
+                        <constraint firstItem="xge-pu-Mio" firstAttribute="leading" secondItem="bdx-Yv-xpK" secondAttribute="leading" constant="24" id="arU-16-hpy"/>
+                        <constraint firstItem="rYs-VW-zZF" firstAttribute="centerY" secondItem="KPA-Xo-Psd" secondAttribute="centerY" id="bQR-SH-5z8"/>
+                        <constraint firstAttribute="trailing" secondItem="1hO-ON-uHC" secondAttribute="trailing" constant="24" id="jp7-RG-7Ky"/>
+                        <constraint firstItem="uAr-fQ-J8e" firstAttribute="centerY" secondItem="LVD-av-gkh" secondAttribute="centerY" id="rk3-iX-IPP"/>
+                        <constraint firstItem="KPA-Xo-Psd" firstAttribute="top" secondItem="xge-pu-Mio" secondAttribute="bottom" constant="28" id="uAZ-Yy-apj"/>
+                        <constraint firstAttribute="trailing" secondItem="13c-K6-zrj" secondAttribute="trailing" id="wdS-Sd-3qh"/>
+                        <constraint firstItem="13c-K6-zrj" firstAttribute="top" secondItem="KPA-Xo-Psd" secondAttribute="top" id="yTY-aT-Wep"/>
+                        <constraint firstItem="xge-pu-Mio" firstAttribute="top" secondItem="bdx-Yv-xpK" secondAttribute="top" constant="32" id="yhM-Mk-4SO"/>
+                        <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="xge-pu-Mio" secondAttribute="trailing" constant="20" id="zB2-a9-RA7"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="bdx-Yv-xpK" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="0UX-w1-LXz"/>
+                <constraint firstItem="bdx-Yv-xpK" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="ON1-IW-OPT"/>
+                <constraint firstAttribute="bottom" secondItem="bdx-Yv-xpK" secondAttribute="bottom" id="UYZ-B1-JQr"/>
+                <constraint firstAttribute="trailing" secondItem="bdx-Yv-xpK" secondAttribute="trailing" id="VrJ-S9-0QV"/>
+            </constraints>
+            <point key="canvasLocation" x="-29" y="91"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+    </resources>
+</document>

+ 175 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFromFileViewController.swift

@@ -0,0 +1,175 @@
+//
+//  DSignatureFromFileViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureFromFileViewController: NSViewController, NSTextFieldDelegate {
+
+    @IBOutlet weak var titleLabel: NSTextField!
+    @IBOutlet weak var subTitleLabel: NSTextField!
+    
+    @IBOutlet weak var filesLabel: NSTextField!
+    @IBOutlet weak var filesTextFiled: NSTextField!
+    @IBOutlet weak var passwordLabel: NSTextField!
+    @IBOutlet weak var passwordTextFiled: NSSecureTextField!
+    @IBOutlet weak var browseButton: NSButton!
+    @IBOutlet weak var errorLabel: NSTextField!
+    
+    @IBOutlet weak var promptBox: NSBox!
+    @IBOutlet var promptTextView: NSTextView!
+    
+    @IBOutlet weak var continueButton: NSButton!
+    @IBOutlet weak var previousStepButton: NSButton!
+    @IBOutlet weak var creatButton: NSButton!
+    
+
+    var actionBlock: ((_ fromFileVC:DSignatureFromFileViewController, _ action:DSignatureActionType, _ cer:NSDictionary)->Void)?
+    
+    override func viewWillAppear() {
+        super.viewWillAppear()
+        
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.filesTextFiled.delegate = self
+        self.passwordTextFiled.delegate = self
+        
+        self.localizedLanguage()
+        
+        self.titleLabel.textColor = NSColor.labelColor
+        self.subTitleLabel.textColor = NSColor.labelColor
+        self.filesLabel.textColor = NSColor.labelColor
+        self.passwordLabel.textColor = NSColor.labelColor
+        
+        self.filesTextFiled.textColor = NSColor.labelColor
+        self.passwordTextFiled.textColor = NSColor.labelColor
+        
+        self.promptTextView.textColor = NSColor.labelColor
+        
+        self.filesTextFiled.wantsLayer = true
+        self.passwordTextFiled.wantsLayer = true
+        
+        self.filesTextFiled.layer?.borderWidth = 1
+        self.passwordTextFiled.layer?.borderWidth = 1
+        
+        self.filesTextFiled.layer?.cornerRadius = 5
+        self.passwordTextFiled.layer?.cornerRadius = 5
+        
+        self.passwordTextFiled.updateState(false)
+        self.errorLabel.isHidden = true
+        
+        self.filesTextFiled.updateState(false)
+        
+    }
+    
+    func localizedLanguage() {
+        self.titleLabel.stringValue = NSLocalizedString("Find a Digital ID File", comment: "")
+        self.subTitleLabel.stringValue = NSLocalizedString("Browse for a digital ID file. Digital ID files are password protected. You cannot access the digital ID if you don't know its password.", comment: "");
+        self.filesLabel.stringValue = NSLocalizedString("File",comment: "");
+        self.passwordLabel.stringValue = NSLocalizedString("Password",comment: "");
+        self.filesTextFiled.placeholderString  = NSLocalizedString("Select a file", comment: "");
+        self.promptTextView.string = String(format: "%@\n\n%@",NSLocalizedString("Digital ID files generally have a P12 extension and contain the public key file (Certificate) and the associated private key file.", comment: ""),NSLocalizedString("To sign with a digital ID available as a file, follow the prompts to browse and select the file and type the password protecting the private key.",comment: ""))
+        self.errorLabel.stringValue = NSLocalizedString("Password is incorrect. Please re-enter the password.", comment: "")
+        
+        self.browseButton.title = String(format:"%@",NSLocalizedString("Browse", comment: ""))
+        self.previousStepButton.title = NSLocalizedString("Previous Step",comment: "");
+        self.creatButton.title = NSLocalizedString("Configure New Digital ID", comment: "");
+        self.continueButton.title = NSLocalizedString("Continue", comment: "");
+    }
+    
+    func updateTextFiedState() {
+        if (self.filesTextFiled.stringValue.isEmpty == false) {
+            self.filesTextFiled.updateState(false)
+        } else {
+            self.filesTextFiled.updateState(true)
+        }
+        
+        if self.filesTextFiled.stringValue.isEmpty == false {
+            self.continueButton.isEnabled = true
+        } else {
+            self.continueButton.isEnabled = false
+        }
+    }
+    
+    //MARK: IBAction
+    
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, NSDictionary())
+    }
+    
+    @IBAction func fileBrowse(_ sender: Any) {
+        let openPanel = NSOpenPanel()
+        openPanel.allowedFileTypes = ["p12","pfx"]
+        openPanel.beginSheetModal(for: self.view.window!) { result in
+            if result == .OK {
+                let fileURL = openPanel.urls.first
+                self.filesTextFiled.stringValue = fileURL!.path
+            }
+            self.updateTextFiedState()
+        }
+    }
+    
+    @IBAction func configNewAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .createNewDsign, NSDictionary())
+    }
+    
+    @IBAction func previousAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, NSDictionary())
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        let filePath = self.filesTextFiled.stringValue
+        if FileManager.default.fileExists(atPath: filePath) {
+            let identity = KMDSignatureManager.privateKeyUsingSecItemImport(fromP12File: filePath, password: self.passwordTextFiled.stringValue)
+            if identity != nil {
+                let dic = NSMutableDictionary.init()
+                dic.setValue(filePath, forKey: SAVEFILEPATH_KEY)
+                dic.setValue(self.passwordTextFiled.stringValue, forKey: PASSWORD_KEY)
+                
+                let moveSuc = KMDSignatureManager.default().moveP12DigitalFile(withFilePath: filePath, password: self.passwordTextFiled.stringValue)
+                if moveSuc {
+                    guard let callBack = self.actionBlock else {
+                        return
+                    }
+                    callBack(self, .confirm, dic)
+                } else {
+                    let alert = NSAlert.init()
+                    alert.messageText = NSLocalizedString("Failed to import the P12 file!", comment: "")
+                    alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                    alert.runModal()
+                }
+            } else {
+                self.errorLabel.isHidden = false
+            }
+        }
+    }
+    
+    //MARK: NSTextFieldDelegate
+    func controlTextDidChange(_ obj: Notification) {
+        
+        self.updateTextFiedState()
+        
+        let textField = obj.object;
+        if self.passwordTextFiled.isEqual(textField) {
+            self.filesTextFiled.updateState(false)
+        }
+        self.errorLabel.isHidden = true
+    }
+    
+}

+ 283 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureFromFileViewController.xib

@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureFromFileViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="browseButton" destination="n8n-Pr-18X" id="cwN-dB-j53"/>
+                <outlet property="continueButton" destination="yii-Lz-iqJ" id="zQw-4T-ipA"/>
+                <outlet property="creatButton" destination="RB8-RQ-AtV" id="nOk-gL-NT0"/>
+                <outlet property="errorLabel" destination="O3b-DR-DOm" id="oDV-EF-qcy"/>
+                <outlet property="filesLabel" destination="YsH-S2-K9b" id="aOH-AX-hnd"/>
+                <outlet property="filesTextFiled" destination="4s6-Wc-Exg" id="7oJ-jU-eFB"/>
+                <outlet property="passwordLabel" destination="p3o-vr-cMG" id="jAU-KR-SGD"/>
+                <outlet property="passwordTextFiled" destination="SJX-Tq-pGK" id="JJ5-Hv-fYB"/>
+                <outlet property="previousStepButton" destination="ybD-kL-4u9" id="YMD-2o-BUL"/>
+                <outlet property="promptBox" destination="Kjx-at-xqR" id="Bww-Ai-ZHz"/>
+                <outlet property="promptTextView" destination="RdC-LU-0Cc" id="PuW-Qw-hPK"/>
+                <outlet property="subTitleLabel" destination="Qob-25-uce" id="yly-8w-Hwh"/>
+                <outlet property="titleLabel" destination="rgg-ks-uiz" id="WOx-1g-dc1"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="600" height="410"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="Qup-CS-tka">
+                    <rect key="frame" x="0.0" y="0.0" width="600" height="410"/>
+                    <subviews>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="zXq-Qn-r7f">
+                            <rect key="frame" x="564" y="373" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="mVY-0q-SHN">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="y7A-td-3Qy"/>
+                            </connections>
+                        </button>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rgg-ks-uiz">
+                            <rect key="frame" x="22" y="371" width="147" height="19"/>
+                            <textFieldCell key="cell" title="Find a Digital ID file" id="E0i-bv-RDS">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Qob-25-uce">
+                            <rect key="frame" x="18" y="327" width="524" height="34"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="520" id="2j5-0f-kfV"/>
+                            </constraints>
+                            <textFieldCell key="cell" id="Oo1-Mu-CbA">
+                                <font key="font" metaFont="systemMedium" size="14"/>
+                                <string key="title">Browse for a Digital ID file. Digital ID files are password protected. You cannot access the Digital ID if you don't know its password.</string>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bIs-xc-o5z">
+                            <rect key="frame" x="20" y="234" width="560" height="73"/>
+                            <view key="contentView" id="HH5-ct-6c3">
+                                <rect key="frame" x="0.0" y="0.0" width="560" height="73"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="HIS-nv-0bb">
+                                        <rect key="frame" x="0.0" y="0.0" width="64" height="73"/>
+                                        <subviews>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YsH-S2-K9b">
+                                                <rect key="frame" x="-2" y="51" width="68" height="17"/>
+                                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Files" id="wWQ-iH-qao">
+                                                    <font key="font" metaFont="systemMedium" size="14"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p3o-vr-cMG">
+                                                <rect key="frame" x="-2" y="5" width="68" height="17"/>
+                                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Password" id="Xeh-ae-CDM">
+                                                    <font key="font" metaFont="systemMedium" size="14"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="64" id="3bu-QM-St1"/>
+                                            <constraint firstAttribute="height" constant="73" id="Jd8-5A-jgI"/>
+                                        </constraints>
+                                    </customView>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4s6-Wc-Exg">
+                                        <rect key="frame" x="74" y="44" width="413" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="5a1-qD-u9G"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" alignment="left" drawsBackground="YES" id="OwB-8w-hXa" customClass="KMTextFieldCenterCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="n8n-Pr-18X">
+                                        <rect key="frame" x="493" y="39" width="73" height="40"/>
+                                        <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="TG7-SL-jiD">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="61" id="Bq9-KI-yFw"/>
+                                            <constraint firstAttribute="height" constant="28" id="Lqe-O5-CjW"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="fileBrowse:" target="-2" id="aHc-gS-8xY"/>
+                                        </connections>
+                                    </button>
+                                    <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SJX-Tq-pGK">
+                                        <rect key="frame" x="74" y="0.0" width="413" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="Rcf-ev-lAp"/>
+                                        </constraints>
+                                        <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" drawsBackground="YES" usesSingleLineMode="YES" id="htS-QD-3W5">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <allowedInputSourceLocales>
+                                                <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+                                            </allowedInputSourceLocales>
+                                        </secureTextFieldCell>
+                                    </secureTextField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="SJX-Tq-pGK" firstAttribute="top" secondItem="4s6-Wc-Exg" secondAttribute="bottom" constant="16" id="01w-Gm-GcG"/>
+                                    <constraint firstAttribute="trailing" secondItem="n8n-Pr-18X" secondAttribute="trailing" id="1mU-sj-E6y"/>
+                                    <constraint firstItem="n8n-Pr-18X" firstAttribute="leading" secondItem="4s6-Wc-Exg" secondAttribute="trailing" constant="12" id="5ac-6N-z12"/>
+                                    <constraint firstItem="HIS-nv-0bb" firstAttribute="top" secondItem="HH5-ct-6c3" secondAttribute="top" id="HOL-d0-O0w"/>
+                                    <constraint firstItem="4s6-Wc-Exg" firstAttribute="top" secondItem="HH5-ct-6c3" secondAttribute="top" constant="1" id="KV3-wI-rQt"/>
+                                    <constraint firstItem="SJX-Tq-pGK" firstAttribute="trailing" secondItem="4s6-Wc-Exg" secondAttribute="trailing" id="MSP-dX-sI2"/>
+                                    <constraint firstItem="HIS-nv-0bb" firstAttribute="leading" secondItem="HH5-ct-6c3" secondAttribute="leading" id="ZWq-CA-gr7"/>
+                                    <constraint firstItem="n8n-Pr-18X" firstAttribute="top" secondItem="HH5-ct-6c3" secondAttribute="top" id="lMQ-Aj-yvS"/>
+                                    <constraint firstItem="4s6-Wc-Exg" firstAttribute="leading" secondItem="HIS-nv-0bb" secondAttribute="trailing" constant="10" id="ubc-5w-317"/>
+                                    <constraint firstItem="SJX-Tq-pGK" firstAttribute="leading" secondItem="HIS-nv-0bb" secondAttribute="trailing" constant="10" id="vIs-mx-t8A"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="73" id="79l-ht-xJa"/>
+                            </constraints>
+                        </box>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="O3b-DR-DOm">
+                            <rect key="frame" x="94" y="215" width="323" height="16"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Password is incorrect. Please re-enter the password." id="8OA-W6-sy5">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" red="0.74901960779999999" green="0.18823529410000001" blue="0.18823529410000001" alpha="1" colorSpace="calibratedRGB"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <box titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Kjx-at-xqR">
+                            <rect key="frame" x="17" y="94" width="566" height="112"/>
+                            <view key="contentView" id="pNd-B6-du6">
+                                <rect key="frame" x="4" y="5" width="558" height="104"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o1e-Is-cIk">
+                                        <rect key="frame" x="12" y="12" width="534" height="80"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                        <clipView key="contentView" drawsBackground="NO" id="gjl-Y6-KVE">
+                                            <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textView editable="NO" selectable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="RdC-LU-0Cc">
+                                                    <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <size key="minSize" width="534" height="80"/>
+                                                    <size key="maxSize" width="1658" height="10000000"/>
+                                                    <attributedString key="textStorage">
+                                                        <fragment>
+                                                            <string key="content">Digital ID files generally have a PFX or P12 extension and contain the public key file (Certificate) and the associated private key file./n/nTo sign with a digital ID available as a file, follow the prompts to browse and select the file and type the password protecting the private key.</string>
+                                                            <attributes>
+                                                                <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                                <font key="NSFont" size="12" name="Helvetica"/>
+                                                                <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                                            </attributes>
+                                                        </fragment>
+                                                    </attributedString>
+                                                    <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                </textView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                        </clipView>
+                                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Hih-aW-3Vs">
+                                            <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                        <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="oTa-Sl-Tof">
+                                            <rect key="frame" x="-100" y="-100" width="15" height="135"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                    </scrollView>
+                                </subviews>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="106" id="kRx-g9-5UV"/>
+                            </constraints>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RB8-RQ-AtV">
+                            <rect key="frame" x="184" y="18" width="181" height="40"/>
+                            <buttonCell key="cell" type="push" title="Configure New Digital ID" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="reN-y0-lwV">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="configNewAction:" target="-2" id="C0v-5a-qNd"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ybD-kL-4u9">
+                            <rect key="frame" x="384" y="18" width="115" height="40"/>
+                            <buttonCell key="cell" type="push" title="Previous step" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6Rb-rw-GvR">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="previousAction:" target="-2" id="cnQ-W1-9gz"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yii-Lz-iqJ">
+                            <rect key="frame" x="499" y="18" width="87" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Qdc-B9-Dzz">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="uJX-Uo-qXn"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstAttribute="bottom" secondItem="yii-Lz-iqJ" secondAttribute="bottom" constant="24" id="3i0-re-Ep2"/>
+                        <constraint firstItem="Qob-25-uce" firstAttribute="top" secondItem="rgg-ks-uiz" secondAttribute="bottom" constant="10" id="CXK-ax-cnA"/>
+                        <constraint firstItem="Kjx-at-xqR" firstAttribute="top" secondItem="bIs-xc-o5z" secondAttribute="bottom" constant="30" id="Ifj-20-NCE"/>
+                        <constraint firstItem="Qob-25-uce" firstAttribute="leading" secondItem="Qup-CS-tka" secondAttribute="leading" constant="20" id="N4X-7H-rDj"/>
+                        <constraint firstItem="zXq-Qn-r7f" firstAttribute="centerY" secondItem="rgg-ks-uiz" secondAttribute="centerY" id="NmB-vD-xer"/>
+                        <constraint firstAttribute="trailing" secondItem="zXq-Qn-r7f" secondAttribute="trailing" constant="20" id="VjW-Zb-aT0"/>
+                        <constraint firstAttribute="trailing" secondItem="Kjx-at-xqR" secondAttribute="trailing" constant="20" id="VsF-xR-AoQ"/>
+                        <constraint firstItem="Kjx-at-xqR" firstAttribute="leading" secondItem="Qup-CS-tka" secondAttribute="leading" constant="20" id="Xc6-mD-3qt"/>
+                        <constraint firstAttribute="trailing" secondItem="bIs-xc-o5z" secondAttribute="trailing" constant="20" id="aIN-NP-w0s"/>
+                        <constraint firstItem="ybD-kL-4u9" firstAttribute="leading" secondItem="RB8-RQ-AtV" secondAttribute="trailing" constant="31" id="aMg-LP-pW1"/>
+                        <constraint firstItem="bIs-xc-o5z" firstAttribute="top" secondItem="Qob-25-uce" secondAttribute="bottom" constant="20" id="cil-mS-qtg"/>
+                        <constraint firstItem="yii-Lz-iqJ" firstAttribute="centerY" secondItem="ybD-kL-4u9" secondAttribute="centerY" id="cvW-8D-yqZ"/>
+                        <constraint firstItem="bIs-xc-o5z" firstAttribute="leading" secondItem="Qup-CS-tka" secondAttribute="leading" constant="20" id="iHB-2V-sQ5"/>
+                        <constraint firstAttribute="trailing" secondItem="yii-Lz-iqJ" secondAttribute="trailing" constant="20" id="kIw-hh-Fiz"/>
+                        <constraint firstItem="yii-Lz-iqJ" firstAttribute="leading" secondItem="ybD-kL-4u9" secondAttribute="trailing" constant="12" id="krF-Fy-L24"/>
+                        <constraint firstItem="ybD-kL-4u9" firstAttribute="centerY" secondItem="RB8-RQ-AtV" secondAttribute="centerY" id="shs-nC-u4H"/>
+                        <constraint firstItem="rgg-ks-uiz" firstAttribute="leading" secondItem="Qup-CS-tka" secondAttribute="leading" constant="24" id="x8f-5Y-KPr"/>
+                        <constraint firstItem="rgg-ks-uiz" firstAttribute="top" secondItem="Qup-CS-tka" secondAttribute="top" constant="20" id="ytc-dJ-wQH"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="Qup-CS-tka" secondAttribute="trailing" id="DJf-ef-A4p"/>
+                <constraint firstItem="Qup-CS-tka" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="X4z-QK-CT6"/>
+                <constraint firstItem="Qup-CS-tka" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="bZB-i5-4rD"/>
+                <constraint firstAttribute="bottom" secondItem="Qup-CS-tka" secondAttribute="bottom" id="ynS-SN-ju5"/>
+            </constraints>
+            <point key="canvasLocation" x="171" y="182.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+    </resources>
+</document>

+ 246 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveFolderViewController.swift

@@ -0,0 +1,246 @@
+//
+//  DSignatureSaveFolderViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureSaveFolderViewController: NSViewController, NSTextFieldDelegate {
+
+    
+    @IBOutlet weak var titleLabel: NSTextField!
+    @IBOutlet weak var subTitleLabel: NSTextField!
+    
+    @IBOutlet weak var filesLabel: NSTextField!
+    @IBOutlet weak var passwordLabel: NSTextField!
+    @IBOutlet weak var confirmPasswordLabel: NSTextField!
+    @IBOutlet weak var filesTextField: NSTextField!
+    @IBOutlet weak var passwordTextField: NSSecureTextField!
+    @IBOutlet weak var confirmPasswordTextField: NSSecureTextField!
+    @IBOutlet weak var errorLabel: NSTextField!
+    @IBOutlet weak var openFileButton: NSButton!
+    
+    @IBOutlet weak var promptBox: NSBox!
+    @IBOutlet var promptTextView: NSTextView!
+    
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+   
+//    @property(nonatomic) IBOutlet NSLayoutConstraint *bottomOffset;
+    
+    
+    var actionBlock: ((_ saveFolderVC: DSignatureSaveFolderViewController, _ actionType: DSignatureActionType, _ infoDic: NSDictionary)->Void)?
+    
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.titleLabel.textColor = NSColor.labelColor
+        self.subTitleLabel.textColor = NSColor.labelColor
+         
+        self.filesLabel.textColor = NSColor.labelColor
+        self.passwordLabel.textColor = NSColor.labelColor
+        self.confirmPasswordLabel.textColor = NSColor.labelColor
+        
+        self.filesTextField.textColor = NSColor.labelColor
+        self.passwordTextField.textColor = NSColor.labelColor
+        self.confirmPasswordTextField.textColor = NSColor.labelColor
+        
+        self.promptTextView.textColor = NSColor.labelColor
+        
+//        self.bottomOffset.constant = 25.0;
+        self.errorLabel.isHidden = true
+        
+        self.filesTextField.wantsLayer = true
+        self.passwordTextField.wantsLayer = true
+        self.confirmPasswordTextField.wantsLayer = true
+        self.filesTextField.delegate = self;
+        self.filesTextField.isEnabled = false
+        
+        self.filesTextField.layer?.borderWidth = 1.0
+        self.passwordTextField.layer?.borderWidth = 1.0
+        self.confirmPasswordTextField.layer?.borderWidth = 1.0;
+        
+        self.filesTextField.updateState(false)
+        self.passwordTextField.layer?.borderColor = NSColor.clear.cgColor
+        self.confirmPasswordTextField.layer?.borderColor = NSColor.clear.cgColor
+        
+        self.filesTextField.layer?.cornerRadius = 5.0
+        self.passwordTextField.layer?.cornerRadius = 5.0
+        self.confirmPasswordTextField.layer?.cornerRadius = 5.0;
+        
+        self.filesTextField.delegate = self
+        self.confirmPasswordTextField.delegate = self
+        
+        self.localizedLanguage()
+        
+        if self.filesTextField.stringValue.isEmpty == false {
+            self.continueButton.isEnabled = true
+        } else {
+            self.continueButton.isEnabled = false
+        }
+    }
+
+    func localizedLanguage() {
+        self.titleLabel.stringValue = NSLocalizedString("Save the Self-signed Digital ID to a File", comment: "");
+        self.subTitleLabel.stringValue = NSLocalizedString("Your digital ID will be saved at the following location :", comment: "")
+        self.filesLabel.stringValue = NSLocalizedString("File", comment: "");
+        self.passwordLabel.stringValue = NSLocalizedString("Password", comment: "")
+        self.confirmPasswordLabel.stringValue = NSLocalizedString("Confirm the Password", comment: "")
+
+        self.promptTextView.string = String(format: "%@\n\n%@",NSLocalizedString("Add a password to protect the private key of the digital ID. You will need this password again to use the digital ID for signing.", comment: ""), NSLocalizedString("Save the digital ID file in a known location so that you can copy or backup it.", comment: ""))
+        
+        self.cancelButton.title = NSLocalizedString("Previous Step", comment: "")
+        self.continueButton.title = NSLocalizedString("Continue", comment: "")
+        self.openFileButton.title = String(format: "%@",NSLocalizedString("Browse", comment: ""))
+        self.errorLabel.stringValue = NSLocalizedString("Passwords do not match", comment: "")
+    }
+    
+    func getUniqueFilePath(_ filePath: String) -> (String) {
+        var i = 0
+        var isDirectory: ObjCBool = false
+        var uniqueFilePath = filePath
+        
+        let filemanager = FileManager.default
+        filemanager.fileExists(atPath: uniqueFilePath, isDirectory: &isDirectory)
+        if isDirectory.boolValue {
+            while filemanager.fileExists(atPath: uniqueFilePath) {
+                i += 1
+                uniqueFilePath = String(format: "%@(%d)", filePath, i)
+            }
+        } else {
+            while filemanager.fileExists(atPath: uniqueFilePath) {
+                i += 1
+                let fileURL = URL(fileURLWithPath: filePath)
+                let path = String(format: "%@(%d)", fileURL.deletingPathExtension().path, i)
+                uniqueFilePath = String(format: "%@.%@", path, fileURL.pathExtension)
+            }
+        }
+        
+        return uniqueFilePath
+    }
+    
+    
+    //MARK: IBAction
+    @IBAction func penFile(_ sender: Any) {
+        let accessoryCtr = PDFCertExportAccessoryView.init()
+        
+        let openPanel = NSOpenPanel()
+        openPanel.accessoryView = accessoryCtr.view
+        openPanel.canChooseDirectories = true
+        openPanel.canChooseFiles = false
+        openPanel.beginSheetModal(for: self.view.window!) { result in
+            if result == .OK {
+                let outputULR = openPanel.url!
+                var filePath = outputULR.path
+                if accessoryCtr.formatMatrix.selectedRow == 0 {
+                    filePath = filePath + "/Untitled.p12"
+                } else {
+                    filePath = filePath + "/Untitled.pfx"
+                }
+                self.filesTextField.stringValue = self.getUniqueFilePath(filePath)
+                
+                if self.filesTextField.stringValue.isEmpty {
+                    self.filesTextField.updateState(true)
+                } else {
+                    self.filesTextField.updateState(false)
+                }
+                
+                if self.filesTextField.stringValue.isEmpty == false {
+                    self.continueButton.isEnabled = true
+                } else {
+                    self.continueButton.isEnabled = false
+                }
+                
+            }
+            
+        }
+        
+    }
+    
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, NSDictionary())
+    }
+    
+    @IBAction func previousAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, NSDictionary())
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        self.view.window?.makeFirstResponder(nil)
+        if self.filesTextField.stringValue.count < 1 {
+            return
+        }
+        if self.confirmPasswordTextField.stringValue == self.passwordTextField.stringValue {
+            var isDir: ObjCBool = false
+            
+            let filePath = URL(fileURLWithPath: self.filesTextField.stringValue)
+            let parentDirectory = filePath.deletingLastPathComponent().path
+
+            let isExists = FileManager.default.fileExists(atPath: parentDirectory, isDirectory: &isDir)
+            if isDir.boolValue == false || isExists == false {
+                let alert = NSAlert.init()
+                alert.messageText = NSLocalizedString("Output Folder can not be empty.", comment: "")
+                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                alert.runModal()
+                return
+            }
+            let dic = NSMutableDictionary()
+            dic.setValue(self.filesTextField.stringValue, forKey: SAVEFILEPATH_KEY)
+            if self.passwordTextField.stringValue.count > 0 {
+                dic.setValue(self.passwordTextField.stringValue, forKey: PASSWORD_KEY)
+            }
+            self.errorLabel.isHidden = true
+//            self.bottomOffset.constant = 25.0;
+            
+            guard let callBack = self.actionBlock else {
+                return
+            }
+            callBack(self, .confirm, dic)
+        } else {
+            self.errorLabel.isHidden = false
+//            self.bottomOffset.constant = self.errorLabel.frame.size.height + 10;
+        }
+    }
+    
+    //MARK: NSTextFieldDelegate
+    func controlTextDidChange(_ obj: Notification) {
+        
+        if self.filesTextField.stringValue.isEmpty == false {
+            self.continueButton.isEnabled = true
+        } else {
+            self.continueButton.isEnabled = false
+        }
+        
+        let textField = obj.object as! NSTextField
+        if self.filesTextField.isEqual(textField) {
+            if self.filesTextField.stringValue.isEmpty == false {
+                self.filesTextField.updateState(false)
+            } else {
+                self.filesTextField.updateState(true)
+            }
+        }
+        
+        self.errorLabel.isHidden = true
+//        self.bottomOffset.constant = 25.0;
+    }
+}
+
+extension NSTextField {
+    func updateState(_ isError: Bool) {
+        if isError {
+            self.layer?.borderColor = NSColor.systemRed.cgColor
+        } else {
+            self.layer?.borderColor = NSColor.clear.cgColor
+        }
+    }
+}

+ 303 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveFolderViewController.xib

@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureSaveFolderViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="cancelButton" destination="EIz-uX-r20" id="G4q-PK-AUh"/>
+                <outlet property="confirmPasswordLabel" destination="mSz-C4-9c0" id="kFO-uI-npz"/>
+                <outlet property="confirmPasswordTextField" destination="wJh-2B-QMM" id="gUZ-Ui-4KS"/>
+                <outlet property="continueButton" destination="Z9P-xk-Gyz" id="ugp-6Y-IUi"/>
+                <outlet property="errorLabel" destination="JYr-d4-Grn" id="9hF-LC-oE8"/>
+                <outlet property="filesLabel" destination="7i2-kK-IUR" id="fIR-8R-1r2"/>
+                <outlet property="filesTextField" destination="IbR-iZ-b30" id="G8Z-SH-1me"/>
+                <outlet property="openFileButton" destination="yfj-oP-ZLP" id="yfz-Dd-GbJ"/>
+                <outlet property="passwordLabel" destination="kF8-Qb-20L" id="lDg-3E-PNB"/>
+                <outlet property="passwordTextField" destination="VwH-Fn-wdt" id="T4V-Ie-5Dy"/>
+                <outlet property="promptBox" destination="rqm-GK-a1Q" id="vDl-uR-aTz"/>
+                <outlet property="promptTextView" destination="sQo-a3-185" id="eZF-Fb-Gn0"/>
+                <outlet property="subTitleLabel" destination="L8i-m5-yua" id="sky-1d-9fy"/>
+                <outlet property="titleLabel" destination="VyV-xt-ftp" id="XZ7-S0-aQs"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="608" height="450"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="WKx-hZ-wYw">
+                    <rect key="frame" x="0.0" y="0.0" width="608" height="450"/>
+                    <subviews>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="soI-xt-gjs">
+                            <rect key="frame" x="572" y="409" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="ZdH-qh-9pY">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="Ij0-DF-zQX"/>
+                            </connections>
+                        </button>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VyV-xt-ftp">
+                            <rect key="frame" x="18" y="407" width="286" height="19"/>
+                            <textFieldCell key="cell" title="Save the self-signed Digital ID to a file" id="7PW-k6-6nf">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="L8i-m5-yua">
+                            <rect key="frame" x="22" y="353" width="564" height="34"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="560" id="2nr-tS-eA0"/>
+                            </constraints>
+                            <textFieldCell key="cell" id="uny-LZ-3Tu">
+                                <font key="font" metaFont="systemMedium" size="14"/>
+                                <string key="title">Browse for a Digital ID file. Digital ID files are password protected. You cannot access the Digital ID if you don't know its password.</string>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="XoM-Gh-Vzh">
+                            <rect key="frame" x="24" y="203" width="560" height="130"/>
+                            <view key="contentView" id="TPs-Co-Ncz">
+                                <rect key="frame" x="0.0" y="0.0" width="560" height="130"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="HBy-W2-HYW">
+                                        <rect key="frame" x="0.0" y="0.0" width="154" height="130"/>
+                                        <subviews>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7i2-kK-IUR">
+                                                <rect key="frame" x="119" y="107" width="35" height="17"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Files" id="tuA-9A-5ew">
+                                                    <font key="font" metaFont="systemMedium" size="14"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kF8-Qb-20L">
+                                                <rect key="frame" x="86" y="60" width="68" height="17"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Password" id="APG-4S-tYY">
+                                                    <font key="font" metaFont="systemMedium" size="14"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mSz-C4-9c0">
+                                                <rect key="frame" x="0.0" y="13" width="154" height="17"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Confirm The Password" id="mSp-Em-aI9">
+                                                    <font key="font" metaFont="systemMedium" size="14"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstAttribute="trailing" secondItem="kF8-Qb-20L" secondAttribute="trailing" constant="2" id="Hje-VB-whz"/>
+                                            <constraint firstAttribute="trailing" secondItem="mSz-C4-9c0" secondAttribute="trailing" constant="2" id="Njn-CH-o9y"/>
+                                            <constraint firstItem="mSz-C4-9c0" firstAttribute="leading" secondItem="HBy-W2-HYW" secondAttribute="leading" constant="2" id="gnj-au-vRA"/>
+                                            <constraint firstAttribute="trailing" secondItem="7i2-kK-IUR" secondAttribute="trailing" constant="2" id="qFF-9l-FIg"/>
+                                        </constraints>
+                                    </customView>
+                                    <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IbR-iZ-b30">
+                                        <rect key="frame" x="164" y="101" width="322" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="Gen-CG-Njh"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" focusRingType="none" alignment="left" drawsBackground="YES" id="rRQ-Yo-g4R" customClass="KMTextFieldCenterCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yfj-oP-ZLP">
+                                        <rect key="frame" x="492" y="95" width="73" height="40"/>
+                                        <buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="qXg-fe-tdG">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="61" id="Kba-V9-KR8"/>
+                                            <constraint firstAttribute="height" constant="28" id="amG-yo-sVh"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="penFile:" target="-2" id="X0Y-Yp-NaT"/>
+                                        </connections>
+                                    </button>
+                                    <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VwH-Fn-wdt">
+                                        <rect key="frame" x="164" y="54" width="322" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="6EW-w4-uCB"/>
+                                        </constraints>
+                                        <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" usesSingleLineMode="YES" bezelStyle="round" id="tJ9-D4-Zzy" customClass="KMVerticallySecureTextFieldCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <allowedInputSourceLocales>
+                                                <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+                                            </allowedInputSourceLocales>
+                                        </secureTextFieldCell>
+                                    </secureTextField>
+                                    <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wJh-2B-QMM">
+                                        <rect key="frame" x="164" y="7" width="322" height="28"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="28" id="fKd-hE-Kno"/>
+                                        </constraints>
+                                        <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" focusRingType="none" usesSingleLineMode="YES" bezelStyle="round" id="BGd-iB-ThS" customClass="KMVerticallySecureTextFieldCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <allowedInputSourceLocales>
+                                                <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+                                            </allowedInputSourceLocales>
+                                        </secureTextFieldCell>
+                                    </secureTextField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="wJh-2B-QMM" firstAttribute="leading" secondItem="VwH-Fn-wdt" secondAttribute="leading" id="7mC-bC-2rF"/>
+                                    <constraint firstItem="HBy-W2-HYW" firstAttribute="leading" secondItem="TPs-Co-Ncz" secondAttribute="leading" id="8lZ-kj-Yk7"/>
+                                    <constraint firstItem="yfj-oP-ZLP" firstAttribute="top" secondItem="TPs-Co-Ncz" secondAttribute="top" constant="1" id="EI2-VO-gjf"/>
+                                    <constraint firstItem="VwH-Fn-wdt" firstAttribute="leading" secondItem="IbR-iZ-b30" secondAttribute="leading" id="GPn-WS-tI0"/>
+                                    <constraint firstItem="HBy-W2-HYW" firstAttribute="top" secondItem="TPs-Co-Ncz" secondAttribute="top" id="Hk9-3X-GvK"/>
+                                    <constraint firstItem="wJh-2B-QMM" firstAttribute="trailing" secondItem="VwH-Fn-wdt" secondAttribute="trailing" id="JJi-rN-Jj4"/>
+                                    <constraint firstItem="VwH-Fn-wdt" firstAttribute="trailing" secondItem="IbR-iZ-b30" secondAttribute="trailing" id="Lch-Gk-oRc"/>
+                                    <constraint firstItem="VwH-Fn-wdt" firstAttribute="centerY" secondItem="kF8-Qb-20L" secondAttribute="centerY" id="Nyr-Tm-AvS"/>
+                                    <constraint firstItem="IbR-iZ-b30" firstAttribute="leading" secondItem="HBy-W2-HYW" secondAttribute="trailing" constant="10" id="Qhd-ib-J30"/>
+                                    <constraint firstItem="yfj-oP-ZLP" firstAttribute="leading" secondItem="IbR-iZ-b30" secondAttribute="trailing" constant="12" id="Sdr-PS-Wv4"/>
+                                    <constraint firstItem="IbR-iZ-b30" firstAttribute="top" secondItem="TPs-Co-Ncz" secondAttribute="top" constant="1" id="Yl7-hd-0Ud"/>
+                                    <constraint firstItem="wJh-2B-QMM" firstAttribute="centerY" secondItem="mSz-C4-9c0" secondAttribute="centerY" id="arP-Ku-OEw"/>
+                                    <constraint firstItem="wJh-2B-QMM" firstAttribute="top" secondItem="VwH-Fn-wdt" secondAttribute="bottom" constant="19" id="ekZ-dp-ozy"/>
+                                    <constraint firstItem="VwH-Fn-wdt" firstAttribute="top" secondItem="IbR-iZ-b30" secondAttribute="bottom" constant="19" id="hDA-Gc-B3N"/>
+                                    <constraint firstAttribute="bottom" secondItem="HBy-W2-HYW" secondAttribute="bottom" id="iK7-y8-huQ"/>
+                                    <constraint firstItem="IbR-iZ-b30" firstAttribute="centerY" secondItem="7i2-kK-IUR" secondAttribute="centerY" id="jki-Vf-34E"/>
+                                    <constraint firstAttribute="trailing" secondItem="yfj-oP-ZLP" secondAttribute="trailing" constant="1" id="om6-eY-tZ1"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="130" id="iYH-bl-kfU"/>
+                                <constraint firstAttribute="width" constant="560" id="weL-hb-C1O"/>
+                            </constraints>
+                            <font key="titleFont" metaFont="smallSystem"/>
+                        </box>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JYr-d4-Grn">
+                            <rect key="frame" x="195" y="187" width="153" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Passwords do not match" id="5NY-UV-6Ov">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" red="0.74901960779999999" green="0.18823529410000001" blue="0.18823529410000001" alpha="1" colorSpace="calibratedRGB"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EIz-uX-r20">
+                            <rect key="frame" x="415" y="18" width="74" height="40"/>
+                            <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="pjS-LI-h68">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="previousAction:" target="-2" id="Uk0-hf-jYA"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Z9P-xk-Gyz">
+                            <rect key="frame" x="507" y="18" width="87" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tCz-S6-AE0">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="UK6-5S-vXI"/>
+                            </connections>
+                        </button>
+                        <box fixedFrame="YES" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="rqm-GK-a1Q">
+                            <rect key="frame" x="32" y="69" width="566" height="112"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                            <view key="contentView" id="a3K-ta-Hnj">
+                                <rect key="frame" x="4" y="5" width="558" height="104"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YR7-D5-KiQ">
+                                        <rect key="frame" x="12" y="12" width="534" height="80"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                        <clipView key="contentView" drawsBackground="NO" id="ggD-LA-nSv">
+                                            <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textView editable="NO" selectable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="sQo-a3-185">
+                                                    <rect key="frame" x="0.0" y="0.0" width="534" height="80"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <size key="minSize" width="534" height="80"/>
+                                                    <size key="maxSize" width="1658" height="10000000"/>
+                                                    <attributedString key="textStorage">
+                                                        <fragment>
+                                                            <string key="content">Digital ID files generally have a PFX or P12 extension and contain the public key file (Certificate) and the associated private key file./n/nTo sign with a digital ID available as a file, follow the prompts to browse and select the file and type the password protecting the private key.</string>
+                                                            <attributes>
+                                                                <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                                <font key="NSFont" size="12" name="Helvetica"/>
+                                                                <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                                            </attributes>
+                                                        </fragment>
+                                                    </attributedString>
+                                                    <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                </textView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                        </clipView>
+                                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="QJp-AL-88C">
+                                            <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                        <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="asg-bo-j5M">
+                                            <rect key="frame" x="-100" y="-100" width="15" height="135"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                    </scrollView>
+                                </subviews>
+                            </view>
+                            <font key="titleFont" metaFont="smallSystem"/>
+                        </box>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="VyV-xt-ftp" firstAttribute="leading" secondItem="WKx-hZ-wYw" secondAttribute="leading" constant="20" id="CFX-z0-ibE"/>
+                        <constraint firstAttribute="bottom" secondItem="Z9P-xk-Gyz" secondAttribute="bottom" constant="24" id="Hlh-4I-ALl"/>
+                        <constraint firstAttribute="trailing" secondItem="Z9P-xk-Gyz" secondAttribute="trailing" constant="20" id="LEf-jT-jec"/>
+                        <constraint firstItem="Z9P-xk-Gyz" firstAttribute="centerY" secondItem="EIz-uX-r20" secondAttribute="centerY" id="MHL-jR-cuw"/>
+                        <constraint firstItem="VyV-xt-ftp" firstAttribute="top" secondItem="WKx-hZ-wYw" secondAttribute="top" constant="24" id="P3b-Ft-G6r"/>
+                        <constraint firstItem="Z9P-xk-Gyz" firstAttribute="leading" secondItem="EIz-uX-r20" secondAttribute="trailing" constant="30" id="Slj-Y9-oxK"/>
+                        <constraint firstItem="JYr-d4-Grn" firstAttribute="leading" secondItem="WKx-hZ-wYw" secondAttribute="leading" constant="197" id="dLt-sD-gdy"/>
+                        <constraint firstAttribute="trailing" secondItem="L8i-m5-yua" secondAttribute="trailing" constant="24" id="dvJ-d8-ifw"/>
+                        <constraint firstItem="L8i-m5-yua" firstAttribute="leading" secondItem="WKx-hZ-wYw" secondAttribute="leading" constant="24" id="kxN-Kk-yrh"/>
+                        <constraint firstItem="XoM-Gh-Vzh" firstAttribute="top" secondItem="L8i-m5-yua" secondAttribute="bottom" constant="20" id="lt0-ih-HrV"/>
+                        <constraint firstItem="XoM-Gh-Vzh" firstAttribute="centerX" secondItem="WKx-hZ-wYw" secondAttribute="centerX" id="nfe-GV-mhe"/>
+                        <constraint firstItem="L8i-m5-yua" firstAttribute="top" secondItem="VyV-xt-ftp" secondAttribute="bottom" constant="20" id="rNJ-72-HKD"/>
+                        <constraint firstItem="soI-xt-gjs" firstAttribute="centerY" secondItem="VyV-xt-ftp" secondAttribute="centerY" id="roE-om-4eH"/>
+                        <constraint firstItem="JYr-d4-Grn" firstAttribute="top" secondItem="XoM-Gh-Vzh" secondAttribute="bottom" id="yUe-xg-d5I"/>
+                        <constraint firstAttribute="trailing" secondItem="soI-xt-gjs" secondAttribute="trailing" constant="20" id="zVv-tg-ryM"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="WKx-hZ-wYw" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="0uD-u7-eDT"/>
+                <constraint firstAttribute="bottom" secondItem="WKx-hZ-wYw" secondAttribute="bottom" id="DPL-Ya-NWk"/>
+                <constraint firstAttribute="trailing" secondItem="WKx-hZ-wYw" secondAttribute="trailing" id="HNK-pf-inP"/>
+                <constraint firstItem="WKx-hZ-wYw" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="pql-9t-lk8"/>
+            </constraints>
+            <point key="canvasLocation" x="162" y="212"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+    </resources>
+</document>

+ 126 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveTypeViewController.swift

@@ -0,0 +1,126 @@
+//
+//  DSignatureSaveTypeViewController.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/9/28.
+//
+
+import Cocoa
+
+class DSignatureSaveTypeViewController: NSViewController {
+
+    @IBOutlet weak var titleLabel: NSTextField!
+    @IBOutlet weak var subTitleLabel: NSTextField!
+    
+    @IBOutlet weak var saveFolderButton: NSButton!
+    @IBOutlet weak var fileBox: NSBox!
+    @IBOutlet weak var fileLabel: NSTextField!
+    @IBOutlet weak var fileSubLabel: NSTextField!
+    
+    @IBOutlet weak var saveKechainButton: NSButton!
+    @IBOutlet weak var kechainBox: NSBox!
+    @IBOutlet weak var kechainLabel: NSTextField!
+    @IBOutlet weak var kechainSubLabel: NSTextField!
+    
+    @IBOutlet weak var promptBox: NSBox!
+    @IBOutlet var promptTextView: NSTextView!
+    
+    @IBOutlet weak var previousStepButton: NSButton!
+    @IBOutlet weak var continueButton: NSButton!
+    
+    var _saveType:CDSignatureSaveType = .none
+    
+    
+    var actionBlock: ((_ saveTypeVC: DSignatureSaveTypeViewController, _ actionType: DSignatureActionType, _ saveType: CDSignatureSaveType)->Void)?
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.localizedLanguage()
+        
+        self.titleLabel.textColor = NSColor.labelColor
+        self.subTitleLabel.textColor = NSColor.labelColor
+        self.fileLabel.textColor = NSColor.labelColor
+        self.kechainLabel.textColor = NSColor.labelColor
+            
+        self.fileSubLabel.textColor = NSColor.labelColor
+        self.kechainSubLabel.textColor = NSColor.labelColor
+        self.promptTextView.textColor = NSColor.labelColor
+        
+        self.fileBox.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1.0)
+        self.kechainBox.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1.0)
+        
+        self.saveType = .folder
+        
+    }
+    
+    //MARK: Setter
+    var saveType: CDSignatureSaveType {
+        set {
+            _saveType = newValue;
+             
+            if (.folder == self.saveType) {
+                self.saveFolderButton.state = .on
+                self.saveKechainButton.state = .off
+            } else if self.saveType == .keyChain {
+                self.saveFolderButton.state = .off
+                self.saveKechainButton.state = .on
+            }
+        }
+        
+        get {
+            return _saveType;
+        }
+    }
+    
+    func localizedLanguage() {
+        self.titleLabel.stringValue = NSLocalizedString("Location to Save the Digital ID", comment: "")
+        self.subTitleLabel.stringValue = NSLocalizedString("Select the location to save the digital ID card:", comment: "")
+        self.fileLabel.stringValue = NSLocalizedString("Save to File", comment: "")
+        self.fileSubLabel.stringValue = NSLocalizedString("Save the digital ID to a file in your computer", comment: "")
+        self.kechainLabel.stringValue = NSLocalizedString("Save to Apple Keychain", comment: "")
+        self.kechainSubLabel.stringValue = NSLocalizedString("Save the digital ID to Apple Keychain to be shared", comment: "")
+        
+        self.promptTextView.string = String(format: "%@\n\n%@",NSLocalizedString("Digital IDs are typically issued by trusted providers that assure the validity of the identity. Self-signed digital ID may not provide the same level of assurance and may not be accepted in some use cases.", comment: ""),NSLocalizedString("Consult with your recipients if this is an acceptable form of authentication.", comment: ""))
+        self.continueButton.title = NSLocalizedString("Continue", comment: "")
+        self.previousStepButton.title = NSLocalizedString("Previous Step", comment: "")
+    }
+    
+    
+    //MARK: IBAction
+    
+    @IBAction func closeAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .cancel, self.saveType)
+    }
+    
+    @IBAction func cancelAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .previousStep, self.saveType)
+    }
+    
+    @IBAction func continueAction(_ sender: Any) {
+        guard let callBack = self.actionBlock else {
+            return
+        }
+        callBack(self, .confirm, self.saveType)
+    }
+    
+    @IBAction func SaveType(_ sender: Any) {
+        let button: NSButton = sender as! NSButton
+        if button.tag == 0 {
+            self.saveType = .folder
+        } else if button.tag == 1 {
+            self.saveType = .keyChain
+        }
+    }
+    
+    
+    
+    
+}

+ 338 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureSaveTypeViewController.xib

@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignatureSaveTypeViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="continueButton" destination="FBB-fe-lHh" id="Dyn-Gi-42m"/>
+                <outlet property="fileBox" destination="Wz1-yO-Hds" id="ceh-kW-aXi"/>
+                <outlet property="fileLabel" destination="wtR-Wc-EcO" id="hZE-jr-SF1"/>
+                <outlet property="fileSubLabel" destination="c8h-ea-3kh" id="5Hh-9X-4Fe"/>
+                <outlet property="kechainBox" destination="Acf-FJ-MCv" id="6xm-Nb-M31"/>
+                <outlet property="kechainLabel" destination="1DF-u1-2qm" id="cx1-5h-ZfC"/>
+                <outlet property="kechainSubLabel" destination="JYG-Gg-yFk" id="xkw-8Z-FCj"/>
+                <outlet property="previousStepButton" destination="30U-q5-FFP" id="EIc-fX-90Z"/>
+                <outlet property="promptBox" destination="5e1-2K-zDT" id="pfa-2P-di4"/>
+                <outlet property="promptTextView" destination="Ogw-BY-WlQ" id="VVp-8e-ij7"/>
+                <outlet property="saveFolderButton" destination="xyo-oZ-8pp" id="528-mc-Dq5"/>
+                <outlet property="saveKechainButton" destination="t7h-Dj-AaJ" id="w9C-qQ-a9n"/>
+                <outlet property="subTitleLabel" destination="yIV-8n-ElM" id="3Cc-5v-XYe"/>
+                <outlet property="titleLabel" destination="WhW-cd-PiI" id="F14-dd-Hzr"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="589" height="439"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="JVK-U3-tkG">
+                    <rect key="frame" x="0.0" y="0.0" width="589" height="439"/>
+                    <subviews>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WhW-cd-PiI">
+                            <rect key="frame" x="22" y="396" width="318" height="19"/>
+                            <textFieldCell key="cell" title="select the destination of the new Digital ID" id="LwX-So-q3D">
+                                <font key="font" metaFont="systemMedium" size="16"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yIV-8n-ElM">
+                            <rect key="frame" x="22" y="374" width="303" height="17"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Select the location to save the digital ID card:" id="y17-yG-Ufh">
+                                <font key="font" metaFont="systemMedium" size="14"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <button translatesAutoresizingMaskIntoConstraints="NO" id="yMk-EL-b2A">
+                            <rect key="frame" x="551" y="398" width="16" height="16"/>
+                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="ImageNameDSignatClose" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="bQR-Ov-NwQ">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="closeAction:" target="-2" id="mDI-Q3-X4O"/>
+                            </connections>
+                        </button>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="9PT-4r-gG2">
+                            <rect key="frame" x="24" y="290" width="541" height="68"/>
+                            <view key="contentView" id="AZY-yX-Bxz">
+                                <rect key="frame" x="0.0" y="0.0" width="541" height="68"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xyo-oZ-8pp">
+                                        <rect key="frame" x="-2" y="25" width="18" height="18"/>
+                                        <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="uJB-r4-pyO">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                    </button>
+                                    <box boxType="custom" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Wz1-yO-Hds">
+                                        <rect key="frame" x="32" y="0.0" width="509" height="68"/>
+                                        <view key="contentView" id="I1p-6G-5SO">
+                                            <rect key="frame" x="1" y="1" width="507" height="66"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="KqP-vo-icf">
+                                                    <rect key="frame" x="18" y="17" width="32" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="32" id="jWl-TT-v8K"/>
+                                                        <constraint firstAttribute="height" constant="32" id="ps2-mn-4Rr"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameDSignatSaveFile" id="EyO-kj-cAU"/>
+                                                </imageView>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="wtR-Wc-EcO">
+                                                    <rect key="frame" x="53" y="36" width="80" height="17"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Save to File" id="Ptb-4J-aUK">
+                                                        <font key="font" metaFont="systemMedium" size="14"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="c8h-ea-3kh">
+                                                    <rect key="frame" x="53" y="13" width="253" height="15"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Save the Digital ID to a file in your computer" id="gib-Uy-AdB">
+                                                        <font key="font" metaFont="cellTitle"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="KqP-vo-icf" firstAttribute="leading" secondItem="I1p-6G-5SO" secondAttribute="leading" constant="18" id="7PM-RV-FJZ"/>
+                                                <constraint firstItem="wtR-Wc-EcO" firstAttribute="top" secondItem="KqP-vo-icf" secondAttribute="top" constant="-4" id="CLq-Wn-DiO"/>
+                                                <constraint firstItem="c8h-ea-3kh" firstAttribute="leading" secondItem="KqP-vo-icf" secondAttribute="trailing" constant="5" id="PYi-eI-VEv"/>
+                                                <constraint firstItem="KqP-vo-icf" firstAttribute="centerY" secondItem="I1p-6G-5SO" secondAttribute="centerY" id="eHs-3a-x8a"/>
+                                                <constraint firstItem="c8h-ea-3kh" firstAttribute="top" secondItem="wtR-Wc-EcO" secondAttribute="bottom" constant="8" id="sL0-96-Im7"/>
+                                                <constraint firstItem="wtR-Wc-EcO" firstAttribute="leading" secondItem="KqP-vo-icf" secondAttribute="trailing" constant="5" id="wUa-gO-www"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <button verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="BbT-M3-CbC">
+                                        <rect key="frame" x="0.0" y="0.0" width="541" height="68"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="T5Q-3G-55f">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="SaveType:" target="-2" id="xXH-ck-xAV"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="BbT-M3-CbC" secondAttribute="bottom" id="2Ym-1n-5pR"/>
+                                    <constraint firstItem="BbT-M3-CbC" firstAttribute="top" secondItem="AZY-yX-Bxz" secondAttribute="top" id="4mr-aO-MVB"/>
+                                    <constraint firstAttribute="trailing" secondItem="Wz1-yO-Hds" secondAttribute="trailing" id="Pyc-L7-wMd"/>
+                                    <constraint firstItem="Wz1-yO-Hds" firstAttribute="top" secondItem="AZY-yX-Bxz" secondAttribute="top" id="g5g-gH-7Rr"/>
+                                    <constraint firstItem="xyo-oZ-8pp" firstAttribute="centerY" secondItem="AZY-yX-Bxz" secondAttribute="centerY" id="j3B-20-MUP"/>
+                                    <constraint firstItem="BbT-M3-CbC" firstAttribute="leading" secondItem="AZY-yX-Bxz" secondAttribute="leading" id="jh9-Fx-KqU"/>
+                                    <constraint firstItem="Wz1-yO-Hds" firstAttribute="leading" secondItem="AZY-yX-Bxz" secondAttribute="leading" constant="32" id="rAV-lB-x6l"/>
+                                    <constraint firstItem="xyo-oZ-8pp" firstAttribute="leading" secondItem="AZY-yX-Bxz" secondAttribute="leading" id="rYK-dE-HyE"/>
+                                    <constraint firstAttribute="trailing" secondItem="BbT-M3-CbC" secondAttribute="trailing" id="x5U-Ru-tPk"/>
+                                    <constraint firstAttribute="bottom" secondItem="Wz1-yO-Hds" secondAttribute="bottom" id="zPC-7n-Q7L"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="68" id="owI-N8-Ck3"/>
+                            </constraints>
+                        </box>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="2yO-k3-xM6">
+                            <rect key="frame" x="24" y="214" width="541" height="68"/>
+                            <view key="contentView" id="D9S-n0-Thj">
+                                <rect key="frame" x="0.0" y="0.0" width="541" height="68"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <button tag="1" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="t7h-Dj-AaJ">
+                                        <rect key="frame" x="-2" y="25" width="18" height="18"/>
+                                        <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" inset="2" id="O77-0A-wwf">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                    </button>
+                                    <box boxType="custom" cornerRadius="6" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Acf-FJ-MCv">
+                                        <rect key="frame" x="32" y="0.0" width="509" height="68"/>
+                                        <view key="contentView" id="pg1-GB-nO3">
+                                            <rect key="frame" x="1" y="1" width="507" height="66"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xgw-ec-vYn">
+                                                    <rect key="frame" x="18" y="17" width="32" height="32"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="32" id="CRO-XV-QS3"/>
+                                                        <constraint firstAttribute="width" constant="32" id="kwL-pb-dBs"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameDSignatSaveKechain" id="fGD-G5-6ci"/>
+                                                </imageView>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1DF-u1-2qm">
+                                                    <rect key="frame" x="53" y="36" width="159" height="17"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Save to Apple Keychain" id="JRU-Vs-Rix">
+                                                        <font key="font" metaFont="systemMedium" size="14"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JYG-Gg-yFk">
+                                                    <rect key="frame" x="53" y="13" width="287" height="15"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Save the Digital ID to Apple Keychain to be shared" id="Mxe-WH-VTH">
+                                                        <font key="font" metaFont="cellTitle"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="1DF-u1-2qm" firstAttribute="leading" secondItem="xgw-ec-vYn" secondAttribute="trailing" constant="5" id="1mi-Kh-b5M"/>
+                                                <constraint firstItem="xgw-ec-vYn" firstAttribute="centerY" secondItem="pg1-GB-nO3" secondAttribute="centerY" id="3Ry-zT-GQs"/>
+                                                <constraint firstItem="xgw-ec-vYn" firstAttribute="leading" secondItem="pg1-GB-nO3" secondAttribute="leading" constant="18" id="BM9-bj-DjG"/>
+                                                <constraint firstItem="JYG-Gg-yFk" firstAttribute="leading" secondItem="xgw-ec-vYn" secondAttribute="trailing" constant="5" id="HKh-yg-iAl"/>
+                                                <constraint firstItem="1DF-u1-2qm" firstAttribute="top" secondItem="xgw-ec-vYn" secondAttribute="top" constant="-4" id="hCc-tE-cq6"/>
+                                                <constraint firstItem="JYG-Gg-yFk" firstAttribute="top" secondItem="1DF-u1-2qm" secondAttribute="bottom" constant="8" id="zZj-Fw-297"/>
+                                            </constraints>
+                                        </view>
+                                    </box>
+                                    <button tag="1" verticalHuggingPriority="249" translatesAutoresizingMaskIntoConstraints="NO" id="894-Qa-x38">
+                                        <rect key="frame" x="0.0" y="0.0" width="541" height="68"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="tpQ-3f-JkH">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="SaveType:" target="-2" id="9gj-el-bd6"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="894-Qa-x38" secondAttribute="bottom" id="5jK-7Z-yDK"/>
+                                    <constraint firstAttribute="bottom" secondItem="Acf-FJ-MCv" secondAttribute="bottom" id="TpB-Ik-xTb"/>
+                                    <constraint firstItem="t7h-Dj-AaJ" firstAttribute="centerY" secondItem="D9S-n0-Thj" secondAttribute="centerY" id="WhA-ZR-3Re"/>
+                                    <constraint firstItem="894-Qa-x38" firstAttribute="leading" secondItem="D9S-n0-Thj" secondAttribute="leading" id="X3L-gv-wZ5"/>
+                                    <constraint firstItem="Acf-FJ-MCv" firstAttribute="leading" secondItem="D9S-n0-Thj" secondAttribute="leading" constant="32" id="eiJ-pN-UF7"/>
+                                    <constraint firstItem="t7h-Dj-AaJ" firstAttribute="leading" secondItem="D9S-n0-Thj" secondAttribute="leading" id="ieH-F5-7Mh"/>
+                                    <constraint firstAttribute="trailing" secondItem="894-Qa-x38" secondAttribute="trailing" id="mpn-yc-0n3"/>
+                                    <constraint firstItem="Acf-FJ-MCv" firstAttribute="top" secondItem="D9S-n0-Thj" secondAttribute="top" id="oB8-q4-CAr"/>
+                                    <constraint firstAttribute="trailing" secondItem="Acf-FJ-MCv" secondAttribute="trailing" id="qYA-Ut-2id"/>
+                                    <constraint firstItem="894-Qa-x38" firstAttribute="top" secondItem="D9S-n0-Thj" secondAttribute="top" id="zpZ-Gj-dbM"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="68" id="Zg9-l9-AvT"/>
+                            </constraints>
+                        </box>
+                        <box titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="5e1-2K-zDT">
+                            <rect key="frame" x="21" y="80" width="547" height="112"/>
+                            <view key="contentView" id="NaP-TF-SCW">
+                                <rect key="frame" x="4" y="5" width="539" height="104"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="79H-rg-14u">
+                                        <rect key="frame" x="12" y="12" width="523" height="80"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                                        <clipView key="contentView" drawsBackground="NO" id="JwD-1g-sZX">
+                                            <rect key="frame" x="0.0" y="0.0" width="523" height="80"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textView editable="NO" selectable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="Ogw-BY-WlQ">
+                                                    <rect key="frame" x="0.0" y="0.0" width="523" height="80"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <size key="minSize" width="523" height="80"/>
+                                                    <size key="maxSize" width="1658" height="10000000"/>
+                                                    <attributedString key="textStorage">
+                                                        <fragment>
+                                                            <string key="content">A Digital ID is required to create a digital signature.The most secure Digital ID are issued by trusted Certificate authorities and are based on secure devices like smart card or token. Some are based on files.\n You can also create a new Digital ID, but they provide a low level of identity assurance.</string>
+                                                            <attributes>
+                                                                <color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                                <font key="NSFont" size="12" name="Helvetica"/>
+                                                                <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                                            </attributes>
+                                                        </fragment>
+                                                    </attributedString>
+                                                    <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                                </textView>
+                                            </subviews>
+                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                        </clipView>
+                                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="kJh-c4-QyO">
+                                            <rect key="frame" x="-100" y="-100" width="225" height="15"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                        <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="hFK-0f-PMI">
+                                            <rect key="frame" x="-100" y="-100" width="15" height="135"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </scroller>
+                                    </scrollView>
+                                </subviews>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="106" id="49m-Qx-H30"/>
+                            </constraints>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="30U-q5-FFP">
+                            <rect key="frame" x="363" y="18" width="115" height="40"/>
+                            <buttonCell key="cell" type="push" title="Previous step" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="T5a-IL-Lze">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="cancelAction:" target="-2" id="JTj-ap-Eod"/>
+                            </connections>
+                        </button>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FBB-fe-lHh">
+                            <rect key="frame" x="486" y="18" width="87" height="40"/>
+                            <buttonCell key="cell" type="push" title="Continue" bezelStyle="rounded" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="5Re-0b-9YZ">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                                <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                            </buttonCell>
+                            <connections>
+                                <action selector="continueAction:" target="-2" id="L9l-Z9-htY"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="5e1-2K-zDT" firstAttribute="leading" secondItem="JVK-U3-tkG" secondAttribute="leading" constant="24" id="6oA-Hl-9jC"/>
+                        <constraint firstItem="2yO-k3-xM6" firstAttribute="leading" secondItem="JVK-U3-tkG" secondAttribute="leading" constant="24" id="CPk-WH-cQu"/>
+                        <constraint firstItem="WhW-cd-PiI" firstAttribute="leading" secondItem="JVK-U3-tkG" secondAttribute="leading" constant="24" id="Et7-TX-NnL"/>
+                        <constraint firstItem="5e1-2K-zDT" firstAttribute="top" secondItem="2yO-k3-xM6" secondAttribute="bottom" constant="24" id="Fxg-0I-aF8"/>
+                        <constraint firstItem="yMk-EL-b2A" firstAttribute="centerY" secondItem="WhW-cd-PiI" secondAttribute="centerY" id="GWk-Yb-xbx"/>
+                        <constraint firstItem="yIV-8n-ElM" firstAttribute="leading" secondItem="JVK-U3-tkG" secondAttribute="leading" constant="24" id="OHs-8J-TZn"/>
+                        <constraint firstAttribute="trailing" secondItem="2yO-k3-xM6" secondAttribute="trailing" constant="24" id="R1F-wy-SvY"/>
+                        <constraint firstAttribute="trailing" secondItem="FBB-fe-lHh" secondAttribute="trailing" constant="22" id="SB4-WX-aMV"/>
+                        <constraint firstItem="9PT-4r-gG2" firstAttribute="leading" secondItem="JVK-U3-tkG" secondAttribute="leading" constant="24" id="aat-FM-y6M"/>
+                        <constraint firstItem="2yO-k3-xM6" firstAttribute="top" secondItem="9PT-4r-gG2" secondAttribute="bottom" constant="8" id="bZL-kg-Ncj"/>
+                        <constraint firstAttribute="bottom" secondItem="FBB-fe-lHh" secondAttribute="bottom" constant="24" id="cQZ-iT-Ttb"/>
+                        <constraint firstItem="9PT-4r-gG2" firstAttribute="top" secondItem="yIV-8n-ElM" secondAttribute="bottom" constant="16" id="dmw-gh-eiH"/>
+                        <constraint firstItem="FBB-fe-lHh" firstAttribute="leading" secondItem="30U-q5-FFP" secondAttribute="trailing" constant="20" id="l6Q-yf-0sU"/>
+                        <constraint firstItem="yIV-8n-ElM" firstAttribute="top" secondItem="WhW-cd-PiI" secondAttribute="bottom" constant="5" id="m4O-xE-7iD"/>
+                        <constraint firstAttribute="trailing" secondItem="5e1-2K-zDT" secondAttribute="trailing" constant="24" id="ntv-Xo-dsg"/>
+                        <constraint firstAttribute="trailing" secondItem="yMk-EL-b2A" secondAttribute="trailing" constant="22" id="o8K-fl-uRS"/>
+                        <constraint firstItem="WhW-cd-PiI" firstAttribute="top" secondItem="JVK-U3-tkG" secondAttribute="top" constant="24" id="uNk-Ba-q6h"/>
+                        <constraint firstItem="FBB-fe-lHh" firstAttribute="centerY" secondItem="30U-q5-FFP" secondAttribute="centerY" id="uY6-tL-qZA"/>
+                        <constraint firstAttribute="trailing" secondItem="9PT-4r-gG2" secondAttribute="trailing" constant="24" id="yXm-Dz-yAS"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="JVK-U3-tkG" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="McU-rx-QfS"/>
+                <constraint firstAttribute="trailing" secondItem="JVK-U3-tkG" secondAttribute="trailing" id="OZx-Pg-Gdd"/>
+                <constraint firstAttribute="bottom" secondItem="JVK-U3-tkG" secondAttribute="bottom" id="bQa-Bu-QBj"/>
+                <constraint firstItem="JVK-U3-tkG" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="dRb-gS-MuK"/>
+            </constraints>
+            <point key="canvasLocation" x="193.5" y="197.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatClose" width="16" height="16"/>
+        <image name="ImageNameDSignatSaveFile" width="32" height="32"/>
+        <image name="ImageNameDSignatSaveKechain" width="32" height="32"/>
+    </resources>
+</document>

+ 77 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignDetailTypeACellView.swift

@@ -0,0 +1,77 @@
+//
+//  DSignDetailTypeACellView.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/11.
+//
+
+import Cocoa
+
+class DSignDetailTypeACellView: NSTableCellView {
+
+    @IBOutlet weak var contentView: NSView!
+    @IBOutlet weak var contendLabel: NSTextField!
+    @IBOutlet weak var leftOffset: NSLayoutConstraint!
+    
+    var _model: CDSPDFSigntureModel!
+    
+    
+    // MARK: 初始化
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        initContentView()
+        setup()
+    }
+    
+    required init?(coder decoder: NSCoder) {
+        super.init(coder: decoder)
+        initContentView()
+        setup()
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    private func initContentView() {
+        //绑定xib
+        let resource = NSNib(nibNamed: String(describing: self.classForCoder.self),
+                             bundle: Bundle(for: self.classForCoder.self))!
+        resource.instantiate(withOwner: self, topLevelObjects: nil)
+        addSubview(contentView)
+        contentView.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            contentView.topAnchor.constraint(equalTo: topAnchor),
+            contentView.leftAnchor.constraint(equalTo: leftAnchor),
+            contentView.rightAnchor.constraint(equalTo: rightAnchor),
+            contentView.bottomAnchor.constraint(equalTo: bottomAnchor)])
+        contentView.updateConstraintsForSubtreeIfNeeded()
+    }
+    
+    func setup() {
+        
+        self.contendLabel.textColor = NSColor.labelColor
+        
+    }
+    
+    var model: CDSPDFSigntureModel {
+        set {
+            _model = newValue
+            
+            let dic = model.certificate.subjectDict! as NSDictionary
+            
+            let cn = dic.object(forKey: "CN")
+            if cn != nil {
+                self.contendLabel.stringValue = cn as! String
+            } else {
+                let o = dic.object(forKey: "O")
+                if o != nil {
+                    self.contendLabel.stringValue = o as! String
+                }
+            }
+            
+            self.leftOffset.constant = CGFloat(5+10*_model.level)
+        }
+        
+        get {
+            return _model
+        }
+    }
+}

+ 38 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignDetailTypeACellView.xib

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="DSignDetailTypeACellView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="contendLabel" destination="baV-z0-RYD" id="Pol-Dp-Oow"/>
+                <outlet property="contentView" destination="c22-O7-iKe" id="wAN-zd-LJa"/>
+                <outlet property="leftOffset" destination="Dgp-aT-BsH" id="vEW-sz-Uef"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="c22-O7-iKe">
+            <rect key="frame" x="0.0" y="0.0" width="357" height="47"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="baV-z0-RYD">
+                    <rect key="frame" x="18" y="16" width="35" height="15"/>
+                    <textFieldCell key="cell" title="Label" id="Vos-bH-Z9F">
+                        <font key="font" metaFont="cellTitle"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+            </subviews>
+            <constraints>
+                <constraint firstItem="baV-z0-RYD" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="20" id="Dgp-aT-BsH"/>
+                <constraint firstItem="baV-z0-RYD" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="max-j1-nmy"/>
+            </constraints>
+            <point key="canvasLocation" x="13.5" y="36.5"/>
+        </customView>
+    </objects>
+</document>

+ 128 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignatureFileListCellView.swift

@@ -0,0 +1,128 @@
+//
+//  DSignatureFileListCellView.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/8.
+//
+
+import Cocoa
+
+class DSignatureFileListCellView: NSTableCellView {
+
+    @IBOutlet weak var contentView: NSView!
+    
+    @IBOutlet weak var contendView: NSView!
+    @IBOutlet weak var radioBtn: NSButton!
+    @IBOutlet weak var signImgView: NSImageView!
+    @IBOutlet weak var dateLabel: NSTextField!
+    @IBOutlet weak var authorLabel: NSTextField!
+    @IBOutlet weak var nameLabel: NSTextField!
+    @IBOutlet weak var sourceLabel: NSTextField!
+    @IBOutlet weak var viewDetailBtn: NSButton!
+    
+    var itemIndex: Int = 0
+    var _signModel: KMDSignatureModel!
+    
+    var radioActionHandle: ((DSignatureFileListCellView)->Void)?
+    typealias refreshHandle = (_ cellView: DSignatureFileListCellView) ->Void
+    
+    var viewDetailBlock: refreshHandle!
+    
+    // MARK: 初始化
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        initContentView()
+        setup()
+    }
+    
+    required init?(coder decoder: NSCoder) {
+        super.init(coder: decoder)
+        initContentView()
+        setup()
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    private func initContentView() {
+        //绑定xib
+        let resource = NSNib(nibNamed: String(describing: self.classForCoder.self),
+                             bundle: Bundle(for: self.classForCoder.self))!
+        resource.instantiate(withOwner: self, topLevelObjects: nil)
+        addSubview(contentView)
+        contentView.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            contentView.topAnchor.constraint(equalTo: topAnchor),
+            contentView.leftAnchor.constraint(equalTo: leftAnchor),
+            contentView.rightAnchor.constraint(equalTo: rightAnchor),
+            contentView.bottomAnchor.constraint(equalTo: bottomAnchor)])
+        contentView.updateConstraintsForSubtreeIfNeeded()
+    }
+    
+    func setup() {
+        
+        self.radioBtn.target = self
+        self.radioBtn.action = #selector(radioBtnAction)
+        
+        self.viewDetailBtn.title = NSLocalizedString("View Details", comment: "")
+        
+        let cell: NSButtonCell = self.viewDetailBtn.cell as! NSButtonCell
+        let txtColor = KMAppearance.Interactive.a0Color()
+
+        let attrStr1 = cell.attributedTitle
+        let myAttr = NSMutableAttributedString.init(attributedString: attrStr1)
+        myAttr.addAttributes([NSAttributedString.Key.foregroundColor : txtColor], range: NSRange(location: 0, length: attrStr1.string.count))
+        cell.attributedTitle = myAttr
+        self.viewDetailBtn.updateCell(cell)
+        
+        self.nameLabel.textColor = KMAppearance.Layout.h0Color()
+        self.sourceLabel.textColor = KMAppearance.Layout.h0Color()
+        self.authorLabel.textColor = KMAppearance.Layout.h0Color()
+        self.dateLabel.textColor = KMAppearance.Layout.h0Color()
+    }
+    
+    //MARK: Setter
+    var signModel: KMDSignatureModel? {
+        set {
+            _signModel = newValue
+            
+            self.nameLabel.stringValue = _signModel.name ?? ""
+            self.authorLabel.stringValue = NSLocalizedString("Issued by:", comment: "") + _signModel.issusName
+            if (_signModel.isFormKeyChain) {
+                self.sourceLabel.stringValue = NSLocalizedString("(Keychain Digital ID)", comment: "");
+                self.signImgView.image = NSImage(named: "ImageNameDSignatSaveKechain")
+            } else {
+                self.sourceLabel.stringValue = NSLocalizedString("(Digital ID file)", comment: "");
+                self.signImgView.image = NSImage(named: "ImageNameDSignatureFromFile")
+            }
+            
+            let dateFormatter = DateFormatter()
+            dateFormatter.dateFormat = "yyyy-MM-dd"
+            self.dateLabel.stringValue = NSLocalizedString("Expires", comment: "") + ":" + dateFormatter.string(from: _signModel.expiresDate)
+                                  
+            self.nameLabel.toolTip = self.nameLabel.stringValue
+            self.authorLabel.toolTip = self.authorLabel.stringValue
+            self.sourceLabel.toolTip = self.sourceLabel.stringValue
+            self.dateLabel.toolTip = self.dateLabel.stringValue
+            
+        }
+        get {
+            return _signModel
+        }
+    }
+    
+    //MARK: IBAction
+    @objc func radioBtnAction () {
+        guard let callBack = self.radioActionHandle else {
+            return
+        }
+        callBack(self)
+    }
+    
+    @IBAction func showDetailAction(_ sender: Any) {
+        guard let callBack = self.viewDetailBlock else {
+            return
+        }
+        callBack(self)
+    }
+    
+    
+}

+ 145 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignatureFileListCellView.xib

@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMComparativeOutlineCell">
+            <connections>
+                <outlet property="authorLabel" destination="zgs-6c-DqZ" id="DWe-Hs-VJS"/>
+                <outlet property="contendView" destination="D9L-YG-uLp" id="QlF-0M-zBB"/>
+                <outlet property="contentView" destination="c22-O7-iKe" id="7QX-uA-mt0"/>
+                <outlet property="dateLabel" destination="vRL-h8-ii5" id="3lu-SI-YaC"/>
+                <outlet property="nameLabel" destination="EI3-yj-H0c" id="eiR-vW-S6h"/>
+                <outlet property="radioBtn" destination="vIV-vk-NO1" id="7a5-Tq-hzm"/>
+                <outlet property="signImgView" destination="fRs-rK-XZ5" id="uAy-Ri-4fw"/>
+                <outlet property="sourceLabel" destination="rCA-0R-FnJ" id="Gy0-J3-8yD"/>
+                <outlet property="viewDetailBtn" destination="qy8-7R-kcx" id="fZ1-qc-AbR"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="c22-O7-iKe">
+            <rect key="frame" x="0.0" y="0.0" width="560" height="67"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="D9L-YG-uLp">
+                    <rect key="frame" x="0.0" y="0.0" width="560" height="67"/>
+                    <subviews>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vIV-vk-NO1">
+                            <rect key="frame" x="4" y="25" width="18" height="18"/>
+                            <buttonCell key="cell" type="radio" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="TpC-Zp-Tc6">
+                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </button>
+                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="fRs-rK-XZ5">
+                            <rect key="frame" x="50" y="18" width="32" height="32"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="32" id="QhU-Ax-Su5"/>
+                                <constraint firstAttribute="height" constant="32" id="nkA-ly-Fsy"/>
+                            </constraints>
+                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="ImageNameDSignatureFromFile" id="CdL-u2-VXC"/>
+                        </imageView>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="5NP-Un-AMd">
+                            <rect key="frame" x="87" y="15" width="363" height="37"/>
+                            <view key="contentView" id="noX-em-Ukb">
+                                <rect key="frame" x="0.0" y="0.0" width="363" height="37"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vRL-h8-ii5">
+                                        <rect key="frame" x="34" y="0.0" width="35" height="15"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Vdf-vL-INF">
+                                            <font key="font" metaFont="cellTitle"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zgs-6c-DqZ">
+                                        <rect key="frame" x="-2" y="0.0" width="35" height="15"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" relation="lessThanOrEqual" constant="201" id="rUE-SO-QkS"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="cKJ-xS-tUs">
+                                            <font key="font" metaFont="cellTitle"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EI3-yj-H0c">
+                                        <rect key="frame" x="-2" y="20" width="40" height="17"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" relation="lessThanOrEqual" constant="185" id="Gky-Yk-lqx"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" lineBreakMode="truncatingMiddle" title="Label" id="RuI-aq-w1g">
+                                            <font key="font" metaFont="system" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rCA-0R-FnJ">
+                                        <rect key="frame" x="39" y="20" width="40" height="17"/>
+                                        <textFieldCell key="cell" lineBreakMode="truncatingMiddle" title="Label" id="oX9-Oh-7xQ">
+                                            <font key="font" metaFont="system" size="14"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="EI3-yj-H0c" firstAttribute="top" secondItem="noX-em-Ukb" secondAttribute="top" id="1bx-ES-Xnk"/>
+                                    <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="vRL-h8-ii5" secondAttribute="trailing" id="2xz-B1-xv6"/>
+                                    <constraint firstItem="vRL-h8-ii5" firstAttribute="leading" secondItem="zgs-6c-DqZ" secondAttribute="trailing" constant="5" id="FV1-iV-sx9"/>
+                                    <constraint firstItem="EI3-yj-H0c" firstAttribute="leading" secondItem="noX-em-Ukb" secondAttribute="leading" id="Tgn-gE-Pvz"/>
+                                    <constraint firstItem="rCA-0R-FnJ" firstAttribute="centerY" secondItem="EI3-yj-H0c" secondAttribute="centerY" id="VGP-rz-t3F"/>
+                                    <constraint firstItem="rCA-0R-FnJ" firstAttribute="leading" secondItem="EI3-yj-H0c" secondAttribute="trailing" constant="5" id="cGX-np-f0Y"/>
+                                    <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="rCA-0R-FnJ" secondAttribute="trailing" id="h3C-8K-Ij4"/>
+                                    <constraint firstAttribute="bottom" secondItem="zgs-6c-DqZ" secondAttribute="bottom" id="nYG-1L-3DX"/>
+                                    <constraint firstItem="zgs-6c-DqZ" firstAttribute="top" secondItem="EI3-yj-H0c" secondAttribute="bottom" constant="5" id="uW2-dk-zuF"/>
+                                    <constraint firstItem="zgs-6c-DqZ" firstAttribute="leading" secondItem="noX-em-Ukb" secondAttribute="leading" id="vFc-kn-rMu"/>
+                                    <constraint firstItem="vRL-h8-ii5" firstAttribute="centerY" secondItem="zgs-6c-DqZ" secondAttribute="centerY" id="xj4-Vz-jcw"/>
+                                </constraints>
+                            </view>
+                        </box>
+                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qy8-7R-kcx">
+                            <rect key="frame" x="450" y="25" width="100" height="17"/>
+                            <buttonCell key="cell" type="bevel" title="View Details" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="5xU-Jb-rZu">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system" size="14"/>
+                            </buttonCell>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="100" id="onM-gy-9EO"/>
+                            </constraints>
+                            <connections>
+                                <action selector="showDetailAction:" target="-2" id="zmf-ff-R1c"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="qy8-7R-kcx" firstAttribute="leading" secondItem="5NP-Un-AMd" secondAttribute="trailing" id="86D-IM-GkM"/>
+                        <constraint firstItem="5NP-Un-AMd" firstAttribute="centerY" secondItem="D9L-YG-uLp" secondAttribute="centerY" id="MKq-9C-UKi"/>
+                        <constraint firstAttribute="trailing" secondItem="qy8-7R-kcx" secondAttribute="trailing" constant="10" id="PHW-Wd-2GR"/>
+                        <constraint firstItem="5NP-Un-AMd" firstAttribute="leading" secondItem="fRs-rK-XZ5" secondAttribute="trailing" constant="5" id="Q46-mi-Lg6"/>
+                        <constraint firstItem="vIV-vk-NO1" firstAttribute="centerY" secondItem="D9L-YG-uLp" secondAttribute="centerY" id="Rb1-Eb-15q"/>
+                        <constraint firstItem="fRs-rK-XZ5" firstAttribute="leading" secondItem="D9L-YG-uLp" secondAttribute="leading" constant="50" id="g8O-yD-cGw"/>
+                        <constraint firstItem="qy8-7R-kcx" firstAttribute="centerY" secondItem="D9L-YG-uLp" secondAttribute="centerY" id="hVt-Ym-MVB"/>
+                        <constraint firstItem="fRs-rK-XZ5" firstAttribute="centerY" secondItem="D9L-YG-uLp" secondAttribute="centerY" id="tcr-yj-oBG"/>
+                        <constraint firstItem="vIV-vk-NO1" firstAttribute="leading" secondItem="D9L-YG-uLp" secondAttribute="leading" constant="6" id="zMf-bR-ad8"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="D9L-YG-uLp" secondAttribute="bottom" id="C8f-gj-SiC"/>
+                <constraint firstItem="D9L-YG-uLp" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" id="NCl-8Z-EvA"/>
+                <constraint firstItem="D9L-YG-uLp" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="WC9-QM-kdw"/>
+                <constraint firstAttribute="trailing" secondItem="D9L-YG-uLp" secondAttribute="trailing" id="iHv-jy-NVw"/>
+            </constraints>
+            <point key="canvasLocation" x="184" y="8.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="ImageNameDSignatureFromFile" width="32" height="32"/>
+    </resources>
+</document>

+ 30 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/DSignatureFilelistRow.swift

@@ -0,0 +1,30 @@
+//
+//  DSignatureFilelistRow.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/27.
+//
+
+import Cocoa
+
+class DSignatureFilelistRow: NSTableRowView {
+ 
+     
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+        // Drawing code here.
+        self.wantsLayer = true
+    }
+     
+    override func drawSelection(in dirtyRect: NSRect) {
+        self.drawView(KMAppearance.Status.selColor())
+    }
+    
+    func drawView(_ color: NSColor) {
+        color.withAlphaComponent(0.6).setFill()
+        let path = NSBezierPath(roundedRect: NSInsetRect(self.bounds, 1, 1), xRadius: 0, yRadius: 0)
+        path.fill()
+    }
+     
+    
+}

+ 26 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/PDFCertExportAccessoryView.swift

@@ -0,0 +1,26 @@
+//
+//  PDFCertExportAccessoryView.swift
+//  PDF Reader Pro Edition
+//
+//  Created by Niehaoyu on 2023/10/12.
+//
+
+import Cocoa
+
+class PDFCertExportAccessoryView: NSViewController {
+    
+    @IBOutlet weak var formatMatrix: NSMatrix!
+    
+    class func supportedFormatTypes() -> Array<String> {
+        return ["p12","pfx"]
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+    }
+    
+    
+    
+    
+}

+ 64 - 0
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/Views/PDFCertExportAccessoryView.xib

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="PDFCertExportAccessoryView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="formatMatrix" destination="qSb-eL-J8k" id="I13-ii-2jl"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="120" height="94"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="L0S-Mt-FGT">
+                    <rect key="frame" x="8" y="68" width="76" height="16"/>
+                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="File Format:" id="bGJ-Bz-B0W">
+                        <font key="font" metaFont="system"/>
+                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+                <matrix verticalHuggingPriority="750" allowsEmptySelection="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qSb-eL-J8k">
+                    <rect key="frame" x="10" y="15" width="100" height="38"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="100" id="btW-ii-ixy"/>
+                    </constraints>
+                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                    <size key="cellSize" width="100" height="18"/>
+                    <size key="intercellSpacing" width="4" height="2"/>
+                    <buttonCell key="prototype" type="radio" imagePosition="left" alignment="left" inset="2" id="XCM-Di-YHz">
+                        <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                        <font key="font" metaFont="system"/>
+                    </buttonCell>
+                    <cells>
+                        <column>
+                            <buttonCell type="radio" title="P12" imagePosition="left" alignment="left" scrollable="YES" lineBreakMode="clipping" state="on" inset="2" id="nwh-KN-XDz">
+                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                            <buttonCell type="radio" title="pfx" imagePosition="left" alignment="left" scrollable="YES" lineBreakMode="clipping" tag="1" inset="2" id="t7A-Dj-06I">
+                                <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </column>
+                    </cells>
+                </matrix>
+            </subviews>
+            <constraints>
+                <constraint firstItem="L0S-Mt-FGT" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="10" id="1tF-ml-OeP"/>
+                <constraint firstItem="L0S-Mt-FGT" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="10" id="MmO-aV-FSo"/>
+                <constraint firstItem="qSb-eL-J8k" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="10" id="N2b-xM-tql"/>
+                <constraint firstItem="qSb-eL-J8k" firstAttribute="top" secondItem="L0S-Mt-FGT" secondAttribute="bottom" constant="15" id="PIh-lk-Wrh"/>
+            </constraints>
+            <point key="canvasLocation" x="110" y="116"/>
+        </customView>
+    </objects>
+</document>

+ 8 - 0
PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/KMQucikToolsView.swift

@@ -52,6 +52,14 @@ class KMQucikToolsView: KMBaseXibView {
         self.collectionView.register(KMQucikToolCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMQucikToolCollectionViewItem"))
         self.collectionView.register(KMQucikToolCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMQucikToolCollectionViewItem"))
         
         
         NotificationCenter.default.addObserver(self, selector: #selector(scrollViewDidScroll(notification:)), name: NSScrollView.didLiveScrollNotification, object: collectionView.enclosingScrollView)
         NotificationCenter.default.addObserver(self, selector: #selector(scrollViewDidScroll(notification:)), name: NSScrollView.didLiveScrollNotification, object: collectionView.enclosingScrollView)
+        
+//        self.backgroundColor(NSColor.red)
+        if KMAdvertisementConfig.isDarkModel() {
+            self.collectionView.appearance = NSAppearance(named: .darkAqua)
+        } else {
+            self.collectionView.appearance = NSAppearance(named: .aqua)
+        }
+//        self.collectionView.appearance = NSAppearance(named: .darkAqua)
 //        self.backgroundColor(KMAppearance.Layout.l0Color())
 //        self.backgroundColor(KMAppearance.Layout.l0Color())
     }
     }
     
     

+ 1 - 1
PDF Office/PDF Master/Class/KMAdvertisement/View/Tableview/Cell/KMAdvertisementCollectionViewItem.swift

@@ -36,7 +36,7 @@ class KMAdvertisementCollectionViewItem: NSCollectionViewItem {
     }
     }
     
     
     func updateColor(_ highlight: Bool) {
     func updateColor(_ highlight: Bool) {
-        self.view.appearance = NSAppearance(named: .aqua)
+//        self.view.appearance = NSAppearance(named: .aqua)
         if highlight {
         if highlight {
             if KMAdvertisementConfig.isDarkModel() {
             if KMAdvertisementConfig.isDarkModel() {
                 self.titleLabel.textColor = NSColor.km_init(hex: "#4E7EDB")
                 self.titleLabel.textColor = NSColor.km_init(hex: "#4E7EDB")

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWindowController.swift

@@ -45,7 +45,7 @@ class KMCompressWindowController: NSWindowController {
     
     
     override func windowDidLoad() {
     override func windowDidLoad() {
         super.windowDidLoad()
         super.windowDidLoad()
-        self.window?.appearance = NSAppearance(named: .aqua)
+//        self.window?.appearance = NSAppearance(named: .aqua)
         largeVC = KMDesignButton.init(withType: .RadioButton)
         largeVC = KMDesignButton.init(withType: .RadioButton)
         standardVC = KMDesignButton.init(withType: .RadioButton)
         standardVC = KMDesignButton.init(withType: .RadioButton)
         smallVC = KMDesignButton.init(withType: .RadioButton)
         smallVC = KMDesignButton.init(withType: .RadioButton)

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.swift

@@ -54,7 +54,7 @@ class SKProgressController: NSWindowController {
         
         
         progressBar.usesThreadedAnimation = true
         progressBar.usesThreadedAnimation = true
         
         
-        self.window?.appearance = NSAppearance(named: .aqua)
+//        self.window?.appearance = NSAppearance(named: .aqua)
         
         
         let button = NSButton()
         let button = NSButton()
         self.window?.contentView?.addSubview(button)
         self.window?.contentView?.addSubview(button)

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m

@@ -295,7 +295,7 @@ static KMPDFEditAppendWindow *windowController = nil;
     }
     }
     
     
     self.window.contentView.wantsLayer = YES;
     self.window.contentView.wantsLayer = YES;
-    self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+//    self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
     
     
     self.clearVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeImage];
     self.clearVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeImage];
     self.nMergeVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeText];
     self.nMergeVC = [[KMDesignButton alloc] initWithType: DesignButtonTypeText];

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Secure/Controller/KMSecureEncryptWindowController.swift

@@ -46,7 +46,7 @@ class KMSecureEncryptWindowController: NSWindowController {
     
     
     override func windowDidLoad() {
     override func windowDidLoad() {
         super.windowDidLoad()
         super.windowDidLoad()
-        self.window?.appearance = NSAppearance(named: .aqua)
+//        self.window?.appearance = NSAppearance(named: .aqua)
         
         
         cancelVC = KMDesignButton.init(withType: .Text)
         cancelVC = KMDesignButton.init(withType: .Text)
         encryptVC = KMDesignButton.init(withType: .Text)
         encryptVC = KMDesignButton.init(withType: .Text)

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Secure/Window/KMPasswordInputWindow.swift

@@ -117,7 +117,7 @@ private var passwordInputWindow_private: KMPasswordInputWindow?
             titleLabel.stringValue = NSLocalizedString("Permission Password", comment: "")
             titleLabel.stringValue = NSLocalizedString("Permission Password", comment: "")
             self.titleLabel.textColor = NSColor.titleColor()
             self.titleLabel.textColor = NSColor.titleColor()
             titleLabel.font = NSFont.SFProTextRegularFont(16)
             titleLabel.font = NSFont.SFProTextRegularFont(16)
-            self.titleLabel.window?.appearance = NSAppearance(named: .aqua)
+//            self.titleLabel.window?.appearance = NSAppearance(named: .aqua)
         }
         }
         
         
         if despLabel != nil {
         if despLabel != nil {

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Watermark/View/KMWatermarkAdjectiveStepper.swift

@@ -65,7 +65,7 @@ class KMWatermarkAdjectiveStepper: NSView {
         stepper.minValue = -1000
         stepper.minValue = -1000
         stepper.maxValue = 1000
         stepper.maxValue = 1000
         stepper.increment = 1
         stepper.increment = 1
-        stepper.appearance = NSAppearance(named: .aqua)
+//        stepper.appearance = NSAppearance(named: .aqua)
     }
     }
     
     
     override func layout() {
     override func layout() {

+ 13 - 13
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift

@@ -40,8 +40,8 @@ import Cocoa
 
 
 let CPDFStampTypeDynamic = 4, CPDFSignatureTypeInk = 5, CPDFSignatureTypeText = 6, CPDFSignatureTypeImage = 7
 let CPDFStampTypeDynamic = 4, CPDFSignatureTypeInk = 5, CPDFSignatureTypeText = 6, CPDFSignatureTypeImage = 7
 
 
-let ApplicationSupportDirectory = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last?.stringByAppendingPathComponent(Bundle.main.bundleIdentifier!)
-let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPathComponent("StampPreView")
+//let ApplicationSupportDirectory = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last?.stringByAppendingPathComponent(Bundle.main.bundleIdentifier!)
+let CPDFListStampFolderPath = ApplicationSupportDirectory.stringByAppendingPathComponent("StampPreView")
 
 
 @objc class CStampSignatureObject: NSObject {
 @objc class CStampSignatureObject: NSObject {
     
     
@@ -70,11 +70,11 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPath
         self.stampCategoryType = .standard
         self.stampCategoryType = .standard
         self.stampType = standardStampType
         self.stampType = standardStampType
         let fileNamePath = "\(stampType).png"
         let fileNamePath = "\(stampType).png"
-        var stampPath = CPDFListStampFolderPath?.stringByAppendingPathComponent("Standard")
-        if !FileManager.default.fileExists(atPath: stampPath!) {
-            try? FileManager.default.createDirectory(atPath: stampPath!, withIntermediateDirectories: true, attributes: nil)
+        var stampPath = CPDFListStampFolderPath.stringByAppendingPathComponent("Standard")
+        if !FileManager.default.fileExists(atPath: stampPath) {
+            try? FileManager.default.createDirectory(atPath: stampPath, withIntermediateDirectories: true, attributes: nil)
         }
         }
-        stampPath = stampPath?.stringByAppendingPathComponent(fileNamePath)
+        stampPath = stampPath.stringByAppendingPathComponent(fileNamePath)
         
         
         var name: String = ""
         var name: String = ""
         var style: CPDFStampStyle = .white
         var style: CPDFStampStyle = .white
@@ -125,7 +125,7 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPath
             self.shape = stampShape
             self.shape = stampShape
         }
         }
         
         
-        if !FileManager.default.fileExists(atPath: stampPath!) {
+        if !FileManager.default.fileExists(atPath: stampPath) {
             let document = CPDFDocument()
             let document = CPDFDocument()
             document?.insertPage(CGSize(width: 842.0, height: 595.0), at: 0)
             document?.insertPage(CGSize(width: 842.0, height: 595.0), at: 0)
             let stamp: CPDFStampAnnotation
             let stamp: CPDFStampAnnotation
@@ -138,7 +138,7 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPath
             if let page: CPDFPage = document?.page(at: 0) {
             if let page: CPDFPage = document?.page(at: 0) {
                 page.addAnnotation(stamp)
                 page.addAnnotation(stamp)
                 if let image: NSImage = stamp.stampImage() {
                 if let image: NSImage = stamp.stampImage() {
-                    try? image.tiffRepresentation?.write(to: URL(fileURLWithPath: stampPath!))
+                    try? image.tiffRepresentation?.write(to: URL(fileURLWithPath: stampPath))
                 }
                 }
             }
             }
         }
         }
@@ -234,7 +234,7 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPath
                 height += 10
                 height += 10
                 defaultHeight = height
                 defaultHeight = height
 
 
-                if self.text == nil && (self.detailText.count ?? 0) <= 1 {
+                if self.text == nil && (self.detailText.count ) <= 1 {
                     defaultWidth = height
                     defaultWidth = height
                 } else {
                 } else {
                     defaultWidth = max(stringWidth, dateStringWidth)
                     defaultWidth = max(stringWidth, dateStringWidth)
@@ -300,9 +300,9 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPath
 
 
         if self.stampCategoryType == CPDFStampType.standard {
         if self.stampCategoryType == CPDFStampType.standard {
             let fileNamePath = "\(self.stampType).png"
             let fileNamePath = "\(self.stampType).png"
-            let stampPath = (CPDFListStampFolderPath?.stringByAppendingPathComponent("Standard"))?.stringByAppendingPathComponent(fileNamePath)
+            let stampPath = (CPDFListStampFolderPath.stringByAppendingPathComponent("Standard")).stringByAppendingPathComponent(fileNamePath)
             
             
-            if !FileManager.default.fileExists(atPath: stampPath!) {
+            if !FileManager.default.fileExists(atPath: stampPath) {
                 var stamp: CPDFStampAnnotation?
                 var stamp: CPDFStampAnnotation?
                 
                 
                 if self.stampType.rawValue > CStandardStampType.Circle.rawValue {
                 if self.stampType.rawValue > CStandardStampType.Circle.rawValue {
@@ -318,14 +318,14 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory?.stringByAppendingPath
                     
                     
                     if let tiffData = image?.tiffRepresentation {
                     if let tiffData = image?.tiffRepresentation {
                         do {
                         do {
-                            try tiffData.write(to: URL(fileURLWithPath: stampPath!))
+                            try tiffData.write(to: URL(fileURLWithPath: stampPath))
                         } catch {
                         } catch {
                             print("Error writing image to file: \(error)")
                             print("Error writing image to file: \(error)")
                         }
                         }
                     }
                     }
                 }
                 }
             } else {
             } else {
-                image = NSImage(contentsOfFile: stampPath!)
+                image = NSImage(contentsOfFile: stampPath)
             }
             }
         } else if self.stampCategoryType == CPDFStampType.image {
         } else if self.stampCategoryType == CPDFStampType.image {
             image = NSImage(contentsOfFile: self.imagePath)
             image = NSImage(contentsOfFile: self.imagePath)

BIN
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/ComPDFKit


+ 0 - 8
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument+Protected.h

@@ -37,14 +37,6 @@ extern CPDFDocumentOptimizeOption const CPDFDocumentImageQualityOption; // NSNum
  */
  */
 - (BOOL)insertPageObject:(CPDFPage *)page atIndex:(NSUInteger)index;
 - (BOOL)insertPageObject:(CPDFPage *)page atIndex:(NSUInteger)index;
 
 
-#pragma mark - Signature
-
-- (NSArray<CPDFSignature *> *)signatures;
-
-- (void)removeSignature:(CPDFSignature *)signature;
-
-- (BOOL)writeSignatureToURL:(NSURL *)url withWidget:(CPDFSignatureWidgetAnnotation *)widget PKCS12Cert:(NSString *)path password:(NSString *)password isLock:(BOOL)isLock;
-
 #pragma mark - XFDF
 #pragma mark - XFDF
 
 
 - (BOOL)exportCustomWidget:(NSArray *)fieldNames toXFDFPath:(NSString *)xfdfPath;
 - (BOOL)exportCustomWidget:(NSArray *)fieldNames toXFDFPath:(NSString *)xfdfPath;

+ 40 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFDocument.h

@@ -80,6 +80,13 @@ typedef NS_ENUM(NSInteger, CPDFDocumentEncryptionLevel) {
     CPDFDocumentEncryptionLevelNoEncryptAlgo
     CPDFDocumentEncryptionLevelNoEncryptAlgo
 };
 };
 
 
+typedef NS_ENUM(NSInteger, CPDFSignaturePermissions) {
+    CPDFSignaturePermissionsNone = 0,
+    CPDFSignaturePermissionsForbidChange,
+    CPDFSignaturePermissionsFillSign,
+    CPDFSignaturePermissionsAnnotationFillSign,
+};
+
 typedef NSString *CPDFDocumentAttribute NS_STRING_ENUM;
 typedef NSString *CPDFDocumentAttribute NS_STRING_ENUM;
 
 
 extern CPDFDocumentAttribute const CPDFDocumentTitleAttribute;             // NSString containing document title.
 extern CPDFDocumentAttribute const CPDFDocumentTitleAttribute;             // NSString containing document title.
@@ -105,7 +112,8 @@ extern CPDFDocumentWriteOption const CPDFDocumentAllowsDocumentAssemblyOption;
 extern CPDFDocumentWriteOption const CPDFDocumentAllowsCommentingOption;
 extern CPDFDocumentWriteOption const CPDFDocumentAllowsCommentingOption;
 extern CPDFDocumentWriteOption const CPDFDocumentAllowsFormFieldEntryOption;
 extern CPDFDocumentWriteOption const CPDFDocumentAllowsFormFieldEntryOption;
 
 
-@class CPDFPage, CPDFOutline, CPDFBookmark, CPDFWatermark, CPDFHeaderFooter, CPDFBates, CPDFBackground, CPDFSelection;
+@class CPDFPage, CPDFOutline, CPDFBookmark, CPDFWatermark, CPDFHeaderFooter, CPDFBates, CPDFBackground, CPDFSelection,CPDFSignature,CPDFSignatureWidgetAnnotation;
+
 @protocol CPDFDocumentDelegate;
 @protocol CPDFDocumentDelegate;
 
 
 /**
 /**
@@ -368,6 +376,37 @@ extern CPDFDocumentWriteOption const CPDFDocumentAllowsFormFieldEntryOption;
  */
  */
 - (CPDFBackground *)background;
 - (CPDFBackground *)background;
 
 
+#pragma mark - Signature
+
+/**
+ * Get the current signature list.
+ */
+- (NSArray<CPDFSignature *> *)signatures;
+
+/**
+ * Delete the corresponding signature
+ */
+- (void)removeSignature:(CPDFSignature *)signature;
+
+/**
+     * Add a signature to a document.
+     * @param url Save path for the signature file.
+     * @param widget Signature widget.
+     * @param path Certificate file path.
+     * @param password Certificate file password
+     * @param location The hostname or physical location of the CPU which was used to sign the document.
+     * @param reason Signature reason.
+     * @param type Modify permission type. See more types by CPDFSignaturePermissions
+     * @return Return true: Write signature successfully. Return false: Write signature failed.
+*/
+- (BOOL)writeSignatureToURL:(NSURL *)url
+                 withWidget:(CPDFSignatureWidgetAnnotation *)widget
+                 PKCS12Cert:(NSString *)path
+                   password:(NSString *)password
+                   location:(NSString *)location
+                     reason:(NSString *)reason
+                permissions:(CPDFSignaturePermissions)permissions;
+
 #pragma mark - Pages
 #pragma mark - Pages
 
 
 /**
 /**

+ 6 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFKit.h

@@ -38,7 +38,12 @@ typedef NS_ENUM(NSInteger, CPDFKitFeatureType) {
     CPDFKitFeatureSecurityEncrypt,
     CPDFKitFeatureSecurityEncrypt,
     CPDFKitFeatureSecurityDecrypt,
     CPDFKitFeatureSecurityDecrypt,
     CPDFKitFeatureSecurityWatermark,
     CPDFKitFeatureSecurityWatermark,
-    CPDFKitFeatureConversionPDFA
+    CPDFKitFeatureConversionPDFA,
+    CPDFKitFeatureConversionCompareFile,
+    CPDFKitFeatureConversionDigitalSignature,
+    CPDFKitFeatureConversionAllowsEditText,
+    CPDFKitFeatureConversionAllowsEditImage,
+
 };
 };
 
 
 @interface CPDFKit : NSObject
 @interface CPDFKit : NSObject

+ 244 - 44
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSignature.h

@@ -13,6 +13,7 @@
 #import <ComPDFKit/CPDFKitPlatform.h>
 #import <ComPDFKit/CPDFKitPlatform.h>
 
 
 @class CPDFDocument;
 @class CPDFDocument;
+@class CPDFSignatureWidgetAnnotation;
 
 
 typedef NS_ENUM(NSInteger, CPDFSignatureOCSPStatus) {
 typedef NS_ENUM(NSInteger, CPDFSignatureOCSPStatus) {
     CPDFSignatureOCSPStatusNone = -2,
     CPDFSignatureOCSPStatusNone = -2,
@@ -21,6 +22,28 @@ typedef NS_ENUM(NSInteger, CPDFSignatureOCSPStatus) {
     CPDFSignatureOCSPStatusRevoked = 1
     CPDFSignatureOCSPStatusRevoked = 1
 };
 };
 
 
+typedef NS_ENUM(NSInteger, CPDFSignatureAlgorithmType) {
+    CPDFSignatureAlgorithmTypeRSA_RSA = 0, /*RSA_RSA*/
+    CPDFSignatureAlgorithmTypeMD2RSA, /*MD2RSA*/
+    CPDFSignatureAlgorithmTypeMD4RSA, /*MD4RSA*/
+    CPDFSignatureAlgorithmTypeMD5RSA, /*MD5RSA*/
+    CPDFSignatureAlgorithmTypeSHA1RSA, /*SHA1RSA*/
+    CPDFSignatureAlgorithmTypeSHA256RSA, /*SHA256RSA*/
+    CPDFSignatureAlgorithmTypeSM3SM2, /*SM3SM2*/
+};
+
+typedef NS_OPTIONS(NSInteger, CPDFSignatureKeyUsageType) {
+    CPDFSignatureKeyUsageTypeEncipherOnly = (1),            /*Encipher Only*/
+    CPDFSignatureKeyUsageTypeCRLSignature = (1UL << 1),            /*CRL Signature*/
+    CPDFSignatureKeyUsageTypeCertificateSignature = (1UL << 2),    /*Certificate Signature*/
+    CPDFSignatureKeyUsageTypeKeyAgreement= (1UL << 3),             /*Key Agreement*/
+    CPDFSignatureKeyUsageTypeDataEncipherment = (1UL << 4),        /*Data Encipherment*/
+    CPDFSignatureKeyUsageTypeKeyEncipherment = (1UL << 5),         /*Key Encipherment*/
+    CPDFSignatureKeyUsageTypeNonRepudiation = (1UL << 6),          /*Non-Repudiation*/
+    CPDFSignatureKeyUsageTypeDigitalSignature = (1UL << 7),        /*Digital Signature*/
+    CPDFSignatureKeyUsageTypeDDecipherOnly = (1UL << 15),           /*Decipher Only*/
+};
+
 typedef NS_ENUM(NSInteger, CPDFModifyType) {
 typedef NS_ENUM(NSInteger, CPDFModifyType) {
     CPDFModifyNone = 0,
     CPDFModifyNone = 0,
     CPDFModifyAddPage,
     CPDFModifyAddPage,
@@ -34,148 +57,325 @@ typedef NS_ENUM(NSInteger, CPDFModifyType) {
     CPDFModifyDocument
     CPDFModifyDocument
 };
 };
 
 
+typedef NS_ENUM(NSInteger, CPDFCertUsage) {
+    CPDFCertUsageDigSig = 1,
+    CPDFCertUsageDataEnc = 2,
+    CPDFCertUsageAll = 3,
+};
+
 @interface CPDFModifyInfo : NSObject
 @interface CPDFModifyInfo : NSObject
 
 
+/**
+ * Modify types.
+ */
 @property (nonatomic,readonly) CPDFModifyType type;
 @property (nonatomic,readonly) CPDFModifyType type;
 
 
+/**
+ * Change the page number of the document.
+ */
 @property (nonatomic,readonly) NSInteger pageIndex;
 @property (nonatomic,readonly) NSInteger pageIndex;
 
 
+/**
+ * Annotation types. When the annotation type is CPDFModifyAddAnnotation, CPDFModifyDeleteAnnotation, or CPDFModifyAnnotation, there would be a value.
+ */
 @property (nonatomic,readonly) NSInteger annotationType;
 @property (nonatomic,readonly) NSInteger annotationType;
 
 
+/**
+ * Form field types. When the form field type is CPDFModifyFillForm, there would be a value.
+ */
 @property (nonatomic,readonly) NSInteger formType;
 @property (nonatomic,readonly) NSInteger formType;
 
 
+/**
+ * The differences after modifying.
+ */
 @property (nonatomic,readonly) NSString *info;
 @property (nonatomic,readonly) NSString *info;
 
 
 @end
 @end
 
 
 @interface CPDFSignatureCertificate : NSObject
 @interface CPDFSignatureCertificate : NSObject
 
 
-// Version 版本
+/**
+ * Certificate version.
+ */
 @property (nonatomic,readonly) NSString *version;
 @property (nonatomic,readonly) NSString *version;
 
 
-// Signature algorithm 签名算法
+/**
+ * Get the signature algorithm.
+ */
 @property (nonatomic,readonly) NSString *signatureAlgorithmOID;
 @property (nonatomic,readonly) NSString *signatureAlgorithmOID;
-@property (nonatomic,readonly) NSString *signatureAlgorithmType;
 
 
-// Subject 主题
+/**
+ * Get the type of signature algorithm.
+ */
+@property (nonatomic,readonly) CPDFSignatureAlgorithmType signatureAlgorithmType;
+
+/**
+ * Get the subject of the certificate.
+ */
 @property (nonatomic,readonly) NSString *subject;
 @property (nonatomic,readonly) NSString *subject;
 
 
-// C(国家),ST(省),L(地区),O(组织),OU(单位),CN(通用名)
+/**
+ * C (Country), ST (Province), L (Locality);O (Organization), OU (Organizational Unit), CN (Common Name)
+ */
 @property (nonatomic,readonly) NSDictionary *subjectDict;
 @property (nonatomic,readonly) NSDictionary *subjectDict;
 
 
-// Issuer 颁发者
+/**
+ * Get the issuer of the certificate.
+ */
 @property (nonatomic,readonly) NSString *issuer;
 @property (nonatomic,readonly) NSString *issuer;
 
 
-// C(国家),ST(省),L(地区),O(组织),OU(单位),CN(通用名)
+/**
+ * C (Country), ST (Province), L (Locality);O (Organization), OU (Organizational Unit), CN (Common Name)
+ */
 @property (nonatomic,readonly) NSDictionary *issuerDict;
 @property (nonatomic,readonly) NSDictionary *issuerDict;
 
 
-// Serial number 序列号
+/**
+ * Get the serial number of the certificate.
+ */
 @property (nonatomic,readonly) NSString *serialNumber;
 @property (nonatomic,readonly) NSString *serialNumber;
 
 
-// Validity starts 有效起始日期
+/**
+ * Get the validity start date.
+ */
 @property (nonatomic,readonly) NSDate *validityStarts;
 @property (nonatomic,readonly) NSDate *validityStarts;
 
 
-// Validity ends 有效截止日期
+/**
+ * Get the validity end date.
+ */
 @property (nonatomic,readonly) NSDate *validityEnds;
 @property (nonatomic,readonly) NSDate *validityEnds;
 
 
-// Authority info access 颁发机构信息访问
+@property (nonatomic,readonly) NSString *dats;
+
+/**
+ * Get the access of the issuer information.
+ */
 @property (nonatomic,readonly) NSArray<NSDictionary *> *authorityInfoAccess;
 @property (nonatomic,readonly) NSArray<NSDictionary *> *authorityInfoAccess;
 
 
-// Subject key identifier 主题密钥标识符
+/**
+ * Get the subject's key identifier.
+ */
 @property (nonatomic,readonly) NSString *subjectKeyIdentifier;
 @property (nonatomic,readonly) NSString *subjectKeyIdentifier;
 
 
-// Key usage 密钥用法
-@property (nonatomic,readonly) NSString *keyUsage;
+/**
+ * Get the types of key usage.
+ */
+@property (nonatomic,readonly) CPDFSignatureKeyUsageType keyUsage;
 
 
-// Certificate policies 证书策略
+/**
+ * Get the certificate policies.
+ */
 @property (nonatomic,readonly) NSString *certificatePolicies;
 @property (nonatomic,readonly) NSString *certificatePolicies;
 
 
-// Authority key identifier 颁发结构密钥标识符
+/**
+ * Get the issuer‘s key identifier.
+ */
 @property (nonatomic,readonly) NSString *authorityKeyIdentifier;
 @property (nonatomic,readonly) NSString *authorityKeyIdentifier;
 
 
-// CRL distribution points CRL分发点
+/**
+ * Get the CRL Distribution Points.
+ */
 @property (nonatomic,readonly) NSArray<NSString *> *CRLDistributionPoints;
 @property (nonatomic,readonly) NSArray<NSString *> *CRLDistributionPoints;
 
 
-// Basic constraints 基本限制
+/**
+ * Basic Constraints.
+ */
 @property (nonatomic,readonly) NSString *basicConstraints;
 @property (nonatomic,readonly) NSString *basicConstraints;
 
 
-// Public key 公钥
+/**
+ * Public Key.
+ */
 @property (nonatomic,readonly) NSString *publicKey;
 @property (nonatomic,readonly) NSString *publicKey;
 
 
-// X.509 data X.509数据
+/**
+ * Get X.509 data.
+ */
 @property (nonatomic,readonly) NSString *X509Data;
 @property (nonatomic,readonly) NSString *X509Data;
 
 
-// SHA1 digest SHA1摘要
+/**
+ * SHA1 digest.
+ */
 @property (nonatomic,readonly) NSString *SHA1Digest;
 @property (nonatomic,readonly) NSString *SHA1Digest;
 
 
-// MD5 digest MD5摘要
+/**
+ * MD5 digest.
+ */
 @property (nonatomic,readonly) NSString *MD5Digest;
 @property (nonatomic,readonly) NSString *MD5Digest;
 
 
+/**
+ * OCSP url.
+ */
 @property (nonatomic,readonly) NSString *ocspURL;
 @property (nonatomic,readonly) NSString *ocspURL;
 
 
+/**
+ * OCSP authentication status.
+ */
 @property (nonatomic,readonly) CPDFSignatureOCSPStatus ocspStatus;
 @property (nonatomic,readonly) CPDFSignatureOCSPStatus ocspStatus;
 
 
+/**
+ * Be trusted or not.
+ */
 @property (nonatomic,readonly) BOOL isTrusted;
 @property (nonatomic,readonly) BOOL isTrusted;
 
 
+/**
+ * OCSP authentication.
+ */
 - (void)verifyOCSPWithCompletionHandler:(void (^)(BOOL result, CPDFSignatureOCSPStatus ocspStatus))handler;
 - (void)verifyOCSPWithCompletionHandler:(void (^)(BOOL result, CPDFSignatureOCSPStatus ocspStatus))handler;
 
 
+/**
+ * Export the certificate to a file.
+ * @param path Certificate save path.
+ * @return Return true: Export successfully. Return false: Export failed.
+ */
 - (BOOL)exportToFilePath:(NSString *)filePath;
 - (BOOL)exportToFilePath:(NSString *)filePath;
 
 
+/**
+ * Set up a certificate trust folder, default sandbox path.
+ */
+- (void)setSignCertTrustedFolder:(NSString *)signCertTrustedFolder;
+
+/**
+ * Add certificate to the trusted list.
+ */
 - (BOOL)addToTrustedCertificates;
 - (BOOL)addToTrustedCertificates;
 
 
+/**
+     * Check whether the password of the certificate file is correct.
+     * @param path The certificate file path.
+     * @param password The password of the certificate file.
+
+     * @return If the return value is not null, the password is correct.
+*/
 + (CPDFSignatureCertificate *)certificateWithPKCS12Path:(NSString *)path password:(NSString *)password;
 + (CPDFSignatureCertificate *)certificateWithPKCS12Path:(NSString *)path password:(NSString *)password;
 
 
+/**
+ * The certificate is trusted or not.
+ */
+- (void)checkCertificateIsTrusted;
+
 @end
 @end
 
 
+@class CPDFSignature;
+
 @interface CPDFSigner : NSObject
 @interface CPDFSigner : NSObject
 
 
+/**
+ * Whether authorized by the signer.
+ */
 @property (nonatomic,readonly) BOOL isSignVerified;
 @property (nonatomic,readonly) BOOL isSignVerified;
 
 
+/**
+ * Whether the certificate is in the trusted list.
+ */
 @property (nonatomic,readonly) BOOL isCertTrusted;
 @property (nonatomic,readonly) BOOL isCertTrusted;
 
 
-@property (nonatomic,readonly) NSString *name;
-
-@property (nonatomic,readonly) NSDate *date;
-
+/**
+ * Get the certificate.
+ */
 @property (nonatomic,readonly) NSArray<CPDFSignatureCertificate*> *certificates;
 @property (nonatomic,readonly) NSArray<CPDFSignatureCertificate*> *certificates;
 
 
-@property (nonatomic,readonly) NSArray<CPDFSigner*> *timestampSigners;
+/**
+ * Get the timestamp signature.
+ */
+@property (nonatomic,readonly) CPDFSignature *timestampSignature;
 
 
-- (void)checkCertificateIsTrusted;
+/**
+ * Get the time on the timestamps signature.
+ */
+@property (nonatomic,readonly) NSDate *authenDate;
 
 
 @end
 @end
 
 
 @interface CPDFSignature : NSObject
 @interface CPDFSignature : NSObject
-
+/**
+ * Get signer of who signed the document.
+ */
 @property (nonatomic,readonly) NSArray<CPDFSigner *> *signers;
 @property (nonatomic,readonly) NSArray<CPDFSigner *> *signers;
 
 
+/**
+ * Get all changes to the document.
+ */
 @property (nonatomic,readonly) NSArray<CPDFModifyInfo *> *modifyInfos;
 @property (nonatomic,readonly) NSArray<CPDFModifyInfo *> *modifyInfos;
 
 
-@property (nonatomic,readonly) NSUInteger pageIndex;
-
+/**
+ * Get the field name of signature form field.
+ */
 @property (nonatomic,readonly) NSString *fieldName;
 @property (nonatomic,readonly) NSString *fieldName;
 
 
+/**
+ * Get the location where the signature form field is located.
+ */
 @property (nonatomic,readonly) CGRect bounds;
 @property (nonatomic,readonly) CGRect bounds;
 
 
 /**
 /**
- * The access permissions granted for this document.
- *
- * @discussion Valid values shall be:
- * 1 : No changes to the document shall be permitted; any change to the document shall invalidate the signature.
- * 2 : Permitted changes shall be filling in forms, instantiating page templates, and signing; other changes shall invalidate the signature.
- * 3 : Permitted changes shall be the same as for 2, as well as annotation creation, deletion, and modification; other changes shall invalidate the signature.
+ * The name of the signer or issuer who signed the document.
+ */
+@property (nonatomic,readonly) NSString *name;
+
+/**
+ * Get the signing time of the document.
+ */
+@property (nonatomic,readonly) NSDate *date;
+
+/**
+ * Get the filter of the signature.
  */
  */
+@property (nonatomic,readonly) NSString *filter;
+
+/**
+ * Get the sub filter of the signature.
+ */
+@property (nonatomic,readonly) NSString *subFilter;
+/**
+ * Get the signing reason.
+ */
+@property (nonatomic,readonly) NSString *reason;
+
+/**
+ * The hostname or physical location of the CPU which was used to sign the document.
+ */
+@property (nonatomic,readonly) NSString *location;
+
+/**
+ Signature Permission
+  * The access permissions granted for this document.
+  *
+  * @discussion Valid values shall be:
+  *     1: No changes to the document shall be permitted. Any change to the document shall invalidate the signature.
+  *     2: Permitted changes shall be filling in forms, instantiating page templates, and signing. Other changes shall invalidate the signature.
+  *     3: Permitted changes shall be filling in forms, instantiating page templates, signing, and annotation creation, deletion, and modification. Other changes shall invalidate the signature.
+*/
 @property (nonatomic,readonly) NSInteger permissions;
 @property (nonatomic,readonly) NSInteger permissions;
 
 
+/**
+ * Get the page index of the signature.
+ * @param document CPDFDocument object.
+ * @return Return the page index of the signature.
+*/
+- (NSUInteger)pageIndexWithDocument:(CPDFDocument *)document;
+
+/**
+ * Verify the permissions.
+ * @param document The CPDFDocument object that needs to be verified.
+*/
 - (void)verifySignatureWithDocument:(CPDFDocument *)document;
 - (void)verifySignatureWithDocument:(CPDFDocument *)document;
 
 
 /**
 /**
- * 生成P12证书
- *
- * @param info C(国家),ST(省),L(地区),O(组织),OU(单位),CN(通用名),emailaddress(邮箱)
- * @param password 密码
- * @param path 保存路径
- */
-+ (BOOL)generatePKCS12CertWithInfo:(NSDictionary *)info password:(NSString *)password toPath:(NSString *)path;
+ * Sign the corresponding signature field.
+ * @param document Signed file object CPDFDocument.
+ * @return Sign forms.
+*/
+- (CPDFSignatureWidgetAnnotation *)signatureWidgetAnnotationWithDocument:(CPDFDocument *)document;
+
+/**
+ * Create a PKCS12 certificate.
+ * C (Country), ST (Province), L (Locality);O (Organization), OU (Organizational Unit), CN (Common Name), emailAddress (Email Address).
+ * info: "/C=cn/ST=bj/L=bj/O=hd/OU=dev/CN=hello/emailAddress=hello@world.com"
+ * @param info  object.
+ * @param password  Certificate file password.
+ * @param save_path Certificate file save path.
+ * @param certUsage The usage of this certificate.
+ * @return Return true: Succeed. Return false: Fail.
+*/
++ (BOOL)generatePKCS12CertWithInfo:(NSDictionary *)info password:(NSString *)password toPath:(NSString *)path certUsage:(CPDFCertUsage)certUsage;
 
 
 @end
 @end

+ 0 - 50
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSignatureWidgetAnnotation+Signature.h

@@ -1,50 +0,0 @@
-//
-//  CPDFSignatureWidgetAnnotation+Signature.h
-//  ComPDFKit
-//
-//  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 <ComPDFKit/CPDFSignatureWidgetAnnotation.h>
-
-@class CPDFSignature;
-
-@interface CPDFSignatureConfigItem : NSObject
-
-@property (nonatomic,copy) NSString *key;
-@property (nonatomic,copy) NSString *value;
-
-@end
-
-@interface CPDFSignatureConfig : NSObject
-
-@property (nonatomic,retain) NSArray<CPDFSignatureConfigItem *> *contents;
-
-@property (nonatomic,assign) BOOL isDrawKey;
-@property (nonatomic,assign) BOOL isDrawLogo;
-@property (nonatomic,assign) BOOL isDrawOnlyContent;
-@property (nonatomic,assign) BOOL isContentAlginLeft;
-
-@property (nonatomic,copy) NSString *text;
-@property (nonatomic,retain) CPDFKitPlatformImage *image;
-@property (nonatomic,retain) CPDFKitPlatformImage *logo;
-
-@property (nonatomic,retain) CPDFKitPlatformColor *contentsColor;
-@property (nonatomic,retain) CPDFKitPlatformColor *textColor;
-
-@end
-
-@interface CPDFSignatureWidgetAnnotation (Signature)
-
-- (CPDFSignature *)signature;
-
-- (void)removeSignature;
-
-- (void)signWithSignatureConfig:(CPDFSignatureConfig *)config;
-
-@end

+ 57 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFSignatureWidgetAnnotation.h

@@ -12,10 +12,67 @@
 
 
 #import <ComPDFKit/CPDFWidgetAnnotation.h>
 #import <ComPDFKit/CPDFWidgetAnnotation.h>
 
 
+@class CPDFSignature;
+
+#pragma mark - CPDFSignatureConfigItem
+
+@interface CPDFSignatureConfigItem : NSObject
+
+@property (nonatomic,copy) NSString *key;
+@property (nonatomic,copy) NSString *value;
+
+@end
+
+#pragma mark - CPDFSignatureConfig
+
+@interface CPDFSignatureConfig : NSObject
+
+@property (nonatomic,retain) NSArray<CPDFSignatureConfigItem *> *contents;
+
+@property (nonatomic,assign) BOOL isDrawKey;
+@property (nonatomic,assign) BOOL isDrawLogo;
+@property (nonatomic,assign) BOOL isDrawOnlyContent;
+@property (nonatomic,assign) BOOL isContentAlginLeft;
+
+@property (nonatomic,copy) NSString *text;
+@property (nonatomic,retain) CPDFKitPlatformImage *image;
+@property (nonatomic,retain) CPDFKitPlatformImage *logo;
+
+@property (nonatomic,retain) CPDFKitPlatformColor *contentsColor;
+@property (nonatomic,retain) CPDFKitPlatformColor *textColor;
+
+@end
+
+#pragma mark - CPDFSignatureWidgetAnnotation
+
 @interface CPDFSignatureWidgetAnnotation : CPDFWidgetAnnotation
 @interface CPDFSignatureWidgetAnnotation : CPDFWidgetAnnotation
 
 
 - (BOOL)isSigned;
 - (BOOL)isSigned;
 
 
 - (void)signWithImage:(CPDFKitPlatformImage *)image;
 - (void)signWithImage:(CPDFKitPlatformImage *)image;
 
 
+
+#pragma mark - Digital Signature
+
+/**
+ * Get the signature of a signature widget.
+ */
+- (CPDFSignature *)signature;
+
+/**
+ * Remove the corresponding signature
+ */
+- (void)removeSignature;
+
+/**
+ * Configure the appearance of signatures.
+ */
+- (void)signAppearanceConfig:(CPDFSignatureConfig *)config ;
+
+@end
+
+@interface CPDFSignatureWidgetAnnotation (Deprecated)
+
+- (void)signWithSignatureConfig:(CPDFSignatureConfig *)config  DEPRECATED_MSG_ATTRIBUTE("Use CPDFSignatureWidgetAnnotation::signAppearanceConfig:");
+
 @end
 @end

+ 23 - 12
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/CPDFView+Editing.h

@@ -44,6 +44,22 @@ typedef NS_OPTIONS(NSInteger, CEditingSelectState) {
     CEditingSelectStateEditSelectText,
     CEditingSelectStateEditSelectText,
 };
 };
 
 
+#pragma mark - CEditAttributes
+
+@interface CEditAttributes : NSObject
+
+@property (nonatomic,retain) NSFont * _Nonnull font;
+
+@property (nonatomic,retain) NSColor *_Nonnull fontColor;
+
+@property (nonatomic,assign) BOOL isBold;
+
+@property (nonatomic,assign) BOOL isItalic;
+
+@property (nonatomic,assign) NSTextAlignment alignment;
+
+@end
+
 #pragma mark - CPDFEditingConfig
 #pragma mark - CPDFEditingConfig
 
 
 @interface CPDFEditingConfig : NSObject
 @interface CPDFEditingConfig : NSObject
@@ -377,16 +393,7 @@ typedef NS_OPTIONS(NSInteger, CEditingSelectState) {
  */
  */
 - (BOOL)createEmptyStringBounds:(CGRect)rect withAttributes:(NSDictionary<NSAttributedStringKey, id> *)attributes page:(CPDFPage *)page;
 - (BOOL)createEmptyStringBounds:(CGRect)rect withAttributes:(NSDictionary<NSAttributedStringKey, id> *)attributes page:(CPDFPage *)page;
 
 
-struct CEditAttributes {
-    NSFont *_Nonnull font;
-    NSColor *_Nonnull fontColor;
-    BOOL isBold;
-    BOOL isItem;
-    NSTextAlignment alignment;
-};
-typedef struct CEditAttributes CEditAttributes;
-
-- (BOOL)createStringBounds:(CGRect)rect withAttributes:(CEditAttributes)attributes page:(CPDFPage *_Nonnull)page;
+- (BOOL)createStringBounds:(CGRect)rect withAttributes:(CEditAttributes * _Nullable )attributes page:(CPDFPage *_Nonnull)page;
 
 
 /**
 /**
  * Gets the Edit supported font name.
  * Gets the Edit supported font name.
@@ -452,7 +459,7 @@ typedef struct CEditAttributes CEditAttributes;
 /**
 /**
  * Sets the currently selected text is bold.
  * Sets the currently selected text is bold.
  */
  */
-- (void)setCurrentSelectionIsBold:(BOOL)isBold withTextArea:(CPDFEditTextArea *)editArea;
+- (BOOL)setCurrentSelectionIsBold:(BOOL)isBold withTextArea:(CPDFEditTextArea *)editArea;
 
 
 /**
 /**
  * Whether the font of the currently selected text block is italic.
  * Whether the font of the currently selected text block is italic.
@@ -467,7 +474,7 @@ typedef struct CEditAttributes CEditAttributes;
 /**
 /**
  * Sets the currently selected text is italic.
  * Sets the currently selected text is italic.
  */
  */
-- (void)setCurrentSelectionIsItalic:(BOOL)isItalic withTextArea:(CPDFEditTextArea *)editArea;
+- (BOOL)setCurrentSelectionIsItalic:(BOOL)isItalic withTextArea:(CPDFEditTextArea *)editArea;
 
 
 /**
 /**
  * Gets the alignment of a text block or a piece of text.
  * Gets the alignment of a text block or a piece of text.
@@ -517,11 +524,15 @@ typedef struct CEditAttributes CEditAttributes;
  */
  */
 - (BOOL)createImagePath:(NSString *)filePath rect:(CGRect)rect page:(CPDFPage *)page;
 - (BOOL)createImagePath:(NSString *)filePath rect:(CGRect)rect page:(CPDFPage *)page;
 
 
+- (BOOL)createEmptyImage:(CGRect)rect page:(CPDFPage *_Nonnull)page image:(CPDFKitPlatformImage *_Nonnull)image;
+
 /*
 /*
  * Replace of the image.
  * Replace of the image.
  */
  */
 - (BOOL)replaceEditImageArea:(CPDFEditImageArea *)editArea imagePath:(NSString *)imagePath rect:(CGRect)rect;
 - (BOOL)replaceEditImageArea:(CPDFEditImageArea *)editArea imagePath:(NSString *)imagePath rect:(CGRect)rect;
 
 
+- (BOOL)replaceEditImageArea:(CPDFEditImageArea * _Nonnull)editArea image:(CPDFKitPlatformImage *_Nonnull)image rect:(CGRect)rect ;
+
 /*
 /*
  *  Ends cropping.
  *  Ends cropping.
  */
  */

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Headers/ComPDFKit.h

@@ -61,7 +61,6 @@
 #import <ComPDFKit/CPDFChoiceWidgetAnnotation.h>
 #import <ComPDFKit/CPDFChoiceWidgetAnnotation.h>
 #import <ComPDFKit/CPDFTextWidgetAnnotation.h>
 #import <ComPDFKit/CPDFTextWidgetAnnotation.h>
 #import <ComPDFKit/CPDFSignatureWidgetAnnotation.h>
 #import <ComPDFKit/CPDFSignatureWidgetAnnotation.h>
-#import <ComPDFKit/CPDFSignatureWidgetAnnotation+Signature.h>
 #import <ComPDFKit/CPDFWidgetAnnotation+Protected.h>
 #import <ComPDFKit/CPDFWidgetAnnotation+Protected.h>
 #import <ComPDFKit/CPDFChoiceWidgetAnnotation+Protected.h>
 #import <ComPDFKit/CPDFChoiceWidgetAnnotation+Protected.h>
 #import <ComPDFKit/CPDFTextWidgetAnnotation+Protected.h>
 #import <ComPDFKit/CPDFTextWidgetAnnotation+Protected.h>

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/Resources/Info.plist

@@ -17,13 +17,13 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>1.9.1.2</string>
+	<string>1.10.0</string>
 	<key>CFBundleSupportedPlatforms</key>
 	<key>CFBundleSupportedPlatforms</key>
 	<array>
 	<array>
 		<string>MacOSX</string>
 		<string>MacOSX</string>
 	</array>
 	</array>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>191</string>
+	<string>1101</string>
 	<key>DTCompiler</key>
 	<key>DTCompiler</key>
 	<string>com.apple.compilers.llvm.clang.1_0</string>
 	<string>com.apple.compilers.llvm.clang.1_0</string>
 	<key>DTPlatformBuild</key>
 	<key>DTPlatformBuild</key>

+ 17 - 28
PDF Office/PDF Master/Class/PDFWindowController/PDFSDK/ComPDFKit.framework/Versions/A/_CodeSignature/CodeResources

@@ -42,7 +42,7 @@
 		</data>
 		</data>
 		<key>Resources/Info.plist</key>
 		<key>Resources/Info.plist</key>
 		<data>
 		<data>
-		zJ0dtaS1v2hoIQAjf+UPYeLQHaw=
+		1FigiN05lh3w2lfR4Cz5bbo0RnM=
 		</data>
 		</data>
 		<key>Resources/empty_password.png</key>
 		<key>Resources/empty_password.png</key>
 		<data>
 		<data>
@@ -397,11 +397,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			6XehgxpJ7QjjYdfb5couzee/kEM=
+			oBnJ44v9TWrd9YIWUgkINX53F3o=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			/n2o6DgAnR/D9myEhKPS7sU4mamTsunvj5Npv3ITKkI=
+			ylFVq0ybvRJeuzev9EHYNF+ufRJgCUIzKoxg3VXFmTU=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Headers/CPDFDocument+Utilities.h</key>
 		<key>Headers/CPDFDocument+Utilities.h</key>
@@ -419,11 +419,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			AyX3zTYk9X3341bOn6xIdFus1XU=
+			FvPqA7H+eYnH8LYZ7RQtSU5GH1M=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			1GFBfO8iU6x3hPpuz68wqFiOgfHdpBEWBys8s442v+k=
+			nIUJCxFUDnd1RCLl4i7ygDCJ0FKOZ9Pw1sFnuuEuV4o=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Headers/CPDFFreeTextAnnotation.h</key>
 		<key>Headers/CPDFFreeTextAnnotation.h</key>
@@ -496,11 +496,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			RzqmgOZNGqX9z0dg5iKqB8z45eY=
+			Ll0xXIUGni31GF2Gc2xxVvY1VJc=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			hanIzau+I1mcfM97fm+mMcPL2hF75ZQ6SolHrDujEUw=
+			MhiAPk8jEHnc7nSLjVodF2FbIBHV9B0mpOerl27V+7A=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Headers/CPDFKitConfig+Private.h</key>
 		<key>Headers/CPDFKitConfig+Private.h</key>
@@ -716,11 +716,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			xc2nzDAd7aBpiIuOaFR5ye3Ar7s=
+			JNn/AM9+WtcBc5JJX0F7pZbMMsY=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			o1Ubnz/+F8ytZv4r0dduCkePynk42HPCk092erSgBf8=
+			9FLowjrldhf5ZTaCzudfKMwINZOly+/mqYR1ScItnC4=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Headers/CPDFSignatureAnnotation+Protected.h</key>
 		<key>Headers/CPDFSignatureAnnotation+Protected.h</key>
@@ -745,26 +745,15 @@
 			PhEQJYeg284jkYRJqBLqD7OKhRFHHrx+TPb5reh1iJk=
 			PhEQJYeg284jkYRJqBLqD7OKhRFHHrx+TPb5reh1iJk=
 			</data>
 			</data>
 		</dict>
 		</dict>
-		<key>Headers/CPDFSignatureWidgetAnnotation+Signature.h</key>
-		<dict>
-			<key>hash</key>
-			<data>
-			MC4MVkaiDkFXVuSwxHxRA5GFRxg=
-			</data>
-			<key>hash2</key>
-			<data>
-			CTTh8tP47BN9TwG8I6ua5FuL2gYjydn0vJffYXb4YKk=
-			</data>
-		</dict>
 		<key>Headers/CPDFSignatureWidgetAnnotation.h</key>
 		<key>Headers/CPDFSignatureWidgetAnnotation.h</key>
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			8A746guQ9h5w09O18k+Tyr8rCVA=
+			Nq+4UqlGUnlEOMQ5GezIbAOVNnI=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			PsgdxvKsoxJ7d8vK/ju4Via/jHe7qoolewPkF9jkwpk=
+			IT723OE/bKApNCUEcdFms8jFSlNMQWxdlyTisQKpRAs=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Headers/CPDFSoundAnnotation.h</key>
 		<key>Headers/CPDFSoundAnnotation.h</key>
@@ -892,11 +881,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			VidUKXL2gm1h+TWkoo9lGttzaoI=
+			rXjBq5hoYvk0ZFEpMyrt24IJovw=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			re8+9FuHHpox4aiAl4hS5N6eF3EINNvfg8PY1Lf2z/I=
+			PdIIG8Q8p5JDN5tNHS2QN7uXXRXm3iW3q+EvfFzX52A=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Headers/CPDFView+Utilities.h</key>
 		<key>Headers/CPDFView+Utilities.h</key>
@@ -969,11 +958,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			X3cjMRBsiRTgI1R1+81KraX25MI=
+			vUbXOcdc7dh0/5VieyWIrQfnKHc=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			YJ8Ay/q32PQKc+6P+vwILRVSNPOvSa0I/GkG4jt8bAM=
+			QTfNYbPykxvA/y3nvEJgup7QNmIRRneWLzhjzDP/gQM=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Modules/module.modulemap</key>
 		<key>Modules/module.modulemap</key>
@@ -1090,11 +1079,11 @@
 		<dict>
 		<dict>
 			<key>hash</key>
 			<key>hash</key>
 			<data>
 			<data>
-			zJ0dtaS1v2hoIQAjf+UPYeLQHaw=
+			1FigiN05lh3w2lfR4Cz5bbo0RnM=
 			</data>
 			</data>
 			<key>hash2</key>
 			<key>hash2</key>
 			<data>
 			<data>
-			vUVyi3EAcEXLvx6h2FszmXerV4mouemH0vioYJPcGUQ=
+			88avAlmQn6Umy7k3D+YyamfEtlQDiYgRHANLdNa6Tts=
 			</data>
 			</data>
 		</dict>
 		</dict>
 		<key>Resources/empty_password.png</key>
 		<key>Resources/empty_password.png</key>

+ 20 - 15
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Signature/KMSignatureViewController.swift

@@ -103,8 +103,9 @@ class KMSignatureViewController: NSViewController {
         let indexSet : NSIndexSet = item.representedObject as! NSIndexSet
         let indexSet : NSIndexSet = item.representedObject as! NSIndexSet
         let outlineItem  = self.sigOutlineView.item(atRow: indexSet.firstIndex)
         let outlineItem  = self.sigOutlineView.item(atRow: indexSet.firstIndex)
         if outlineItem is CPDFSignature {
         if outlineItem is CPDFSignature {
-            if self.listView.currentPageIndex != (outlineItem as! CPDFSignature).pageIndex {
-                self.listView.go(toPageIndex: Int((outlineItem as! CPDFSignature).pageIndex), animated: true)
+            let index: Int = Int((outlineItem as! CPDFSignature).pageIndex(with: listView.document))
+            if self.listView.currentPageIndex != index {
+                self.listView.go(toPageIndex: index, animated: true)
             }
             }
         }
         }
     }
     }
@@ -113,7 +114,8 @@ class KMSignatureViewController: NSViewController {
         let index : NSIndexSet = item.representedObject as! NSIndexSet
         let index : NSIndexSet = item.representedObject as! NSIndexSet
         let outlineItem  = self.sigOutlineView.item(atRow: index.firstIndex)
         let outlineItem  = self.sigOutlineView.item(atRow: index.firstIndex)
         if outlineItem is CPDFSignature {
         if outlineItem is CPDFSignature {
-            if self.listView.currentPageIndex != (outlineItem as! CPDFSignature).pageIndex {
+            let index: Int = Int((outlineItem as! CPDFSignature).pageIndex(with: listView.document))
+            if self.listView.currentPageIndex != index {
                 self.delete?.removeDocumentSignatues?(signatures: [outlineItem as! CPDFSignature])
                 self.delete?.removeDocumentSignatues?(signatures: [outlineItem as! CPDFSignature])
             }
             }
         }
         }
@@ -133,7 +135,8 @@ class KMSignatureViewController: NSViewController {
         let index : NSIndexSet = item.representedObject as! NSIndexSet
         let index : NSIndexSet = item.representedObject as! NSIndexSet
         let outlineItem  = self.sigOutlineView.item(atRow: index.firstIndex)
         let outlineItem  = self.sigOutlineView.item(atRow: index.firstIndex)
         if outlineItem is CPDFSignature {
         if outlineItem is CPDFSignature {
-            if self.listView.currentPageIndex != (outlineItem as! CPDFSignature).pageIndex {
+            let index: Int = Int((outlineItem as! CPDFSignature).pageIndex(with: listView.document))
+            if self.listView.currentPageIndex != index {
                 
                 
             }
             }
         }
         }
@@ -144,9 +147,11 @@ class KMSignatureViewController: NSViewController {
         let row = self.sigOutlineView.clickedRow
         let row = self.sigOutlineView.clickedRow
         if (row >= 0) && (row < self.signatures.count) {
         if (row >= 0) && (row < self.signatures.count) {
             let outlineItem : CPDFSignature = self.sigOutlineView.item(atRow: row) as! CPDFSignature
             let outlineItem : CPDFSignature = self.sigOutlineView.item(atRow: row) as! CPDFSignature
-            if self.listView.currentPageIndex != outlineItem.pageIndex {
-                if self.listView.currentPageIndex != outlineItem.pageIndex {
-                    self.listView.go(toPageIndex: Int(outlineItem.pageIndex), animated: true)
+            let index: Int = Int((outlineItem).pageIndex(with: listView.document))
+            if self.listView.currentPageIndex != index {
+                
+                if self.listView.currentPageIndex != index {
+                    self.listView.go(toPageIndex: index, animated: true)
                 }
                 }
             }
             }
         }
         }
@@ -190,7 +195,7 @@ extension KMSignatureViewController : NSOutlineViewDelegate,NSOutlineViewDataSou
         var contentString = ""
         var contentString = ""
         if item is CPDFSignature {
         if item is CPDFSignature {
             let signer : CPDFSigner = (item as! CPDFSignature).signers.first ?? CPDFSigner()
             let signer : CPDFSigner = (item as! CPDFSignature).signers.first ?? CPDFSigner()
-            contentString = "\(NSLocalizedString("Signature by", comment: ""))\(signer.name ?? "")"
+            contentString = "\(NSLocalizedString("Signature by", comment: ""))\(signer.timestampSignature.name ?? "")"
             if signer.isSignVerified && signer.isCertTrusted {
             if signer.isSignVerified && signer.isCertTrusted {
                 cell.signatureImageView.image = NSImage(named: "KMImageNameSigntureVerifySuccess")
                 cell.signatureImageView.image = NSImage(named: "KMImageNameSigntureVerifySuccess")
             } else if signer.isSignVerified && !signer.isCertTrusted {
             } else if signer.isSignVerified && !signer.isCertTrusted {
@@ -226,7 +231,7 @@ extension KMSignatureViewController : NSOutlineViewDelegate,NSOutlineViewDataSou
         var font = NSFont.systemFont(ofSize: 12)
         var font = NSFont.systemFont(ofSize: 12)
         if item is CPDFSignature {
         if item is CPDFSignature {
             let signer = (item as! CPDFSignature).signers.first
             let signer = (item as! CPDFSignature).signers.first
-            contentString = "\(NSLocalizedString("Signature by", comment: ""))\(String(describing: signer?.name))"
+            contentString = "\(NSLocalizedString("Signature by", comment: ""))\(String(describing: signer?.timestampSignature.name))"
             font = NSFont.systemFont(ofSize: 13)
             font = NSFont.systemFont(ofSize: 13)
         } else if (item is String){
         } else if (item is String){
             contentString = item as! String
             contentString = item as! String
@@ -296,8 +301,8 @@ extension CPDFSignature {
         }
         }
         
         
         var timestampSigners = ""
         var timestampSigners = ""
-        if signer?.timestampSigners != nil {
-            let tSign = signer?.timestampSigners.first
+        if signer?.timestampSignature.signers != nil {
+            let tSign = signer?.timestampSignature.signers.first
             if tSign?.isSignVerified != nil && tSign?.isSignVerified != nil {
             if tSign?.isSignVerified != nil && tSign?.isSignVerified != nil {
                 timestampSigners = NSLocalizedString("The signature includes an embedded timestamp.", comment: "")
                 timestampSigners = NSLocalizedString("The signature includes an embedded timestamp.", comment: "")
             } else {
             } else {
@@ -315,16 +320,16 @@ extension CPDFSignature {
         let array = [NSLocalizedString("Certificate Details...", comment: ""),signer ?? CPDFSigner()] as [Any]
         let array = [NSLocalizedString("Certificate Details...", comment: ""),signer ?? CPDFSigner()] as [Any]
         dic[NSLocalizedString("Signature Details...", comment: "")] = array
         dic[NSLocalizedString("Signature Details...", comment: "")] = array
         datas.append(dic)
         datas.append(dic)
-        if signer?.timestampSigners != nil && signer?.timestampSigners.first?.date != nil{
+        if signer?.timestampSignature.signers != nil && signer?.timestampSignature.signers.first?.authenDate != nil{
             var dateFormatter = DateFormatter()
             var dateFormatter = DateFormatter()
             dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
             dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
-            let strDate = dateFormatter.string(from: signer?.timestampSigners.first?.date ?? Date())
+            let strDate = dateFormatter.string(from: signer?.timestampSignature.signers.first?.authenDate ?? Date())
             datas.append("\(NSLocalizedString("Last Checked:", comment: ""))\(strDate)")
             datas.append("\(NSLocalizedString("Last Checked:", comment: ""))\(strDate)")
         } else {
         } else {
             datas.append("\(NSLocalizedString("Last Checked:", comment: ""))\(NSLocalizedString("Never", comment: ""))")
             datas.append("\(NSLocalizedString("Last Checked:", comment: ""))\(NSLocalizedString("Never", comment: ""))")
         }
         }
-        let pageIndex = self.pageIndex
-        datas.append("\(NSLocalizedString("Field:", comment: ""))\(String(describing: self.fieldName))\(NSLocalizedString("on Page", comment: ""))\(pageIndex+1)")
+        let pageIndex = self.pageIndex(with: document)
+        datas.append("\(NSLocalizedString("Field:", comment: ""))\(self.fieldName.description)\(NSLocalizedString("on Page", comment: ""))\(pageIndex+1)")
         return datas
         return datas
     }
     }
 }
 }

+ 1 - 1
PDF Office/PDF Master/Class/Preference/Window/KMPreferenceWindowController.swift

@@ -47,7 +47,7 @@ class KMPreferenceWindowController: NSWindowController {
         super.windowDidLoad()
         super.windowDidLoad()
         self.window?.title = NSLocalizedString("Preferences", comment: "")
         self.window?.title = NSLocalizedString("Preferences", comment: "")
         self.window?.titlebarAppearsTransparent = true
         self.window?.titlebarAppearsTransparent = true
-        self.window?.appearance = NSAppearance(named: .aqua)
+//        self.window?.appearance = NSAppearance(named: .aqua)
         self.titleBarBox.fillColor = NSColor(white: 245/255.0, alpha: 1.0)
         self.titleBarBox.fillColor = NSColor(white: 245/255.0, alpha: 1.0)
         self.window?.backgroundColor = NSColor(white: 245/255.0, alpha: 1.0)
         self.window?.backgroundColor = NSColor(white: 245/255.0, alpha: 1.0)
         self.contentBox.fillColor = NSColor(white: 241/255.0, alpha: 1.0)
         self.contentBox.fillColor = NSColor(white: 241/255.0, alpha: 1.0)

+ 7 - 0
PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h

@@ -66,3 +66,10 @@
 #import "CPDFAnnotationModel.h"
 #import "CPDFAnnotationModel.h"
 #import "Reachability.h"
 #import "Reachability.h"
 #import "NSPointerArray+PDFListView.h"
 #import "NSPointerArray+PDFListView.h"
+
+
+//数字签名
+#import "KMDSignatureManager.h"
+#import "CPDFDigtalView.h"
+#import "CDSDrawView.h"
+#import "CPDFSignatureWidgetAnnotation+PDFListView.h"

+ 8 - 0
PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h

@@ -5,6 +5,7 @@
 #import <ComPDFKit/ComPDFKit.h>
 #import <ComPDFKit/ComPDFKit.h>
 #import "ComPDFUIKit.h"
 #import "ComPDFUIKit.h"
 #import "CPDFListView+Event.h"
 #import "CPDFListView+Event.h"
+#import "NSGeometry+PDFListView.h"
 
 
 #import "KMToolbarItem.h"
 #import "KMToolbarItem.h"
 #import "KMToolbar.h"
 #import "KMToolbar.h"
@@ -49,3 +50,10 @@
 #import "CPDFAnnotationModel.h"
 #import "CPDFAnnotationModel.h"
 #import "Reachability.h"
 #import "Reachability.h"
 #import "NSPointerArray+PDFListView.h"
 #import "NSPointerArray+PDFListView.h"
+
+
+//数字签名
+#import "KMDSignatureManager.h"
+#import "CPDFDigtalView.h"
+#import "CDSDrawView.h"
+#import "CPDFSignatureWidgetAnnotation+PDFListView.h"

+ 6 - 0
PDF Office/PDF Master/PDF_Master-Bridging-Header.h

@@ -63,3 +63,9 @@
 #import "CPDFListView.h"
 #import "CPDFListView.h"
 #import "Reachability.h"
 #import "Reachability.h"
 #import "NSPointerArray+PDFListView.h"
 #import "NSPointerArray+PDFListView.h"
+
+//数字签名
+#import "KMDSignatureManager.h"
+#import "CPDFDigtalView.h"
+#import "CDSDrawView.h"
+#import "CPDFSignatureWidgetAnnotation+PDFListView.h"