Browse Source

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

tangchao 1 year ago
parent
commit
b0b3501248
32 changed files with 799 additions and 82 deletions
  1. 31 0
      PDF Office/PDF Master/AppDelegate.swift
  2. 11 15
      PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift
  3. 10 12
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.swift
  4. 9 1
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateImageToPDFViewController.swift
  5. 2 2
      PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateImageToPDFViewController.xib
  6. 42 0
      PDF Office/PDF Master/Class/Common/Category/NSError_Extensions.swift
  7. 114 0
      PDF Office/PDF Master/Class/Document/KMDocumentController.swift
  8. 5 0
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift
  9. 2 2
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/KMSecurityWindowController.xib
  10. 4 0
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.swift
  11. 1 1
      PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.xib
  12. 4 0
      PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWIndowControllerNew.swift
  13. 1 1
      PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWindowController.xib
  14. 43 1
      PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.m
  15. 8 8
      PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.xib
  16. 3 3
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.xib
  17. 5 6
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/SplitWindowController.swift
  18. 10 0
      PDF Office/PDF Master/Class/PDFTools/RemovePassword/New/View/KMRemovePasswordView.swift
  19. 4 0
      PDF Office/PDF Master/Class/PDFTools/RemovePassword/VC/KMBatchOperateRemovePasswordViewController.swift
  20. 26 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFPageExtensions/CPDFPage+PDFListView.swift
  21. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h
  22. 64 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m
  23. 6 6
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift
  24. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayCustomThemesCollectionViewItem.swift
  25. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift
  26. 5 0
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift
  27. 6 6
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.xib
  28. 21 10
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  29. 115 0
      PDF Office/PDF Master/Info.plist
  30. 8 0
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj
  31. 115 0
      PDF Office/PDF-Reader-Pro-DMG-Info.plist
  32. 115 0
      PDF Office/PDF-Reader-Pro-Edition-Info.plist

+ 31 - 0
PDF Office/PDF Master/AppDelegate.swift

@@ -52,6 +52,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
             
         }
 #endif
+        NSApp.servicesProvider = self
         
         KMKdanRemoteConfig.remoteConfig().fetchWithRemoteConfigCompletionHandler { status, error in
             
@@ -794,3 +795,33 @@ extension AppDelegate : SUUpdaterDelegate {
     }
 }
 #endif
+
+extension AppDelegate {
+    // MARK: - Services Support
+    func openDocumentFromURLOnPboard(_ pboard: NSPasteboard, userData: String?, error errorString: inout String?) {
+        var error: NSError?
+        if let document = NSDocumentController.shared.openDocumentWithURLFromPasteboard(pboard, showNotes: false, outError: &error) {
+            // Document opened successfully
+        } else if let error = error {
+            errorString = error.localizedDescription
+        }
+    }
+
+    func openDocumentFromDataOnPboard(_ pboard: NSPasteboard, userData: String?, error errorString: inout String?) {
+        var error: NSError?
+        if let document = NSDocumentController.shared.openDocumentWithImageFromPasteboard(pboard, error: &error) {
+            // Document opened successfully
+        } else if let error = error {
+            errorString = error.localizedDescription
+        }
+    }
+
+    func openNotesDocumentFromURLOnPboard(_ pboard: NSPasteboard, userData: String?, error errorString: inout String?) {
+        var error: NSError?
+        if let document = NSDocumentController.shared.openDocumentWithURLFromPasteboard(pboard, showNotes: true, outError: &error) {
+            // Document opened successfully
+        } else if let error = error {
+            errorString = error.localizedDescription
+        }
+    }
+}

+ 11 - 15
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift

@@ -161,16 +161,13 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
     }
     
     func chooseFile() {
-#if VERSION_FREE 
-        // KMToolCompareWindowController *vc = [KMToolCompareWindowController toolCompareWithType:KMCompareWithToolType_Convert setSelectIndex:1];
-        // [vc showWindow:nil];
-//        if !IAPProductsManager.defaultManager().isAvailableAllFunction() {
-//            if files.count >= 1 {
-//                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-//                return
-//            }
-//        }
-            //展示升级页面
+#if VERSION_FREE
+        if !IAPProductsManager.default().isAvailableAllFunction() {
+            if files.count >= 1 {
+                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                return
+            }
+        }
 #endif
         self.progressInt = 0
         let panel = NSOpenPanel() 
@@ -179,10 +176,10 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
         } else {
             panel.allowedFileTypes = ["pdf", "PDF"]
         }
-//        if IAPProductsManager.defaultManager().isAvailableAllFunction() {
+        if IAPProductsManager.default().isAvailableAllFunction() {
             panel.allowsMultipleSelection = true
             panel.canChooseDirectories = true
-//        }
+        }
         panel.canChooseFiles = true
 #if VERSION_FREE
 #else
@@ -471,15 +468,14 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
 //                UTTypeString?.release()
             }
         }
-//        if !IAPProductsManager.default().isAvailableAllFunction() {
+        if !IAPProductsManager.default().isAvailableAllFunction() {
             if self.files.count < 1 {
-//                pdfArray = [pdfArray.first].compactMap { $0 } as! NSMutableArray
                 pdfArray = NSMutableArray(array: [pdfArray.firstObject as Any])
             } else {
                 KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
                 return
             }
-//        }
+        }
         addFilesToList(addArray: pdfArray)
     }
     func numberOfRows(in tableView: NSTableView) -> Int {

+ 10 - 12
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateConvertViewController.swift

@@ -410,19 +410,17 @@ class KMBatchOperateConvertViewController: KMBatchOperateBaseViewController,NSCo
         
 #if VERSION_FREE
         // 桌机版
-        //        if IAPProductsManager.defaultManager().isAvailableAllFunction {
-        //            if IAPProductsManager.defaultManager().isAvailableAdvancedPDFToOffice {
-        //                needShowAdvance = true
-        //                needShowDefault = false
-        //            }
-        //        }
+        if IAPProductsManager.default().isAvailableAllFunction() {
+            if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+                needShowAdvance = true
+                needShowDefault = false
+            }
+        }
 #else
