123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // CPDFConverter.h
- // ComPDFKit_Conversion
- //
- // Copyright © 2014-2023 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>
- #import <ComPDFKit_Conversion/CPDFConvertOptions.h>
- extern NSErrorDomain const CPDFConverterErrorDomain;
- NS_ERROR_ENUM(CPDFConverterErrorDomain) {
- CPDFConverterSuccess = 0, // Success
- CPDFConverterEncryptError = 1, // Password required or incorrect password.
- CPDFConverterPermissionError = 2, // The license doesn't allow the permission.
- CPDFConverterMallocError = 3, // Malloc failure.
- CPDFConverterUnknownError = 4, // Unknown error in processing conversion.
- CPDFConverterPDFUnknownError = 5, // Unknown error in processing PDF.
- CPDFConverterPDFFileError = 6, // File not found or could not be opened.
- CPDFConverterPDFFormatError = 7, // File not in PDF format or corrupted.
- CPDFConverterPDFSecurityError = 8, // Unsupported security scheme.
- CPDFConverterPDFPageError = 9 // Page not found or content error.
- };
- @class CPDFConverter;
- /**
- * The delegate for the CPDFConverter object.
- */
- @protocol CPDFConverterDelegate <NSObject>
- @optional
- /**
- * Called when a conversion operation begins.
- */
- - (void)converter:(CPDFConverter *)converter didStartConvert:(NSError *)error;
- /**
- * Called when a conversion operation finishes.
- */
- - (void)converter:(CPDFConverter *)converter didEndConvert:(NSError *)error;
- /**
- * Called when a conversion operation finishes working on a page in a document.
- */
- - (void)converter:(CPDFConverter *)converter pageIndex:(NSUInteger)index pageCount:(NSUInteger)count;
- @end
- /**
- * This is the base class for all conversion operations.
- *
- * This is the base class for all converters. A CPDFConverter object by itself is not useful, only subclasses (like CPDFConverterWord, CPDFConverterPPT) are interesting.
- */
- @interface CPDFConverter : NSObject
- /**
- * Initializes a CPDFConverter object with the contents at the specified URL.
- */
- - (instancetype)initWithURL:(NSURL *)url password:(NSString *)password;
- /**
- * The object acting as the delegate for the CPDFConverter object.
- *
- * @see CPDFConverterDelegate
- */
- @property (nonatomic,assign) id<CPDFConverterDelegate> delegate;
- /**
- * Returns a Boolean value indicating whether a conversion operation is in progress.
- */
- @property (nonatomic,readonly) BOOL isConverting;
- /**
- * Starts convert the specified source file into the specified file.
- *
- * @param filePath String of the full path to the specified file.
- * @param pageIndexs The page number range.
- */
- - (void)convertToFilePath:(NSString *)filePath pageIndexs:(NSArray *)pageIndexs options:(CPDFConvertOptions *)options;
- /**
- * Cancels the conversion task.
- */
- - (void)cancel;
- @end
|