|
@@ -154,11 +154,11 @@ class KMImageToPDFMethod: NSObject, KMGOCRManagerDelegate {
|
|
|
return
|
|
|
}
|
|
|
let filePath: String = photoArray?[convertIndex] as! String
|
|
|
- var savePath = path
|
|
|
+ let savePath = path
|
|
|
var isDir: ObjCBool = false
|
|
|
if FileManager.default.fileExists(atPath: filePath , isDirectory: &isDir) && !isDir.boolValue {
|
|
|
let model = KMImageModel(filepath: filePath )
|
|
|
- let tString = model.photoName.deletingPathExtension
|
|
|
+ let tString = model.photoName.deletingPathExtension.lastPathComponent//model.photoName.deletingPathExtension
|
|
|
|
|
|
var newpath = path.stringByAppendingPathComponent(tString).stringByAppendingPathExtension("pdf")
|
|
|
newpath = getUniqueFilePath(newpath)
|
|
@@ -169,10 +169,10 @@ class KMImageToPDFMethod: NSObject, KMGOCRManagerDelegate {
|
|
|
_ = pdf?.km_insertPage(imag.size, withImage: filePath , at: pdf?.pageCount ?? 0)
|
|
|
}
|
|
|
|
|
|
- DispatchQueue.global().async {
|
|
|
+// DispatchQueue.global().async {
|
|
|
var isSucceed = false
|
|
|
|
|
|
- isSucceed = ((pdf?.write(toFile: path)) != nil)
|
|
|
+ isSucceed = ((pdf?.write(toFile: newpath)) != nil)
|
|
|
var pre: Float = 0
|
|
|
if self.photoArray?.count ?? 0 > 0{
|
|
|
pre = Float(self.convertIndex + 1) / Float(self.photoArray?.count ?? 1)
|
|
@@ -196,7 +196,7 @@ class KMImageToPDFMethod: NSObject, KMGOCRManagerDelegate {
|
|
|
complete(path, self.errorArray as! Array<Any>, self.errorOCRArray as! Array<Any>)
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
|
|
|
} else {
|
|
|
if convertIndex < (photoArray?.count ?? 0) - 1 {
|