Просмотр исходного кода

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

tangchao 1 год назад
Родитель
Сommit
0eef5eb807

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/Convert/ExtractImage/Model/PDFConvertObject.swift

@@ -39,11 +39,11 @@ class PDFConvertObject: NSObject{
     }
     func extractResourcesFromPDF(at pdfPathA: String, pdfPassword pdfPasswordA: String?, selectIndexSet indexSet: IndexSet, destDocPath destDocPathA: String, moreOptions moreOptionsA: [AnyHashable: Any]?) {
         self.document = CPDFDocument(url: URL(fileURLWithPath: pdfPathA))
-        if let pdfPassword = pdfPasswordA {
-            self.document?.unlock(withPassword: pdfPassword)
+        if pdfPasswordA?.count ?? 0 > 0 {
+            self.document?.unlock(withPassword: pdfPasswordA)
         }
         self.document?.extractImage(fromPages: indexSet, toPath: destDocPathA) { (pageIndex, imageIndex, index) -> String? in
-            let fileName = self.document?.documentURL.lastPathComponent.deletingPathExtension
+            let fileName = self.document?.documentURL.deletingPathExtension().lastPathComponent
             let imageName = String(format: "%@_Page%ld_%@", fileName ?? "",pageIndex+1,self.imageNumberSuffix(imageIndex+1))
             return imageName
         }