|
@@ -1423,6 +1423,205 @@ struct KMNMWCFlags {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // MARK: - Secure 【安全】
|
|
|
+ public func hiddenSecureLimitTip() {
|
|
|
+ self.secureAlertView?.removeFromSuperview()
|
|
|
+ self.secureAlertView = nil
|
|
|
+ }
|
|
|
+
|
|
|
+ func savePageNumberIfNeed() {
|
|
|
+ if (KMPreferenceManager.shared.openLastUnlockedDocumentWhenAppStart) {
|
|
|
+ let scaleFactor = self.listView.scaleFactor ?? 0
|
|
|
+ if scaleFactor <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if self.listView.document != nil {
|
|
|
+ KMPreferenceManager.shared.setPageNumber(self.listView.currentPageIndex, forKey: self.listView.document.documentURL.path)
|
|
|
+ KMPreferenceManager.shared.setPageScale(Float(self.listView.scaleFactor), forKey: self.listView.document.documentURL.path)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // MARK: -显示加密弹窗
|
|
|
+ public func showSecureWindow() {
|
|
|
+ guard let url = self.listView.document?.documentURL else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ self.securityWindowController = KMSecurityWindowController(windowNibName: "KMSecurityWindowController")
|
|
|
+ guard let securityWindowController = securityWindowController else { return }
|
|
|
+
|
|
|
+ securityWindowController.documentURL = self.listView.document?.documentURL
|
|
|
+ securityWindowController.batchAction = { [unowned self] controller, files in
|
|
|
+ self.view.window?.endSheet((securityWindowController.window)!)
|
|
|
+
|
|
|
+
|
|
|
+ let batchWindowController = KMBatchOperateWindowController.sharedWindowController
|
|
|
+ let batchOperateFile = KMBatchOperateFile(filePath: self.document?.documentURL.path ?? "", type: .AddPassword)
|
|
|
+ batchWindowController.switchToOperateType(.AddPassword, files: [batchOperateFile])
|
|
|
+ batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
+ }
|
|
|
+
|
|
|
+ securityWindowController.doneAction = { [unowned self] controller, options, attribute in
|
|
|
+ let openPanel = NSOpenPanel()
|
|
|
+ openPanel.canChooseFiles = false
|
|
|
+ openPanel.canChooseDirectories = true
|
|
|
+ openPanel.canCreateDirectories = true
|
|
|
+ openPanel.beginSheetModal(for: NSWindow.currentWindow()) { (result) in
|
|
|
+ if result == NSApplication.ModalResponse.OK {
|
|
|
+ for fileURL in openPanel.urls {
|
|
|
+ let document = CPDFDocument(url: self.document?.documentURL)
|
|
|
+ if document != nil {
|
|
|
+ document!.setDocumentAttributes(attribute)
|
|
|
+
|
|
|
+ let path = fileURL.path.stringByAppendingPathComponent(url.deletingPathExtension().lastPathComponent) + "_SetPassword" + "." + url.pathExtension
|
|
|
+ let success = document!.write(to: NSURL(fileURLWithPath: path) as URL, withOptions: options)
|
|
|
+ if success {
|
|
|
+ self.view.window?.endSheet((securityWindowController.window)!)
|
|
|
+
|
|
|
+ NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ securityWindowController.cancelAction = { [unowned self] controller in
|
|
|
+ self.view.window?.endSheet((securityWindowController.window)!)
|
|
|
+ }
|
|
|
+ NSWindow.currentWindow().beginSheet(securityWindowController.window!)
|
|
|
+ }
|
|
|
+
|
|
|
+ public func showRemoveSecureWindow() {
|
|
|
+ if !self.document!.allowsCopying || !self.document!.allowsPrinting {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .warning
|
|
|
+ alert.messageText = NSLocalizedString("Warning", comment: "")
|
|
|
+ alert.informativeText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Remove Security", comment: ""))
|
|
|
+ alert.beginSheetModal(for: NSWindow.currentWindow()) { returnCode in
|
|
|
+ if returnCode == .alertSecondButtonReturn {
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.25) { [unowned self] in
|
|
|
+ KMBaseWindowController.checkPassword(url: self.document!.documentURL!, type: .owner) { [unowned self] success, resultPassword in
|
|
|
+ if success {
|
|
|
+ self.document?.unlock(withPassword: resultPassword)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let controller = KMRemovePasswordWindowController(windowNibName: "KMRemovePasswordWindowController")
|
|
|
+ controller.pdfDocument = self.document
|
|
|
+ self.currentWindowController = controller
|
|
|
+
|
|
|
+ controller.batchAction = { [unowned self] controller, files in
|
|
|
+ self.view.window?.endSheet((self.currentWindowController.window)!)
|
|
|
+ self.currentWindowController = nil
|
|
|
+
|
|
|
+ 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)
|
|
|
+ file.password = document?.password ?? ""
|
|
|
+ arr.add(file)
|
|
|
+
|
|
|
+ baseWindowController.switchToOperateType(.RemovePassword, files: arr as! [KMBatchOperateFile])
|
|
|
+ }
|
|
|
+
|
|
|
+ controller.cancelAction = { [unowned self] controller in
|
|
|
+ self.view.window?.endSheet((self.currentWindowController.window)!)
|
|
|
+ self.currentWindowController = nil
|
|
|
+ }
|
|
|
+
|
|
|
+ controller.doneAction = { [unowned self] controller in
|
|
|
+ self.view.window?.endSheet((self.currentWindowController.window)!)
|
|
|
+ self.currentWindowController = nil
|
|
|
+
|
|
|
+ KMBaseWindowController.checkPassword(url: self.document!.documentURL!, type: .owner, password: self.document?.password ?? "") { [unowned self] success, resultPassword in
|
|
|
+ if success {
|
|
|
+
|
|
|
+ let savePanel = NSSavePanel()
|
|
|
+ savePanel.nameFieldStringValue = self.listView.document.documentURL.deletingPathExtension().lastPathComponent + "_RemovePassword"
|
|
|
+ savePanel.allowedFileTypes = ["pdf"]
|
|
|
+
|
|
|
+ savePanel.beginSheetModal(for: NSApp.mainWindow!) {[unowned self] result in
|
|
|
+ guard result == .OK else { return }
|
|
|
+
|
|
|
+ /// 删除安全性设置
|
|
|
+ if (!self.listView.document!.allowsCopying || !self.listView.document!.allowsPrinting) {
|
|
|
+ self.model.isSaveKeyChain = false
|
|
|
+ self.listView.document.unlock(withPassword: resultPassword)
|
|
|
+ }
|
|
|
+
|
|
|
+ let document = CPDFDocument.init(url: self.listView.document.documentURL)
|
|
|
+ guard let document = document else { return }
|
|
|
+
|
|
|
+ document.unlock(withPassword: resultPassword)
|
|
|
+ let success = document.writeDecrypt(to: savePanel.url)
|
|
|
+ if success {
|
|
|
+ self.hiddenSecureLimitTip()
|
|
|
+ let tip = KMRemovePasswordResultTipView()
|
|
|
+ tip.result = .success
|
|
|
+ tip.showInView(superView: (self.listView.superview)!)
|
|
|
+
|
|
|
+ NSWorkspace.shared.activateFileViewerSelecting([savePanel.url!])
|
|
|
+ } else {
|
|
|
+ self.hiddenSecureLimitTip()
|
|
|
+ let tip = KMRemovePasswordResultTipView()
|
|
|
+ tip.result = .failure
|
|
|
+ tip.showInView(superView: (self.listView.superview)!)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ NSWindow.currentWindow().beginSheet(controller.window!)
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //MARK: - 测量
|
|
|
+
|
|
|
+
|
|
|
+ @objc func cancelMeasureType() {
|
|
|
+ self.hideMeasureFloatingWindows()
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ func hideMeasureFloatingWindows() {
|
|
|
+ if distanceMeasureInfoWindowController?.window?.isVisible == true {
|
|
|
+ distanceMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
+ } else if perimeterMeasureInfoWindowController?.window?.isVisible == true {
|
|
|
+ perimeterMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
+ } else if areaMeasureInfoWindowController?.window?.isVisible == true {
|
|
|
+ areaMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func showMeasureFloatingWindowsIfNeed() {
|
|
|
+ let toolMode = self.listView.toolMode
|
|
|
+ if toolMode != .CNoteToolMode {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let type = self.listView.annotationType
|
|
|
+ if type == .measureLine {
|
|
|
+ self.distanceMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
+ } else if type == .measurePolyLine {
|
|
|
+ self.perimeterMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
+ } else if type == .measurePolyGon {
|
|
|
+ self.areaMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
+ } else if type == .measureSquare {
|
|
|
+ self.areaMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//MARK: - Watermark水印
|
|
|
func showWatermarkController() {
|
|
|
viewManager.editType = .watermark
|
|
@@ -2476,6 +2675,10 @@ extension KMMainViewController {
|
|
|
return
|
|
|
}
|
|
|
let window = KMOCRSettingWindowController(windowNibName: "KMOCRSettingWindowController")
|
|
|
+ window.OCRAction = {[unowned self] controller, model in
|
|
|
+ self.convertOCRScanFile(window: window, document: self.listView.document, model: model)
|
|
|
+ }
|
|
|
+
|
|
|
self.km_beginSheet(windowC: window)
|
|
|
}
|
|
|
|
|
@@ -2524,169 +2727,19 @@ extension KMMainViewController {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- // MARK: - Secure 【安全】
|
|
|
- public func hiddenSecureLimitTip() {
|
|
|
- self.secureAlertView?.removeFromSuperview()
|
|
|
- self.secureAlertView = nil
|
|
|
- }
|
|
|
-
|
|
|
- func savePageNumberIfNeed() {
|
|
|
- if (KMPreferenceManager.shared.openLastUnlockedDocumentWhenAppStart) {
|
|
|
- let scaleFactor = self.listView.scaleFactor ?? 0
|
|
|
- if scaleFactor <= 0 {
|
|
|
- return
|
|
|
- }
|
|
|
- if self.listView.document != nil {
|
|
|
- KMPreferenceManager.shared.setPageNumber(self.listView.currentPageIndex, forKey: self.listView.document.documentURL.path)
|
|
|
- KMPreferenceManager.shared.setPageScale(Float(self.listView.scaleFactor), forKey: self.listView.document.documentURL.path)
|
|
|
- }
|
|
|
+ //OCR
|
|
|
+ func convertOCRScanFile(window: KMOCRSettingWindowController, document: CPDFDocument, model: KMOCRModel) {
|
|
|
+ window.beginLoading()
|
|
|
+ KMOCRManager.manager.convertScanFile(document: document, model: model) { document, error in
|
|
|
+ window.endLoading()
|
|
|
}
|
|
|
+ // self.listView.document.removePage(at: index)
|
|
|
+ // self.listView.document.insertPageObject(tempPage, at: index)
|
|
|
+ // self.listView.layoutDocumentView()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// MARK: -显示加密弹窗
|
|
|
- public func showSecureWindow() {
|
|
|
- guard let url = self.listView.document?.documentURL else {
|
|
|
- return
|
|
|
- }
|
|
|
- self.securityWindowController = KMSecurityWindowController(windowNibName: "KMSecurityWindowController")
|
|
|
- guard let securityWindowController = securityWindowController else { return }
|
|
|
-
|
|
|
- securityWindowController.documentURL = self.listView.document?.documentURL
|
|
|
- securityWindowController.batchAction = { [unowned self] controller, files in
|
|
|
- self.view.window?.endSheet((securityWindowController.window)!)
|
|
|
-
|
|
|
-
|
|
|
- let batchWindowController = KMBatchOperateWindowController.sharedWindowController
|
|
|
- let batchOperateFile = KMBatchOperateFile(filePath: self.document?.documentURL.path ?? "", type: .AddPassword)
|
|
|
- batchWindowController.switchToOperateType(.AddPassword, files: [batchOperateFile])
|
|
|
- batchWindowController.window?.makeKeyAndOrderFront("")
|
|
|
- }
|
|
|
-
|
|
|
- securityWindowController.doneAction = { [unowned self] controller, options, attribute in
|
|
|
- let openPanel = NSOpenPanel()
|
|
|
- openPanel.canChooseFiles = false
|
|
|
- openPanel.canChooseDirectories = true
|
|
|
- openPanel.canCreateDirectories = true
|
|
|
- openPanel.beginSheetModal(for: NSWindow.currentWindow()) { (result) in
|
|
|
- if result == NSApplication.ModalResponse.OK {
|
|
|
- for fileURL in openPanel.urls {
|
|
|
- let document = CPDFDocument(url: self.document?.documentURL)
|
|
|
- if document != nil {
|
|
|
- document!.setDocumentAttributes(attribute)
|
|
|
-
|
|
|
- let path = fileURL.path.stringByAppendingPathComponent(url.deletingPathExtension().lastPathComponent) + "_SetPassword" + "." + url.pathExtension
|
|
|
- let success = document!.write(to: NSURL(fileURLWithPath: path) as URL, withOptions: options)
|
|
|
- if success {
|
|
|
- self.view.window?.endSheet((securityWindowController.window)!)
|
|
|
-
|
|
|
- NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- securityWindowController.cancelAction = { [unowned self] controller in
|
|
|
- self.view.window?.endSheet((securityWindowController.window)!)
|
|
|
- }
|
|
|
- NSWindow.currentWindow().beginSheet(securityWindowController.window!)
|
|
|
- }
|
|
|
-
|
|
|
- public func showRemoveSecureWindow() {
|
|
|
- if !self.document!.allowsCopying || !self.document!.allowsPrinting {
|
|
|
- let alert = NSAlert()
|
|
|
- alert.alertStyle = .warning
|
|
|
- alert.messageText = NSLocalizedString("Warning", comment: "")
|
|
|
- alert.informativeText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
|
|
|
- alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
|
|
|
- alert.addButton(withTitle: NSLocalizedString("Remove Security", comment: ""))
|
|
|
- alert.beginSheetModal(for: NSWindow.currentWindow()) { returnCode in
|
|
|
- if returnCode == .alertSecondButtonReturn {
|
|
|
- DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.25) { [unowned self] in
|
|
|
- KMBaseWindowController.checkPassword(url: self.document!.documentURL!, type: .owner) { [unowned self] success, resultPassword in
|
|
|
- if success {
|
|
|
- self.document?.unlock(withPassword: resultPassword)
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- let controller = KMRemovePasswordWindowController(windowNibName: "KMRemovePasswordWindowController")
|
|
|
- controller.pdfDocument = self.document
|
|
|
- self.currentWindowController = controller
|
|
|
-
|
|
|
- controller.batchAction = { [unowned self] controller, files in
|
|
|
- self.view.window?.endSheet((self.currentWindowController.window)!)
|
|
|
- self.currentWindowController = nil
|
|
|
-
|
|
|
- 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)
|
|
|
- file.password = document?.password ?? ""
|
|
|
- arr.add(file)
|
|
|
-
|
|
|
- baseWindowController.switchToOperateType(.RemovePassword, files: arr as! [KMBatchOperateFile])
|
|
|
- }
|
|
|
-
|
|
|
- controller.cancelAction = { [unowned self] controller in
|
|
|
- self.view.window?.endSheet((self.currentWindowController.window)!)
|
|
|
- self.currentWindowController = nil
|
|
|
- }
|
|
|
-
|
|
|
- controller.doneAction = { [unowned self] controller in
|
|
|
- self.view.window?.endSheet((self.currentWindowController.window)!)
|
|
|
- self.currentWindowController = nil
|
|
|
-
|
|
|
- KMBaseWindowController.checkPassword(url: self.document!.documentURL!, type: .owner, password: self.document?.password ?? "") { [unowned self] success, resultPassword in
|
|
|
- if success {
|
|
|
-
|
|
|
- let savePanel = NSSavePanel()
|
|
|
- savePanel.nameFieldStringValue = self.listView.document.documentURL.deletingPathExtension().lastPathComponent + "_RemovePassword"
|
|
|
- savePanel.allowedFileTypes = ["pdf"]
|
|
|
-
|
|
|
- savePanel.beginSheetModal(for: NSApp.mainWindow!) {[unowned self] result in
|
|
|
- guard result == .OK else { return }
|
|
|
-
|
|
|
- /// 删除安全性设置
|
|
|
- if (!self.listView.document!.allowsCopying || !self.listView.document!.allowsPrinting) {
|
|
|
- self.model.isSaveKeyChain = false
|
|
|
- self.listView.document.unlock(withPassword: resultPassword)
|
|
|
- }
|
|
|
-
|
|
|
- let document = CPDFDocument.init(url: self.listView.document.documentURL)
|
|
|
- guard let document = document else { return }
|
|
|
-
|
|
|
- document.unlock(withPassword: resultPassword)
|
|
|
- let success = document.writeDecrypt(to: savePanel.url)
|
|
|
- if success {
|
|
|
- self.hiddenSecureLimitTip()
|
|
|
- let tip = KMRemovePasswordResultTipView()
|
|
|
- tip.result = .success
|
|
|
- tip.showInView(superView: (self.listView.superview)!)
|
|
|
-
|
|
|
- NSWorkspace.shared.activateFileViewerSelecting([savePanel.url!])
|
|
|
- } else {
|
|
|
- self.hiddenSecureLimitTip()
|
|
|
- let tip = KMRemovePasswordResultTipView()
|
|
|
- tip.result = .failure
|
|
|
- tip.showInView(superView: (self.listView.superview)!)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- NSWindow.currentWindow().beginSheet(controller.window!)
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
//MARK: - Redact密文
|
|
|
func showRedactProperty() {
|
|
@@ -2729,40 +2782,7 @@ extension KMMainViewController {
|
|
|
cancelMeasureType()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- @objc func cancelMeasureType() {
|
|
|
- self.hideMeasureFloatingWindows()
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- func hideMeasureFloatingWindows() {
|
|
|
- if distanceMeasureInfoWindowController?.window?.isVisible == true {
|
|
|
- distanceMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
- } else if perimeterMeasureInfoWindowController?.window?.isVisible == true {
|
|
|
- perimeterMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
- } else if areaMeasureInfoWindowController?.window?.isVisible == true {
|
|
|
- areaMeasureInfoWindowController?.hideFloatingWindow()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func showMeasureFloatingWindowsIfNeed() {
|
|
|
- let toolMode = self.listView.toolMode
|
|
|
- if toolMode != .CNoteToolMode {
|
|
|
- return
|
|
|
- }
|
|
|
- let type = self.listView.annotationType
|
|
|
- if type == .measureLine {
|
|
|
- self.distanceMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
- } else if type == .measurePolyLine {
|
|
|
- self.perimeterMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
- } else if type == .measurePolyGon {
|
|
|
- self.areaMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
- } else if type == .measureSquare {
|
|
|
- self.areaMeasureInfoWindowController?.window?.orderFront(nil)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//MARK: - 代理方法
|
|
@@ -3135,7 +3155,7 @@ extension KMMainViewController: KMPDFToolbarControllerDelegate {
|
|
|
} else if itemIdentifier == KMPDFToolbar_protect_redact_Property_Identifier {
|
|
|
self.showRedactProperty()
|
|
|
} else if itemIdentifier == KMPDFToolbar_protect_redact_Apply_Identifier {
|
|
|
-
|
|
|
+
|
|
|
} else if itemIdentifier == KMPDFToolbar_protect_redact_Exit_Identifier {
|
|
|
|
|
|
} else if itemIdentifier == KMPDFToolbar_protect_security_Identifier {
|
|
@@ -4814,7 +4834,7 @@ extension KMMainViewController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
func loadOpenFileFunctionGuide(_ showType: KMGuideInfoType) -> Void {
|
|
|
if showType == .openFileNormal && KMGuideInfoWindowController.availableShow(.openFileNormal) {
|
|
|
|
|
@@ -4981,7 +5001,7 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
// MARK: - Private Methods
|
|
|
-
|
|
|
+
|
|
|
func isPDFPageCountExceedsLimit(filePath: String) -> Bool {
|
|
|
let url = URL(fileURLWithPath: filePath)
|
|
|
guard let document = PDFDocument(url: url) else {
|
|
@@ -4993,7 +5013,7 @@ extension KMMainViewController {
|
|
|
}
|
|
|
|
|
|
// MARK: - Redact 【标记密文】
|
|
|
- func exeRedactConfirm(_ type: KMRedactConfirmType, callback: @escaping () -> ()?) {
|
|
|
+ func exeRedactConfirm(_ type: KMRedactConfirmType, callback: @escaping () -> ()?) {
|
|
|
let windowController = KMRedactConfirmWindowController(type)
|
|
|
self.currentWindowController = windowController
|
|
|
self.view.window?.beginSheet(windowController.window!)
|
|
@@ -5275,7 +5295,7 @@ extension KMMainViewController {
|
|
|
}
|
|
|
AutoSaveManager.manager.removeAutoSavePath(self.listView.document?.documentURL.path ?? "")
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// MARK: - 选择缩放模式
|
|
|
|
|
|
@objc public func selectZoom(_ type: KMPDFZoomType) {
|
|
@@ -5548,5 +5568,5 @@ extension KMMainViewController {
|
|
|
self.savePageNumberIfNeed()
|
|
|
self.saveDocument()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|