Browse Source

综合-转档新增密码阻挡

tangchao 1 year ago
parent
commit
f5ab120231

BIN
PDF Office/PDF Office.xcodeproj/project.xcworkspace/xcuserdata/kdanmobile.xcuserdatad/UserInterfaceState.xcuserstate


+ 16 - 0
PDF Office/PDF Office.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -100,5 +100,21 @@
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4B60ADA3-44C9-4643-899D-AF8321E43F9B"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Office/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "348"
+            endingLineNumber = "348"
+            landmarkName = "menuItemAction_nextPage(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 11 - 6
PDF Office/PDF Office/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.swift

@@ -368,12 +368,13 @@ class KMConvertBaseWindowController: NSWindowController {
                 return
             }
             let outputFolderPath = url!.deletingLastPathComponent().path
-            /// MARK: 后续新增证书打包后,需要再优化
-//                let filePath = self.getConvertFileSavePath()
-            let filePath = self.prePDFView.document.documentURL.path
-//                if ((self.prePDFView.document?.write(toFile: filePath))!) {
+            let filePath = self.getConvertFileSavePath()
+            if (FileManager.default.fileExists(atPath: filePath)) {
+                try?FileManager.default.removeItem(atPath: filePath)
+            }
+            if ((self.prePDFView.document?.writeDecrypt(to: URL(fileURLWithPath: filePath)))!) {
                 
-//                }
+            }
             let convert = KMPDFConvert()
             self.convert = convert
             convert.outputFolderPath = outputFolderPath
@@ -391,7 +392,6 @@ class KMConvertBaseWindowController: NSWindowController {
                 self.progressController?.maxValue = Double(convert.pages.count)
             }
             
-            
             DispatchQueue.global().async {
                 KMPDFConvertManager.defaultManager.convert(convert: convert, progress: { index in
                     DispatchQueue.main.async {
@@ -399,6 +399,11 @@ class KMConvertBaseWindowController: NSWindowController {
                     }
                 }) { [unowned self] finished, error in
                     self.hiddenProgressWindow()
+                    
+                    // 清除临时文件
+                    if (FileManager.default.fileExists(atPath: filePath)) {
+                        try?FileManager.default.removeItem(atPath: filePath)
+                    }
                     if finished {
                         cancelButtonAction()
                         if FileManager.default.fileExists(atPath: convert.outputFilePath) {