KMOCROperation.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // KMOCROperation.h
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 万军 on 2020/3/23.
  6. //
  7. /**
  8. 无法网络翻墙 OCR 转换文本 NSOperation
  9. */
  10. #import <Foundation/Foundation.h>
  11. @class KMOCROperation;
  12. @protocol KMOCROperationDelegate <NSObject>
  13. @optional
  14. - (void)OCROperation:(KMOCROperation *)operation cancelOCRImageAtIndex:(NSInteger)index;
  15. - (void)OCROperation:(KMOCROperation *)operation startOCRImageAtIndex:(NSInteger)index;
  16. - (void)OCROperation:(KMOCROperation *)operation finishOCRImageAtIndex:(NSInteger)index results:(NSArray *)result;
  17. - (void)OCROperation:(KMOCROperation *)operation failureOCRImageAtIndex:(NSInteger)index error:(NSError *)error;
  18. @end
  19. @interface KMOCROperation : NSOperation
  20. @property (nonatomic, assign) id<KMOCROperationDelegate> operationDelegate;
  21. /* 设置的识别语言数组 */
  22. @property (nonatomic, strong) NSMutableArray *selectedLanguages;
  23. /* 需要转换的文件类型 PDF/TXT */
  24. @property (nonatomic, strong) NSString *fileType;
  25. /* 转换的文件保存路径 */
  26. @property (nonatomic, strong) NSString *filePath;
  27. /**
  28. 非 Google OCR ONSOperation 初始化.
  29. @param image 需要转换的NSImage对象
  30. @param imageIndex 需要转换的NSImage对象的序号
  31. */
  32. - (instancetype)initWithRecognitionImage:(NSImage *)image withImageIndex:(NSInteger)imageIndex;
  33. @end