|
@@ -201,80 +201,80 @@ import Cocoa
|
|
if self.isEqual(self.operateFile?.convertInfo) {
|
|
if self.isEqual(self.operateFile?.convertInfo) {
|
|
// 在子类重写了这个方法,这里永远不会调用,所以不需要写
|
|
// 在子类重写了这个方法,这里永远不会调用,所以不需要写
|
|
} else if self.isEqual(self.operateFile?.addPasswordInfo) {
|
|
} else if self.isEqual(self.operateFile?.addPasswordInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_SetPassword"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_SetPassword"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.removePasswordInfo) {
|
|
} else if self.isEqual(self.operateFile?.removePasswordInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemovePassword"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemovePassword"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.addWatermarkInfo) {
|
|
} else if self.isEqual(self.operateFile?.addWatermarkInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_Watermark"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_Watermark"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.removeWatermarkInfo) {
|
|
} else if self.isEqual(self.operateFile?.removeWatermarkInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveWatermark"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveWatermark"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.addBackgroundInfo) {
|
|
} else if self.isEqual(self.operateFile?.addBackgroundInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_AddBackground"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_AddBackground"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.removeBackgroundInfo) {
|
|
} else if self.isEqual(self.operateFile?.removeBackgroundInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveBackground"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveBackground"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.addHeaderFooterInfo) {
|
|
} else if self.isEqual(self.operateFile?.addHeaderFooterInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_AddHeaderFooter"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_AddHeaderFooter"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.removeHeaderFooterInfo) {
|
|
} else if self.isEqual(self.operateFile?.removeHeaderFooterInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveHeaderFooter"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveHeaderFooter"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.addBatesInfo) {
|
|
} else if self.isEqual(self.operateFile?.addBatesInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_AddBates"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_AddBates"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.removeBatesInfo) {
|
|
} else if self.isEqual(self.operateFile?.removeBatesInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveBates"
|
|
var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_RemoveBates"
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
} else if self.isEqual(self.operateFile?.compressInfo) {
|
|
} else if self.isEqual(self.operateFile?.compressInfo) {
|
|
- if ((self.savePath?.isEmpty) == nil) && ((self.operateFile?.filePath.isEmpty) == nil) {
|
|
|
|
- var newfileName = self.operateFile!.filePath.lastPathComponent.deletingPathExtension + "_Compressed"
|
|
|
|
- newfileName = newfileName.stringByAppendingPathExtension("pdf")
|
|
|
|
- self.outPutPath = self.getUniqueFilePath(filePath: self.savePath!.stringByAppendingPathComponent(newfileName))
|
|
|
|
|
|
+ if self.savePath?.count ?? 0 > 0 && self.operateFile?.filePath.count ?? 0 > 0 {
|
|
|
|
+
|
|
|
|
+ let filePath1 = self.savePath?.stringByAppendingPathComponent(self.operateFile!.filePath.getLastComponentDeleteExtension + "_Compressed")
|
|
|
|
+ self.outPutPath = self.getUniqueFilePath(filePath: filePath1!.stringByAppendingPathExtension("pdf"))
|
|
return self.outPutPath
|
|
return self.outPutPath
|
|
}
|
|
}
|
|
}
|
|
}
|