Browse Source

OCR - 显示离线,线上暂不处理

jiajie 1 year ago
parent
commit
3425e71d5d

+ 1 - 1
PDF Office/PDF Master/Class/Common/OC/OCR/KMGOCRManager.m

@@ -292,7 +292,7 @@ static inline NSFont * FontWithSize(NSString *strChar, CGSize size) {
     self.ocrPath = [[NSMutableArray alloc] init];
     self.finishIndex = 0;
     self.fileType = @"PDF";
-    self.images = images;
+    self.images = [NSMutableArray arrayWithArray:images];
     
     if (!filePath) {
         self.filePath = [NSURL URLWithString:[NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES) objectAtIndex:0]];

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/AddHeaderFooter/VC/KMBatchOperateAddHeaderFooterViewController.xib

@@ -25,7 +25,7 @@
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView misplaced="YES" id="Hz6-mo-xeY">
+        <customView id="Hz6-mo-xeY">
             <rect key="frame" x="0.0" y="0.0" width="370" height="349"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>

+ 7 - 7
PDF Office/PDF Master/Class/PDFTools/OCRNew/Controller/KMOCRPDFWindowController.swift

@@ -572,7 +572,7 @@ class KMOCRPDFWindowController: NSWindowController, NSWindowDelegate, KMGOCRMana
     func batchesOCR() { 
         savedFileName = savedName()
         let intervalOCR: UInt = 10
-        var selctPageImages = [AnyObject]()
+        var selctPageImages: NSMutableArray = NSMutableArray()
         
         for i in 0..<intervalOCR {
             if ocrCurrentIndex + Int(i) >= self.pageIndexs?.count ?? 0 { continue }
@@ -582,7 +582,7 @@ class KMOCRPDFWindowController: NSWindowController, NSWindowDelegate, KMGOCRMana
                 let page = self.pdfDocument?.page(at: UInt(index.intValue))
                 let img: NSImage = thumbnail(with: page!)!
                 let data: NSData = img.tiffRepresentation! as NSData
-                selctPageImages.append(data)
+                selctPageImages.add(data)
             }
         }
         
@@ -627,15 +627,15 @@ class KMOCRPDFWindowController: NSWindowController, NSWindowDelegate, KMGOCRMana
         DispatchQueue.main.async {
             let languages = KMGOCRManager.default().selectedLanguages?.value(forKeyPath: KMGOCRLanguageCodeKey)
             if self.planComboBox.indexOfSelectedItem == 0 {
-                self.googleOCRManger = KMGOCRManager()
-                self.googleOCRManger?.ocrType = .google
-                self.googleOCRManger?.delegate = self
-                self.googleOCRManger?.recognitionImages(selctPageImages, withLanguages: languages as? [Any])
+//                self.googleOCRManger = KMGOCRManager()
+//                self.googleOCRManger?.ocrType = .google
+//                self.googleOCRManger?.delegate = self
+//                self.googleOCRManger?.recognitionImages((selctPageImages as! [Any]), withLanguages: languages as? [Any])
             } else {
                 self.appleOCRManger = KMGOCRManager()
                 self.appleOCRManger?.ocrType = .apple
                 self.appleOCRManger?.delegate = self
-                self.appleOCRManger?.recognitionImages(selctPageImages, withLanguages: languages as? [Any])
+                self.appleOCRManger?.recognitionImages((selctPageImages as! [Any]), withLanguages: languages as? [Any])
             }
         }
     }