// // KMOCROperation.h // PDF Reader Pro Edition // // Created by 万军 on 2020/3/23. // /** 无法网络翻墙 OCR 转换文本 NSOperation */ #import @class KMOCROperation; @protocol KMOCROperationDelegate @optional - (void)OCROperation:(KMOCROperation *)operation cancelOCRImageAtIndex:(NSInteger)index; - (void)OCROperation:(KMOCROperation *)operation startOCRImageAtIndex:(NSInteger)index; - (void)OCROperation:(KMOCROperation *)operation finishOCRImageAtIndex:(NSInteger)index results:(NSArray *)result; - (void)OCROperation:(KMOCROperation *)operation failureOCRImageAtIndex:(NSInteger)index error:(NSError *)error; @end @interface KMOCROperation : NSOperation @property (nonatomic, assign) id operationDelegate; /* 设置的识别语言数组 */ @property (nonatomic, strong) NSMutableArray *selectedLanguages; /* 需要转换的文件类型 PDF/TXT */ @property (nonatomic, strong) NSString *fileType; /* 转换的文件保存路径 */ @property (nonatomic, strong) NSString *filePath; /** 非 Google OCR ONSOperation 初始化. @param image 需要转换的NSImage对象 @param imageIndex 需要转换的NSImage对象的序号 */ - (instancetype)initWithRecognitionImage:(NSImage *)image withImageIndex:(NSInteger)imageIndex; @end