|
@@ -716,13 +716,22 @@ extension KMBatchManager {
|
|
|
processFile(at: 0, outputFolderPath: outputFolderPath, data: data)
|
|
|
}
|
|
|
} else {
|
|
|
- var fileName = data.selectFilePath.deletingPathExtension.lastPathComponent
|
|
|
- let path = self.fetchFilePath(type: .imageToPDF, filePath: data.selectFilePath, outputFolderPath: outputFolderPath)
|
|
|
+ let selectFilePath = data.selectFilePath
|
|
|
+ if selectFilePath.count == 0 {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.alertStyle = .critical
|
|
|
+ alert.messageText = KMLocalizedString("文件未选择")
|
|
|
+ alert.runModal()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var fileName = selectFilePath.deletingPathExtension.lastPathComponent
|
|
|
+ let path = self.fetchFilePath(type: .imageToPDF, filePath: selectFilePath, outputFolderPath: outputFolderPath)
|
|
|
|
|
|
- var pdfDocument = CPDFDocument(url: NSURL(fileURLWithPath: data.selectFilePath) as URL)
|
|
|
+ var pdfDocument = CPDFDocument(url: NSURL(fileURLWithPath: selectFilePath) as URL)
|
|
|
let count: Int = Int(pdfDocument?.pageCount ?? 0)
|
|
|
for item in filesData {
|
|
|
- pdfDocument?.km_insert(image: item.image, at: pdfDocument?.pageCount ?? 0)
|
|
|
+ pdfDocument?.km_insert(image: item.image, at: UInt(count))
|
|
|
}
|
|
|
|
|
|
if data.isOCR {
|