//
//  CPDFConverterFP.h
//  ComPDFKit_Conversion
//
//  Copyright © 2014-2022 PDF Technologies, Inc. All Rights Reserved.
//
//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
//  This notice may not be removed from this file.
//

#import <Foundation/Foundation.h>

typedef NSString* const CPDFConvertOptionsKey NS_STRING_ENUM;

extern CPDFConvertOptionsKey CPDFConvertOptionsKeyImageDPI; // NSInteger
extern CPDFConvertOptionsKey CPDFConvertOptionsKeyAllInOneSheet; // BOOL

@protocol CPDFConverterFPDelegate <NSObject>

@optional

// 将要开始转换
- (void)FPPDFConverter:(id)converter didStartConversion:(NSError *)error;

// 完成转换
- (void)FPPDFConverter:(id)converter didEndConversion:(NSError *)error;

// 该页进度 - OCR
- (void)FPPDFConverter:(id)converter
             pageIndex:(NSUInteger)pageIndexA
              progress:(NSUInteger)progress;

// 完成某一页得解析
- (void)FPPDFConverter:(id)converter
   convertPDFPageIndex:(NSUInteger)pdfPageIndexA
    writeWordPageIndex:(NSUInteger)wordPageIndexA
  finshedWordPageCount:(NSUInteger)wordPageCountA;

// 某一页不能转换
- (void)FPPDFConverter:(id)converter
   convertPDFPageIndex:(NSUInteger)pdfPageIndexA
        faildWithError:(NSError *)error;

// 将要保存文档到磁盘
- (void)FPPDFConverter:(id)converter willSaveDoc:(NSError *)error;

// 扑捉到异常
- (void)FPPDFConverter:(id)converter
        catchException:(NSException *)exception;

@end

@interface CPDFConverterFP : NSObject

- (instancetype)init;

- (void)setDelegate:(id<CPDFConverterFPDelegate>)delegate;

- (void)convertPDFAtPath:(NSString *)pdfPathA
             pdfPassword:(NSString *)pdfPasswordA
           pdfPageIndexs:(NSArray *)pdfPageIndexsA
             destDocType:(NSString *)destDocTypeA
             destDocPath:(NSString *)destDocPathA
             moreOptions:(NSDictionary<CPDFConvertOptionsKey, id> *)moreOptionsA;

- (void)stopConvertsionIfNeed;

@end
