Explorar el Código

[转档] - 没有License,使用fp

liujiajie hace 1 año
padre
commit
1de1829b05

+ 21 - 21
PDF Office/PDF Master/Class/Batch/Operation/KMBatchConvertOperation.swift

@@ -118,7 +118,7 @@ class KMBatchConvertOperation: KMBatchOperation, CPDFConverterDelegate, CPDFConv
                 self.converter!.convert(toFilePath: operateFile?.outputFilePath, pageIndexs: operateFile?.currentConvertParameter?.pagesArray, options: options)
                 return
             }
-            if self.operateFile?.convertType == .CSV {
+            if self.operateFile?.convertType == .CSV  && self.operateFile?.CSVParameter.isExtreactTabel ?? false {
                 self.converter = CPDFConverterCsv.init(url: URL(fileURLWithPath: operateFile?.filePath ?? ""), password: operateFile?.password)
                 self.converter!.delegate = self
                 let options = CPDFConvertCsvOptions()
@@ -127,26 +127,26 @@ class KMBatchConvertOperation: KMBatchOperation, CPDFConverterDelegate, CPDFConv
                 return
             }
             
-            if self.operateFile?.convertType == .RTF {
-                self.converter = CPDFConverterRtf.init(url: URL(fileURLWithPath: operateFile?.filePath ?? ""), password: operateFile?.password)
-                self.converter!.delegate = self
-                let options = CPDFConvertRtfOptions()
-                options.isContainAnnotations = true
-                options.isAllowOCR = true
-                options.isContainImages = true
-                self.converter!.convert(toFilePath: operateFile?.outputFilePath, pageIndexs: operateFile?.currentConvertParameter?.pagesArray, options: options)
-                return
-            }
-            if self.operateFile?.convertType == .HTML {
-                self.converter = CPDFConverterHtml.init(url: URL(fileURLWithPath: operateFile?.filePath ?? ""), password: operateFile?.password)
-                self.converter!.delegate = self
-                let options = CPDFConvertHtmlOptions()
-                options.isContainAnnotations = true
-                options.isAllowOCR = true
-                options.isContainImages = true
-                self.converter!.convert(toFilePath: operateFile?.outputFilePath, pageIndexs: operateFile?.currentConvertParameter?.pagesArray, options: options)
-                return
-            }
+//            if self.operateFile?.convertType == .RTF {
+//                self.converter = CPDFConverterRtf.init(url: URL(fileURLWithPath: operateFile?.filePath ?? ""), password: operateFile?.password)
+//                self.converter!.delegate = self
+//                let options = CPDFConvertRtfOptions()
+//                options.isContainAnnotations = true
+//                options.isAllowOCR = true
+//                options.isContainImages = true
+//                self.converter!.convert(toFilePath: operateFile?.outputFilePath, pageIndexs: operateFile?.currentConvertParameter?.pagesArray, options: options)
+//                return
+//            }
+//            if self.operateFile?.convertType == .HTML {
+//                self.converter = CPDFConverterHtml.init(url: URL(fileURLWithPath: operateFile?.filePath ?? ""), password: operateFile?.password)
+//                self.converter!.delegate = self
+//                let options = CPDFConvertHtmlOptions()
+//                options.isContainAnnotations = true
+//                options.isAllowOCR = true
+//                options.isContainImages = true
+//                self.converter!.convert(toFilePath: operateFile?.outputFilePath, pageIndexs: operateFile?.currentConvertParameter?.pagesArray, options: options)
+//                return
+//            }
             if self.operateFile?.convertType == .Text {
                 self.converter = CPDFConverterTxt.init(url: URL(fileURLWithPath: operateFile?.filePath ?? ""), password: operateFile?.password)
                 self.converter!.delegate = self

+ 42 - 42
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/Common/KMPDFConvert.swift

@@ -274,7 +274,7 @@ class KMPDFConvert: Operation {
             return
         }
         
-        if self.convertType == .csv{
+        if self.convertType == .csv && isExtractTable{
             self.converter = CPDFConverterCsv.init(url: URL(fileURLWithPath: filePath), password: self.password)
             self.converter.delegate = self
             let options = CPDFConvertCsvOptions()
@@ -283,47 +283,47 @@ class KMPDFConvert: Operation {
             return
         }
         
-        if self.convertType == .rtf{
-            self.converter = CPDFConverterRtf.init(url: URL(fileURLWithPath: filePath), password: self.password)
-            self.converter.delegate = self
-            let options = CPDFConvertRtfOptions()
-            options.isContainAnnotations = true
-            options.isAllowOCR = true
-//            if (self.isAllowOCR) {
-//                options.isContainOCRBgImage = self.isContainOCRBgImage
-//                if let language = self.ocrLanguage {
-//                    options.language = language
-//                } else {
-//                    options.language = .english
-//                }
-//            } else {
-                options.isContainImages = true
-//                options.isContainOCRBgImage = false
-//            }
-            self.converter.convert(toFilePath: self.outputFilePath, pageIndexs: self.pages, options: options)
-            return
-        }
-        
-        if self.convertType == .html{
-            self.converter = CPDFConverterHtml.init(url: URL(fileURLWithPath: filePath), password: self.password)
-            self.converter.delegate = self
-            let options = CPDFConvertHtmlOptions()
-            options.isContainAnnotations = true
-            options.isAllowOCR = true
-//            if (self.isAllowOCR) {
-//                options.isContainOCRBgImage = self.isContainOCRBgImage
-//                if let language = self.ocrLanguage {
-//                    options.language = language
-//                } else {
-//                    options.language = .english
-//                }
-//            } else {
-                options.isContainImages = true
-//                options.isContainOCRBgImage = false
-//            }
-            self.converter.convert(toFilePath: self.outputFilePath, pageIndexs: self.pages, options: options)
-            return
-        }
+//        if self.convertType == .rtf{
+//            self.converter = CPDFConverterRtf(url: URL(fileURLWithPath: self.filePath), password: self.password)
+//            self.converter.delegate = self
+//            let options = CPDFConvertRtfOptions()
+//            options.isContainAnnotations = true
+//            options.isAllowOCR = true
+////            if (self.isAllowOCR) {
+////                options.isContainOCRBgImage = self.isContainOCRBgImage
+////                if let language = self.ocrLanguage {
+////                    options.language = language
+////                } else {
+////                    options.language = .english
+////                }
+////            } else {
+//                options.isContainImages = true
+////                options.isContainOCRBgImage = false
+////            }
+//            self.converter.convert(toFilePath: self.outputFilePath, pageIndexs: self.pages, options: options)
+//            return
+//        }
+        
+//        if self.convertType == .html{
+//            self.converter = CPDFConverterHtml.init(url: URL(fileURLWithPath: filePath), password: self.password)
+//            self.converter.delegate = self
+//            let options = CPDFConvertHtmlOptions()
+//            options.isContainAnnotations = true
+//            options.isAllowOCR = true
+////            if (self.isAllowOCR) {
+////                options.isContainOCRBgImage = self.isContainOCRBgImage
+////                if let language = self.ocrLanguage {
+////                    options.language = language
+////                } else {
+////                    options.language = .english
+////                }
+////            } else {
+//                options.isContainImages = true
+////                options.isContainOCRBgImage = false
+////            }
+//            self.converter.convert(toFilePath: self.outputFilePath, pageIndexs: self.pages, options: options)
+//            return
+//        }
         if self.convertType == .text{
             self.converter = CPDFConverterTxt.init(url: URL(fileURLWithPath: filePath), password: self.password)
             self.converter.delegate = self