|
@@ -117,7 +117,7 @@ class ConvertUtil : NSObject,CPDFConverterDelegate{
|
|
|
|
|
|
|
|
|
|
|
|
- func convert(options :CPDFConvertOptions, filePath:String, convertType : String, onProgress : @escaping (_ progress : Int, _ status : Int, _ outputPath : String?) -> Void) {
|
|
|
+ func convert(options :CPDFConvertOptions, filePath:String,fileName : String, convertType : String, onProgress : @escaping (_ progress : Int, _ status : Int, _ outputPath : String?) -> Void) {
|
|
|
|
|
|
result = onProgress
|
|
|
|
|
@@ -131,35 +131,36 @@ class ConvertUtil : NSObject,CPDFConverterDelegate{
|
|
|
switch convertType.uppercased() {
|
|
|
case ConvertType.PPT.rawValue:
|
|
|
|
|
|
- pdfConvert = CPDFConverterPPT(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).pptx")
|
|
|
+ pdfConvert = CPDFConverterPPT(url: fileURL, password: "")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).pptx")
|
|
|
+
|
|
|
case ConvertType.WORD.rawValue:
|
|
|
- pdfConvert = CPDFConverterWord(url: fileURL, password: "")
|
|
|
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).docx")
|
|
|
+ pdfConvert = CPDFConverterWord(url: fileURL, password: "")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).docx")
|
|
|
|
|
|
case ConvertType.EXCEL.rawValue:
|
|
|
pdfConvert = CPDFConverterExcel(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).xlsx")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).xlsx")
|
|
|
case ConvertType.TXT.rawValue:
|
|
|
pdfConvert = CPDFConverterTxt(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).txt")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).txt")
|
|
|
|
|
|
case ConvertType.IMAGE.rawValue:
|
|
|
pdfConvert = CPDFConverterImg(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).zip")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).zip")
|
|
|
|
|
|
case ConvertType.CSV.rawValue:
|
|
|
pdfConvert = CPDFConverterCsv(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).zip")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).zip")
|
|
|
|
|
|
case ConvertType.RTF.rawValue:
|
|
|
pdfConvert = CPDFConverterRtf(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).rtf")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).rtf")
|
|
|
|
|
|
case ConvertType.HTML.rawValue:
|
|
|
pdfConvert = CPDFConverterHtml(url: fileURL, password: "")
|
|
|
- outPutPath = outPutPath.appending("/converted\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSince1970, dateFormat:nil)).zip")
|
|
|
+ outPutPath = outPutPath.appending("/converted_\(fileName)_\(self.timeIntervalChangetoTimeStr(timeInterval: NSDate().timeIntervalSinceNow, dateFormat:nil)).zip")
|
|
|
|
|
|
default:
|
|
|
pdfConvert = CPDFConverter()
|