-        
-        //        if IAPProductsManager.defaultManager().isAvailableAdvancedPDFToOffice {
-        //            needShowAdvance = true
-        //            needShowDefault = false
-        //        }
-        
+        if IAPProductsManager.default().isAvailableAdvancedPDFToOffice() {
+            needShowAdvance = true
+            needShowDefault = false
+        }
 #endif
         
         if needShowDefault {

+ 9 - 1
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateImageToPDFViewController.swift

@@ -362,7 +362,11 @@ class KMBatchOperateImageToPDFViewController: KMBatchOperateBaseViewController,
     
     @IBAction func buttonClicked_OCRSelect(_ sender: NSButton) {
         //MARK: 判断是否付费用户
-        
+        if IAPProductsManager.default().isAvailableAllFunction() == false {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            self.ocrSelectBtn.state = .off
+            return
+        }
         if (sender.state == .on) {
             self.languageButton.isEnabled = true
             self.planButton.isEnabled = true
@@ -403,6 +407,10 @@ class KMBatchOperateImageToPDFViewController: KMBatchOperateBaseViewController,
         if self.files?.count ?? 0 < 1 {
             return
         }
+        if IAPProductsManager.default().isAvailableAllFunction() == false && self.files?.count ?? 0 > 1{
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         if sender.tag == 1 {
             self.choosePath = ""
             var hasTask = false

+ 2 - 2
PDF Office/PDF Master/Class/Batch/WindowController/VC/KMBatchOperateImageToPDFViewController.xib

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchOperateImageToPDFViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchOperateImageToPDFViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="actionButton" destination="HkY-4k-ShL" id="8zS-qE-smL"/>
                 <outlet property="appendBackView" destination="k0c-vv-NPP" id="qiK-0Y-Nqs"/>
@@ -73,7 +73,7 @@
                     <subviews>
                         <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AKV-3R-iGQ">
                             <rect key="frame" x="-1" y="1" width="404" height="22"/>
-                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" alignment="left" id="V8A-qR-hoa" customClass="KMTextFieldCell" customModule="PDF_Master" customModuleProvider="target">
+                            <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" alignment="left" id="V8A-qR-hoa" customClass="KMTextFieldCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                 <font key="font" metaFont="system"/>
                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>

+ 42 - 0
PDF Office/PDF Master/Class/Common/Category/NSError_Extensions.swift

@@ -0,0 +1,42 @@
+//
+//  NSError_Extensions.swift
+//  PDF Reader Pro
+//
+//  Created by lizhe on 2024/3/8.
+//
+
+import Cocoa
+
+enum KMDocumentErrorType: Int {
+    case writeFile = 1
+    case readFile = 2
+    case ReadPasteboard = 3
+    case printDocument = 4
+}
+
+let SKDocumentErrorDomain = "SKDocumentErrorDomain"
+extension NSError {
+    static func writeFileError(withLocalizedDescription description: String) -> NSError {
+        return NSError(domain: SKDocumentErrorDomain, code: KMDocumentErrorType.writeFile.rawValue, userInfo: [NSLocalizedDescriptionKey: description])
+    }
+    
+    static func readFileError(withLocalizedDescription description: String) -> NSError {
+        return NSError(domain: SKDocumentErrorDomain, code: KMDocumentErrorType.readFile.rawValue, userInfo: [NSLocalizedDescriptionKey: description])
+    }
+    
+    static func readPasteboardError(withLocalizedDescription description: String) -> NSError {
+        return NSError(domain: SKDocumentErrorDomain, code: KMDocumentErrorType.ReadPasteboard.rawValue, userInfo: [NSLocalizedDescriptionKey: description])
+    }
+    
+    static func printDocumentError(withLocalizedDescription description: String) -> NSError {
+        return NSError(domain: SKDocumentErrorDomain, code: KMDocumentErrorType.printDocument.rawValue, userInfo: [NSLocalizedDescriptionKey: description])
+    }
+    
+    static func userCancelledError(withUnderlyingError error: NSError) -> NSError {
+        return NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError, userInfo: [NSUnderlyingErrorKey: error])
+    }
+    
+    var isUserCancelledError: Bool {
+        return domain == NSCocoaErrorDomain && code == NSUserCancelledError
+    }
+}

+ 114 - 0
PDF Office/PDF Master/Class/Document/KMDocumentController.swift

@@ -149,3 +149,117 @@ class KMDocumentController: NSDocumentController {
     }
 }
 
+extension NSDocumentController {
+    func openDocumentWithURLFromPasteboard(_ pboard: NSPasteboard, showNotes: Bool, outError: NSErrorPointer) -> Any? {
+        guard let theURLs = NSURL.readURLs(from: pboard), let theURL = theURLs.first else {
+            if showNotes == false {
+                outError?.pointee = NSError.readPasteboardError(withLocalizedDescription: NSLocalizedString("Unable to load data from clipboard", comment: "Error description"))
+            }
+            return nil
+        }
+        
+//        guard theURL.isFileURL else {
+//            if showNotes == false {
+//                return SKDownloadController.shared.addDownload(for: theURL)
+//            }
+//            return nil
+//        }
+        
+        var document: Any?
+//        do {
+//            let type = try self.type(forContentsOf: theURL)
+//            if showNotes == false || SKNotesDocument.readableTypes.contains(type) {
+//                document = try self.openDocument(withContentsOf: theURL, display: true)
+//            } else if SKMainDocument.readableTypes.contains(type) {
+//                for doc in self.documents {
+//                    if let sourceURL = (doc as? NSObject)?.value(forKey: "sourceFileURL") as? URL, sourceURL == theURL {
+//                        document = doc
+//                        break
+//                    }
+//                }
+//                if let existingDoc = document as? NSDocument {
+//                    existingDoc.showWindows()
+//                } else {
+//                    var error: NSError?
+//                    var data: Data?
+//                    
+//                    if NSWorkspace.shared.type(type, conformsToType: SKPDFBundleDocumentType) {
+//                        if let skimFileURL = try FileManager.default.bundledFileURL(withExtension: "skim", inPDFBundleAt: theURL) {
+//                            data = try Data(contentsOf: skimFileURL)
+//                        }
+//                    } else {
+//                        data = try SKNExtendedAttributeManager.shared().extendedAttributeNamed(SKIM_NOTES_KEY, atPath: theURL.path, traverseLink: true)
+//                    }
+//                    
+//                    let newDocument = try makeUntitledDocument(ofType: SKNotesDocumentType)
+//                    newDocument.sourceFileURL = theURL
+//                    
+//                    if data == nil || newDocument.read(from: data ?? Data(), ofType: SKNotesDocumentType) {
+//                        self.addDocument(newDocument)
+//                        newDocument.makeWindowControllers()
+//                        newDocument.showWindows()
+//                    } else {
+//                        document = nil
+//                        outError?.pointee = error
+//                    }
+//                }
+//            }
+//        } catch {
+//            outError?.pointee = error as NSError
+//        }
+        
+        return document
+    }
+
+    
+    func openDocumentWithImageFromPasteboard(_ pboard: NSPasteboard, error outError: NSErrorPointer) -> Any? {
+        var document: Any?
+//        var data: Data?
+//        var type: String?
+//        
+//        if pboard.canReadItem(withDataConformingToTypes: [NSPasteboard.PasteboardType.PDF]) {
+//            pboard.types
+//            data = pboard.data(forType: NSPasteboard.PasteboardType.PDF)
+//            type = SKPDFDocumentType
+//        } else if pboard.canReadItem(withDataConformingToTypes: [SKPasteboardTypePostScript]) {
+//            pboard.types
+//            data = pboard.data(forType: SKPasteboardTypePostScript)
+//            type = isEncapsulatedPostScriptData(data) ? SKEncapsulatedPostScriptDocumentType : SKPostScriptDocumentType
+//        } else if pboard.canReadItem(withDataConformingToTypes: [NSPasteboard.PasteboardType.tiff]) {
+//            pboard.types
+//            data = convertTIFFDataToPDF(pboard.data(forType: NSPasteboard.PasteboardType.tiff))
+//            type = SKPDFDocumentType
+//        } else {
+//            let images = pboard.readObjects(forClasses: [NSImage.self], options: [:]) as? [NSImage]
+//            let strings = pboard.readObjects(forClasses: [NSAttributedString.self], options: [:]) as? [NSAttributedString]
+//            if let images = images, images.count > 0 {
+//                data = convertTIFFDataToPDF(images[0].tiffRepresentation)
+//                type = SKPDFDocumentType
+//            } else if let strings = strings, strings.count > 0 {
+//                data = convertStringsToPDF(strings)
+//                type = SKPDFDocumentType
+//            }
+//        }
+//        
+//        if let data = data, let type = type {
+//            var error: NSError?
+//            document = makeUntitledDocument(ofType: type, error: &error)
+//            
+//            if (document as? NSDocument)?.read(from: data, ofType: type, error: &error) ?? false {
+//                addDocument(document as! NSDocument)
+//                (document as! NSDocument).makeWindowControllers()
+//                (document as! NSDocument).showWindows()
+//            } else {
+//                document = nil
+//                if let outError = outError {
+//                    outError.pointee = error
+//                }
+//            }
+//        } else if let outError = outError {
+//            outError.pointee = NSError.readPasteboardError(withLocalizedDescription: NSLocalizedString("Unable to load data from clipboard", comment: "Error description"))
+//        }
+//        
+        return document
+    }
+
+}

+ 5 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift

@@ -1022,6 +1022,11 @@ extension KMHomeViewController {
 //        openPanel.canChooseFiles = false
 //        openPanel.canChooseDirectories = true
 //        openPanel.canCreateDirectories = true
+        if IAPProductsManager.default().isAvailableAllFunction(){
+            openPanel.allowsMultipleSelection = true
+        }else{
+            openPanel.allowsMultipleSelection = false
+        }
         
         openPanel.beginSheetModal(for: NSWindow.currentWindow()) { [self] (result) in
             if result == NSApplication.ModalResponse.OK {

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/KMSecurityWindowController.xib

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMSecurityWindowController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMSecurityWindowController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="securityView" destination="zui-su-xYD" id="xMa-J3-DxA"/>
                 <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
@@ -23,7 +23,7 @@
                 <rect key="frame" x="0.0" y="0.0" width="572" height="544"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="zui-su-xYD" customClass="KMSecurityView" customModule="PDF_Master" customModuleProvider="target">
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="zui-su-xYD" customClass="KMSecurityView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="572" height="544"/>
                     </customView>
                 </subviews>

+ 4 - 0
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.swift

@@ -159,6 +159,10 @@ extension KMSecurityView {
 
 extension KMSecurityView {
     @IBAction func batchButtonAction(_ sender: Any) {
+        if !IAPProductsManager.default().isAvailableAllFunction(){
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         guard let callBack = batchAction else { return }
         
         callBack(self, files)

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/AddPassword/New/View/KMSecurityView.xib

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMSecurityView" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMSecurityView" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="authorLabel" destination="feB-OM-BTK" id="z0F-u2-2gZ"/>
                 <outlet property="authorTextField" destination="FbH-uh-vhX" id="TSb-Px-cuK"/>

+ 4 - 0
PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWIndowControllerNew.swift

@@ -62,6 +62,10 @@ class KMCompressWIndowControllerNew: KMBaseWindowController {
         
         self.compressView.batchAction = { [unowned self] view in
             print("Batch 按钮点击")
+            if !IAPProductsManager.default().isAvailableAllFunction(){
+                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                return
+            }
             guard let callBack = batchAction else { return }
             
             callBack(self, [documentURL])

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

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMCompressWindowController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMCompressWindowController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="batchButton" destination="AoG-8q-Bt0" id="pax-kh-bg6"/>
                 <outlet property="cancelBox" destination="cc4-qh-Kgl" id="J5p-tk-MHT"/>

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

@@ -446,7 +446,16 @@ static KMPDFEditAppendWindow *windowController = nil;
             CGFloat fileSize = [[attrib objectForKey:NSFileSize] floatValue];
             
             weakSelf.allFileSize =  weakSelf.allFileSize + fileSize;
-//            weakSelf.allFileSize = weakSelf.allFileSize - fileSize;
+            if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+                //免費版只支援2個檔案做合併小于20M的文件合并
+                if (self->_files.count >= 2 || self.allFileSize > (20 * 1024 * 1024)) {
+                    [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+                    self.allFileSize = self.allFileSize - fileSize;
+
+                    [self addFiles:array];
+                    return;
+                }
+            }
             [array addObject:path];
         }
         [weakSelf addFiles:array];
@@ -1086,6 +1095,16 @@ static KMPDFEditAppendWindow *windowController = nil;
             CGFloat fileSize = [[attrib objectForKey:NSFileSize] floatValue];
             
             self.allFileSize = self.allFileSize + fileSize;
+            if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+                //免費版只支援2個檔案做合併小于20M的文件合并
+                if (_files.count >= 2 || self.allFileSize > (20 * 1024 * 1024)) {
+                    [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+                    self.allFileSize = self.allFileSize - fileSize;
+                    [self addFiles:array];
+                    result = YES;
+                    return NO;
+                }
+            }
             [array addObject:path];
         }
         [self addFiles:array];
@@ -1275,6 +1294,21 @@ static KMPDFEditAppendWindow *windowController = nil;
             return;
         }
     }
+    //计算所有文件的大小,非会员如果超过20M,不允许继续操作
+    CGFloat allSize;
+    
+    for (KMFileAttribute *file in _files) {
+        NSDictionary *attrib = [[NSFileManager defaultManager] attributesOfItemAtPath:[file filePath] error:nil];
+        allSize = [[attrib objectForKey:NSFileSize] floatValue] + allSize;
+        
+    }
+    
+    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+        if (allSize > (20 * 1024 * 1024) || _files.count > 2) {
+            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+            return;
+        }
+    }
     
     _isSuccessfully = NO;
     [self.nCancelVC setEnabled:NO];
@@ -1558,6 +1592,14 @@ static KMPDFEditAppendWindow *windowController = nil;
 
 - (IBAction)buttonItemClicked_AddFile:(id)sender
 {
+    if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
+        //免費版只支援2個檔案做合併小于20M的文件合并
+        if (_files.count >= 2 || self.allFileSize > (20 * 1024 * 1024)) {
+            [[KMPurchaseCompareWindowController sharedInstance] showWindow:nil];
+            return;
+        }
+        
+    }
     NSMenu *menu = [[NSMenu alloc] init];
     NSMenuItem *addFileItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"add files", "") action:@selector(itemAddFileAction) keyEquivalent:@""];
     addFileItem.target = self;

+ 8 - 8
PDF Office/PDF Master/Class/PDFTools/Merge/OCPart/KMPDFEditAppendWindow.xib

@@ -61,7 +61,7 @@
                         <rect key="frame" x="0.0" y="60" width="802" height="492"/>
                         <clipView key="contentView" drawsBackground="NO" id="Mfh-Ax-kRE">
                             <rect key="frame" x="0.0" y="0.0" width="802" height="492"/>
-                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <autoresizingMask key="autoresizingMask"/>
                             <subviews>
                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="120" rowSizeStyle="automatic" viewBased="YES" id="hj6-Zp-r0z">
                                     <rect key="frame" x="0.0" y="0.0" width="802" height="492"/>
@@ -286,7 +286,7 @@
                     <box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="SNg-B0-ys5">
                         <rect key="frame" x="800" y="-4" width="7" height="606"/>
                         <view key="contentView" id="0Wa-d4-jxC">
-                            <rect key="frame" x="3" y="5" width="0.0" height="598"/>
+                            <rect key="frame" x="3.5" y="5" width="0.0" height="598"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
                                 <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ypq-Dp-66v">
@@ -335,25 +335,25 @@
                                         <constraint firstAttribute="height" constant="22" id="5bY-aF-fW3"/>
                                     </constraints>
                                 </customView>
-                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="5nS-LC-t5H" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="5nS-LC-t5H" customClass="KMImageTitleButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                     <rect key="frame" x="16" y="504" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="iSV-P3-W8x"/>
                                     </constraints>
                                 </customView>
-                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="85P-Ad-bEf" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="85P-Ad-bEf" customClass="KMImageTitleButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                     <rect key="frame" x="16" y="474" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="Ubd-is-gcz"/>
                                     </constraints>
                                 </customView>
-                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="PNC-MR-g6W" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="PNC-MR-g6W" customClass="KMImageTitleButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                     <rect key="frame" x="16" y="444" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="cMH-MX-phe"/>
                                     </constraints>
                                 </customView>
-                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="ZDa-uQ-GtJ" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="ZDa-uQ-GtJ" customClass="KMImageTitleButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                     <rect key="frame" x="16" y="414" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="o0Q-lr-IX5"/>
@@ -582,7 +582,7 @@
             </constraints>
             <point key="canvasLocation" x="87" y="-266"/>
         </customView>
-        <customView id="Bxz-CR-NgQ" customClass="KMBlankView" customModule="PDF_Master" customModuleProvider="target">
+        <customView id="Bxz-CR-NgQ" customClass="KMBlankView" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="770" height="419"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
@@ -613,7 +613,7 @@
                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                             </textFieldCell>
                         </textField>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="yde-fB-mTL" customClass="KMPDFEditAppendCustomView" customModule="PDF_Master" customModuleProvider="target">
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="yde-fB-mTL" customClass="KMPDFEditAppendCustomView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="0.0" width="418" height="188"/>
                         </customView>
                     </subviews>

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMPDFEditViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMPDFEditViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="contentBox" destination="H78-7z-jdm" id="fst-f6-ba8"/>
                 <outlet property="lineBoxView" destination="9X3-1V-DZ8" id="gB1-mA-E7R"/>

+ 5 - 6
PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/SplitWindowController.swift

@@ -157,12 +157,11 @@ class SplitWindowController: KMBaseWindowController {
     }
     
     @IBAction func buttonItemClicked_ByRange(_ sender: AnyObject) {
-//        if (![IAPProductsManager defaultManager].isAvailableAllFunction) {
-//            _pageFromButton.state = 0;
-//            KMToolCompareWindowController * vc = [KMToolCompareWindowController toolCompareWithType:KMCompareWithToolType_PageEdit setSelectIndex:1];
-//            [vc showWindow:nil];
-//            return;
-//        }
+        if !IAPProductsManager.default().isAvailableAllFunction() {
+            pageFromButton.state = .off
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return;
+        }
 
         self.byFileButton.state = .off
         self.byPageButton.state = .off

+ 10 - 0
PDF Office/PDF Master/Class/PDFTools/RemovePassword/New/View/KMRemovePasswordView.swift

@@ -52,6 +52,11 @@ class KMRemovePasswordView: KMBaseXibView {
 
 extension KMRemovePasswordView {
     @IBAction func batchButtonAction(_ sender: Any) {
+//        if !IAPProductsManager.default().isAvailableAllFunction(){
+//            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+//            return
+//        }
+
         guard let callBack = batchAction else { return }
         
         callBack(self, files)
@@ -65,6 +70,11 @@ extension KMRemovePasswordView {
     
     
     @IBAction func removeButtonAction(_ sender: Any) {
+        if !IAPProductsManager.default().isAvailableAllFunction(){
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
+
         guard let callBack = removeAction else { return }
         
         callBack(self, files)

+ 4 - 0
PDF Office/PDF Master/Class/PDFTools/RemovePassword/VC/KMBatchOperateRemovePasswordViewController.swift

@@ -120,6 +120,10 @@ class KMBatchOperateRemovePasswordViewController: KMBatchOperateBaseViewControll
         if self.files?.count ?? 0 < 1 {
             return;
         }
+        if !IAPProductsManager.default().isAvailableAllFunction(){
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         //MARK: 判断是否能用pro功能
         for i in 0..<self.files!.count {
             let file = self.files?[i]

+ 26 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFPageExtensions/CPDFPage+PDFListView.swift

@@ -8,6 +8,32 @@
 import Foundation
 
 @objc extension CPDFPage {
+    func pdfData(for rect: NSRect) -> Data? {
+        if rect == NSZeroRect {
+            return self.document.dataRepresentation()
+        }
+        if rect.isEmpty {
+            return nil
+        }
+        
+        var data: Data?
+        let page = self.copy() as! PDFPage
+        
+        if #available(macOS 10.11, *) {
+            // On 10.11 the media box is shifted back to the origin without the contents being shifted
+            page.setBounds(rect, for: .cropBox)
+        } else {
+            page.setBounds(rect, for: .mediaBox)
+            page.setBounds(NSZeroRect, for: .cropBox)
+        }
+        page.setBounds(NSZeroRect, for: .bleedBox)
+        page.setBounds(NSZeroRect, for: .trimBox)
+        page.setBounds(NSZeroRect, for: .artBox)
+        data = page.dataRepresentation
+        
+        return data
+    }
+    
     @objc func PDFListViewTIFFData(for rect: NSRect) -> Data? {
         if (NSIsEmptyRect(rect)) {
             return nil

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -252,6 +252,7 @@ typedef NS_ENUM(NSInteger, KMPDFViewSplitMode) {
 
 - (void)setPageBackgroundColorWithColor:(NSColor *)color viewMode:(KMPDFViewMode)viewMode;
 
+- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types;
 @end
 
 @protocol CPDFListViewDelegate <NSObject>

+ 64 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -87,6 +87,9 @@ NSNotificationName const KMPDFViewTableAnnotationDidChangeNotification = @"KMPDF
     self.clickLineAnnotation = nil;
     self.isClickDoubleCreatLine = NO;
     
+    NSArray *sendTypes = [NSArray arrayWithObjects:NSPasteboardTypePDF, NSPasteboardTypeTIFF, nil];
+    [NSApp registerServicesMenuSendTypes:sendTypes returnTypes:[NSArray array]];
+    
     KMPDFViewMode viewMode = KMPDFViewModeNormal;
     if ([[NSUserDefaults standardUserDefaults] objectForKey:@"kPDFViewModeKey"]) {
         viewMode = (KMPDFViewMode)[[[NSUserDefaults standardUserDefaults] objectForKey:@"kPDFViewModeKey"] integerValue];
@@ -1630,4 +1633,65 @@ NSNotificationName const KMPDFViewTableAnnotationDidChangeNotification = @"KMPDF
     [self setNeedsDisplay:YES];
 }
 
+#pragma mark Services
+
+- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types {
+    if ([self toolMode] == CSelectToolMode && NSIsEmptyRect(_selectionRect) == NO && _selectionPageIndex != NSNotFound) {
+        NSMutableArray *writeTypes = [NSMutableArray array];
+        NSString *pdfType = nil;
+        NSData *pdfData = nil;
+        NSString *tiffType = nil;
+        NSData *tiffData = nil;
+        NSRect selRect = NSIntegralRect(_selectionRect);
+        
+        // Unfortunately only old PboardTypes are requested rather than preferred UTIs, even if we only validate and the Service only requests UTIs, so we need to support both
+        if ([[self document] allowsPrinting] && [[self document] isLocked] == NO) {
+            if ([types containsObject:NSPasteboardTypePDF])
+                pdfType = NSPasteboardTypePDF;
+            else if ([types containsObject:NSPasteboardTypePDF])
+                pdfType = NSPasteboardTypePDF;
+            if (pdfType && (pdfData = [[self currentSelectionPage] pdfDataFor:selRect]))
+                [writeTypes addObject:pdfType];
+        }
+        if ([types containsObject:NSPasteboardTypeTIFF])
+            tiffType = NSPasteboardTypeTIFF;
+        else if ([types containsObject:NSPasteboardTypeTIFF])
+            tiffType = NSPasteboardTypeTIFF;
+        if (tiffType && (tiffData = [[self currentSelectionPage] PDFListViewTIFFDataFor:selRect]))
+            [writeTypes addObject:tiffType];
+        if ([writeTypes count] > 0) {
+            [pboard declareTypes:writeTypes owner:nil];
+            if (pdfData)
+                [pboard setData:pdfData forType:pdfType];
+            if (tiffData)
+                [pboard setData:tiffData forType:tiffType];
+            return YES;
+        }
+    }
+    if ([[self currentSelection] hasCharacters]) {
+        if ([types containsObject:NSPasteboardTypeRTF] || [types containsObject:NSPasteboardTypeRTF]) {
+            [pboard clearContents];
+            [pboard writeObjects:[NSArray arrayWithObjects:[[self currentSelection] attributedString], nil]];
+            return YES;
+        } else if ([types containsObject:NSPasteboardTypeString] || [types containsObject:NSPasteboardTypeString]) {
+            [pboard clearContents];
+            [pboard writeObjects:[NSArray arrayWithObjects:[[self currentSelection] string], nil]];
+            return YES;
+        }
+    }
+    
+    
+    return [[CPDFListView superclass] instancesRespondToSelector:_cmd];
+}
+
+- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType {
+    if ([self toolMode] == CSelectToolMode && NSIsEmptyRect(_selectionRect) == NO && _selectionPageIndex != NSNotFound && returnType == nil &&
+        (([[self document] allowsPrinting] && [[self document] isLocked] == NO && [sendType isEqualToString:NSPasteboardTypePDF]) || [sendType isEqualToString:NSPasteboardTypeTIFF])) {
+        return self;
+    }
+    if ([[self currentSelection] hasCharacters] && returnType == nil && ([sendType isEqualToString:NSPasteboardTypeString] || [sendType isEqualToString:NSPasteboardTypeRTF])) {
+        return self;
+    }
+    return [super validRequestorForSendType:sendType returnType:returnType];
+}
 @end

+ 6 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationSelectLinkViewController.swift

@@ -130,12 +130,12 @@ enum KMAnnotationLinkType: UInt {
             box.downCallback = { [weak self] downEntered, mouseBox, event in
                 guard let self = self else { return }
                 if downEntered {
-//                    if !IAPProductsManager.defaultManager.isAvailableAllFunction() {
-//                        if mouseBox == self.linkUrlBox || mouseBox == self.linkEmailBox {
-//                            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-//                            return
-//                        }
-//                    }
+                    if !IAPProductsManager.default().isAvailableAllFunction() {
+                        if mouseBox == self.linkUrlBox || mouseBox == self.linkEmailBox {
+                            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                            return
+                        }
+                    }
                     
                     if self.mouseDownBox == mouseBox {
                         return

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayCustomThemesCollectionViewItem.swift

@@ -86,10 +86,10 @@ class KMPageDisplayCustomThemesCollectionViewItem: NSCollectionViewItem {
         itemCount = item
         themesBox.mouseDownCallback = { [weak self] downEntered in
             if downEntered {
-//                if !IAPProductsManager.defaultManager.isAvailableAllFunction {
-//                    KMPurchaseCompareWindowController.sharedInstance.showWindow(nil)
-//                    return
-//                }
+                if !IAPProductsManager.default().isAvailableAllFunction() {
+                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    return
+                }
                 
                 self!.themesBox.fillColor = KMAppearance.Layout.l_1Color()
                 self!.itemImageView.image = NSImage(named: KMImageNameUXIconBtnAddHov)

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift

@@ -964,10 +964,10 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
     }
     
     @IBAction func addButtonAction(_ sender: NSButton) {
-//        if !IAPProductsManager.defaultManager().isAvailableAllFunction() {
-//            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-//            return
-//        }
+        if !IAPProductsManager.default().isAvailableAllFunction() {
+            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+            return
+        }
         
         addButtonLayer.frame = CGRect(x: 0, y: 0, width: addButton.bounds.width, height: addButton.bounds.height)
         addButtonLayer.isHidden = false

+ 5 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -191,6 +191,11 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
     @IBAction func leftControllButtonAction(item: KMToolbarClickButton) {
         let tag = KMToolbarViewType(rawValue: item.tag) ?? .None
         if tag == .editPDF {
+            if IAPProductsManager.default().isAvailableAllFunction() == false {
+                KMPreference.shared.openDocumentType = .newWindow
+                KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                return
+            }
             Task { @MainActor in
                 self.delegate?.toolbarViewController?(self, clickMode: tag, toolbar: item.clickObject as! KMToolbarItemView, [])
             }

+ 6 - 6
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -45,10 +45,6 @@
                 </textField>
                 <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="sfH-r9-sge">
                     <rect key="frame" x="35" y="-2" width="20" height="20"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="20" id="Yeh-3r-jhb"/>
-                        <constraint firstAttribute="width" constant="15" id="eUO-B8-dXv"/>
-                    </constraints>
                     <popUpButtonCell key="cell" type="bevel" title="Item" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" tag="10000" imageScaling="proportionallyDown" inset="2" pullsDown="YES" arrowPosition="noArrow" autoenablesItems="NO" altersStateOfSelectedItem="NO" id="0io-Bv-6t5" userLabel="Fit ">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="menu"/>
@@ -103,6 +99,10 @@
                             </items>
                         </menu>
                     </popUpButtonCell>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="20" id="Yeh-3r-jhb"/>
+                        <constraint firstAttribute="width" constant="15" id="eUO-B8-dXv"/>
+                    </constraints>
                     <connections>
                         <action selector="zoomModelSelectButtonAction:" target="-2" id="ch8-xQ-hzo"/>
                     </connections>

+ 21 - 10
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -4161,11 +4161,11 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                     return
                 }
             } else if (type == .secure) { /// 安全
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
-            return
-        }
-                
+//                if !IAPProductsManager.default().isAvailableAllFunction(){
+//                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+//                    return
+//                }
+//                
                 if (index == 1) { /// 设置密码
                     if (!self.listView.document!.allowsCopying || !self.listView.document!.allowsPrinting) {
                         KMPasswordInputWindow.openWindow(window: self.view.window!, type: .owner, url: self.listView.document.documentURL) { [weak self]  result, password in
@@ -4214,11 +4214,22 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                             
                             self.toolbarController.cancelSelected(KMToolbarToolCompressItemIdentifier)
                             
-                            let batchWindowController = KMBatchOperateWindowController.sharedWindowController
-                                    batchWindowController.window?.makeKeyAndOrderFront("")
-                            let batchOperateFile = KMBatchOperateFile(filePath: files.first?.filePath ?? "")
-                            batchWindowController.switchToOperateType(.RemovePassword, files: [batchOperateFile])
-                            batchWindowController.window?.makeKeyAndOrderFront("")
+//                            let batchWindowController = KMBatchOperateWindowController.sharedWindowController
+//                                    batchWindowController.window?.makeKeyAndOrderFront("")
+//                            let batchOperateFile = KMBatchOperateFile(filePath: files.first?.filePath ?? "")
+//                            batchWindowController.switchToOperateType(.RemovePassword, files: [batchOperateFile])
+//                            batchWindowController.window?.makeKeyAndOrderFront("")
+                            
+                            let baseWindowController = KMBatchOperateBaseWindowController(windowNibName: "KMBatchOperateBaseWindowController")
+                            if #available(macOS 10.13, *) {
+                                baseWindowController.window?.makeKeyAndOrderFront(nil)
+                            } else {
+                                baseWindowController.showWindow(nil)
+                            }
+                            let arr = NSMutableArray()
+                            let file = KMBatchOperateFile(filePath: self.listView!.document!.documentURL!.path, type: .RemovePassword)
+                            arr.add(file)
+                            baseWindowController.checkNeedPasswordSwitchToOperateType(operateType: .RemovePassword, files: arr as! [KMBatchOperateFile])
                         }
                         
                         controller.cancelAction = { [unowned self] controller in

+ 115 - 0
PDF Office/PDF Master/Info.plist

@@ -336,5 +336,120 @@
 		<string>Ubuntu-Bold.ttf</string>
 		<string>Ubuntu-Medium.ttf</string>
 	</array>
+	<key>NSServices</key>
+	<array>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open File in PDF Reader Pro Edition</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>FilePath</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.file-url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open URL in PDF Reader Pro Edition</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>URL</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open Selected PDF</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromDataOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSSendTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>public.tiff</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Show PDF Reader Pro Edition Notes</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openNotesDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>FilePath</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.file-url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+	</array>
 </dict>
 </plist>

+ 8 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -1555,6 +1555,9 @@
 		AD3AAD932B1034C000DE5FE7 /* KMHeaderFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */; };
 		AD3AAD942B1034C000DE5FE7 /* KMHeaderFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */; };
 		AD3AAD952B1034C000DE5FE7 /* KMHeaderFooterView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */; };
+		AD4C71712B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
+		AD4C71722B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
+		AD4C71732B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */; };
 		AD53B6FE29AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */; };
 		AD53B6FF29AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */; };
 		AD53B70029AC5FCD00D61E81 /* KMLightMemberToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */; };
@@ -5789,6 +5792,7 @@
 		AD3AAD872B10349600DE5FE7 /* KMHeaderFooterWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHeaderFooterWindowController.xib; sourceTree = "<group>"; };
 		AD3AAD8E2B1034B400DE5FE7 /* KMHeaderFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMHeaderFooterView.swift; sourceTree = "<group>"; };
 		AD3AAD922B1034C000DE5FE7 /* KMHeaderFooterView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHeaderFooterView.xib; sourceTree = "<group>"; };
+		AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSError_Extensions.swift; sourceTree = "<group>"; };
 		AD53B6FD29AC5FCD00D61E81 /* KMLightMemberToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLightMemberToken.swift; sourceTree = "<group>"; };
 		AD58F4042B14954B00299EE0 /* KMCompareTextHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMCompareTextHeaderView.xib; sourceTree = "<group>"; };
 		AD58F40D2B1DAAA700299EE0 /* KMPrintDefaultView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPrintDefaultView.swift; sourceTree = "<group>"; };
@@ -10660,6 +10664,7 @@
 				BB03D6972B0221FF008C9976 /* NSImage+KMExtension.swift */,
 				9FE0BBEA2B0F242C00CD1CAC /* NSUserDefaults_KMExtension.swift */,
 				9FB2210D2B1AE35E00A5B208 /* NSBitmapImageRep_KMExtension.swift */,
+				AD4C71702B9ADFE0003A6286 /* NSError_Extensions.swift */,
 			);
 			path = Category;
 			sourceTree = "<group>";
@@ -16125,6 +16130,7 @@
 				BB5726F02B20707D0089D283 /* CPDFMarkupAnnotation+PDFListView.swift in Sources */,
 				ADE8BC3E29F9458700570F89 /* KMRecommondInfo.m in Sources */,
 				AD9527C6295295110039D2BC /* KMPrintPrinterModel.swift in Sources */,
+				AD4C71712B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */,
 				BB146FE4299DC0D100784A6A /* GTLRURITemplate.m in Sources */,
 				9F1FE50D29407B2B00E952CA /* KMUploadFilePanel.swift in Sources */,
 				9F0201862A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
@@ -16592,6 +16598,7 @@
 				ADD1B6AC2941E97F00C3FFF7 /* KMPrintWindowController.swift in Sources */,
 				9FDD0FAF29534FDC000C4DAD /* KMCompLight.swift in Sources */,
 				BB8810922B4F7C4100AFA63E /* KMVerificationExpiredViewController.m in Sources */,
+				AD4C71722B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */,
 				AD1CA4122A061CCD0070541F /* KMAnnotationScreenColorViewItem.swift in Sources */,
 				BB2A98532B270B3300647AF3 /* KMBatchAddBackgroundOperation.swift in Sources */,
 				AD867FC229DFC39400F00440 /* KMBOTAAnnotationItem.swift in Sources */,
@@ -18289,6 +18296,7 @@
 				AD68782329A5FADC005B5210 /* KMLightMemberCache.swift in Sources */,
 				AD7D5C832B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */,
 				BB8F4584295B0F900037EA22 /* KMHeaderFooterMarginInfoView.swift in Sources */,
+				AD4C71732B9ADFE0003A6286 /* NSError_Extensions.swift in Sources */,
 				BB49ED17293F489500C82CA2 /* KMConvertImageSettingView.swift in Sources */,
 				899700EA28F3E4D3009AF911 /* MainWindowController.swift in Sources */,
 				BBD1F79A296FF78C00343885 /* KMPageEditSettingBaseModel.swift in Sources */,

+ 115 - 0
PDF Office/PDF-Reader-Pro-DMG-Info.plist

@@ -332,5 +332,120 @@
 		<string>Ubuntu-Bold.ttf</string>
 		<string>Ubuntu-Medium.ttf</string>
 	</array>
+	<key>NSServices</key>
+	<array>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open File in PDF Reader Pro Edition</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>FilePath</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.file-url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open URL in PDF Reader Pro Edition</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>URL</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open Selected PDF</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromDataOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSSendTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>public.tiff</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Show PDF Reader Pro Edition Notes</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openNotesDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>FilePath</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.file-url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+	</array>
 </dict>
 </plist>

+ 115 - 0
PDF Office/PDF-Reader-Pro-Edition-Info.plist

@@ -322,5 +322,120 @@
 		<string>Ubuntu-Medium.ttf</string>
 		<string>Ubuntu-Bold.ttf</string>
 	</array>
+	<key>NSServices</key>
+	<array>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open File in PDF Reader Pro Edition</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>FilePath</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.file-url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open URL in PDF Reader Pro Edition</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>URL</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Open Selected PDF</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openDocumentFromDataOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSSendTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>public.tiff</string>
+			</array>
+		</dict>
+		<dict>
+			<key>NSMenuItem</key>
+			<dict>
+				<key>default</key>
+				<string>Show PDF Reader Pro Edition Notes</string>
+			</dict>
+			<key>NSMessage</key>
+			<string>openNotesDocumentFromURLOnPboard</string>
+			<key>NSPortName</key>
+			<string>PDF Reader Pro Edition</string>
+			<key>NSRequiredContext</key>
+			<dict>
+				<key>NSTextContent</key>
+				<string>FilePath</string>
+			</dict>
+			<key>NSSendFileTypes</key>
+			<array>
+				<string>com.adobe.pdf</string>
+				<string>com.adobe.postscript</string>
+				<string>com.adobe.encapsulated-postscript</string>
+				<string>org.tug.tex.dvi</string>
+				<string>org.tug.tex.xdv</string>
+				<string>net.sourceforge.skim-app.pdfd</string>
+				<string>net.sourceforge.skim-app.skimnotes</string>
+			</array>
+			<key>NSSendTypes</key>
+			<array>
+				<string>public.url</string>
+				<string>public.file-url</string>
+				<string>public.plain-text</string>
+			</array>
+		</dict>
+	</array>
 </dict>
 </plist>