فهرست منبع

【页面编辑】拆分测试

tangchao 1 سال پیش
والد
کامیت
44f20750d6

+ 1 - 18
PDF Office/PDF Master/Class/PDFTools/PageEdit/Base/KMPageEditSettingBaseModel.swift

@@ -35,22 +35,5 @@ class KMPageEditSettingBaseModel: NSObject {
         }
     }
     
-    var pageCount: Int {
-        get {
-            if (documentURL == nil) {
-                return NSNotFound
-            }
-            documentURL.pathExtension
-            let document = CPDFDocument(url: documentURL)
-            if (document!.isLocked) {
-                if ((document?.unlock(withPassword: password))!) { /// 解锁成功
-                    return Int(document!.pageCount)
-                }
-                
-                return NSNotFound
-            }
-            
-            return Int(document!.pageCount)
-        }
-    }
+    var pageCount: Int = 0
 }

+ 4 - 0
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -551,6 +551,10 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     @objc func splitMenuAction(sender: AnyObject?) {
         let model = KMPageEditSplitSettingModel()
         model.documentURL = self.listView?.document.documentURL
+        if let pagecnt = self.thumbnailView.document?.pageCount {
+            model.pageCount = Int(pagecnt)
+        }
+        
         model.fileName = model.documentURL.lastPathComponent
         model.pathExtension = model.fileName.components(separatedBy: ".").last