|
@@ -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
|
|
|
}
|