|
@@ -335,8 +335,9 @@ let KMSignatureMaxHeight = 300.0
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- if let image = NSImage(contentsOfFile: url.path), self?.isDamageImage(image, imagePath: url.path) == true {
|
|
|
|
|
|
+
|
|
|
|
+ let image = NSImage(contentsOfFile: url.path)
|
|
|
|
+ if image == nil || self?.isDamageImage(image!, imagePath: url.path) == true {
|
|
let alert = NSAlert()
|
|
let alert = NSAlert()
|
|
alert.alertStyle = .critical
|
|
alert.alertStyle = .critical
|
|
alert.messageText = String(format: NSLocalizedString("The file \"%@\" could not be opened.", comment: ""), url.path.lastPathComponent)
|
|
alert.messageText = String(format: NSLocalizedString("The file \"%@\" could not be opened.", comment: ""), url.path.lastPathComponent)
|
|
@@ -407,6 +408,17 @@ let KMSignatureMaxHeight = 300.0
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
if supportedImageTypes().contains(_url.pathExtension.lowercased()) {
|
|
if supportedImageTypes().contains(_url.pathExtension.lowercased()) {
|
|
|
|
+ let image = NSImage(contentsOfFile: _url.path)
|
|
|
|
+ if image == nil || self.isDamageImage(image!, imagePath: _url.path) == true {
|
|
|
|
+ let alert = NSAlert()
|
|
|
|
+ alert.alertStyle = .critical
|
|
|
|
+ alert.messageText = String(format: NSLocalizedString("The file \"%@\" could not be opened.", comment: ""), _url.path.lastPathComponent)
|
|
|
|
+ alert.informativeText = NSLocalizedString("It may be damaged or use a file format that PDF Reader Pro doesn’t recognize.", comment: "")
|
|
|
|
+ alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
|
|
|
+ alert.runModal()
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
loadImageViewPath(_url, isRemoveBGColor: clearBackground)
|
|
loadImageViewPath(_url, isRemoveBGColor: clearBackground)
|
|
changeSignatureImageCallback?(true)
|
|
changeSignatureImageCallback?(true)
|
|
return true
|
|
return true
|