123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684 |
- #import <UIKit/UIKit.h>
- #import <ComPDFKit/CPDFKitPlatform.h>
- @class CPDFView, CPDFDocument, CPDFPage, CPDFSelection, CPDFDestination, CPDFFreeTextAnnotation, CPDFTextWidgetAnnotation,CPDFAnnotation;
- typedef NS_OPTIONS(NSInteger, CEditingSelectState) {
- CEditingSelectStateEmpty = 0,
- CEditingSelectStateEditTextArea,
- CEditingSelectStateEditNoneText,
- CEditingSelectStateEditSelectText,
- };
- typedef NS_OPTIONS(NSInteger, CEditingLoadType) {
- CEditingLoadTypeText = (1UL << 0),
- CEditingLoadTypeImage = (1UL << 1),
- };
- typedef NS_ENUM(NSInteger, CPDFDisplayDirection) {
- CPDFDisplayDirectionVertical = 0,
- CPDFDisplayDirectionHorizontal = 1,
- };
- typedef NS_ENUM(NSInteger, CPDFDisplayMode) {
- CPDFDisplayModeNormal = 0,
- CPDFDisplayModeNight = 1,
- CPDFDisplayModeSoft = 2,
- CPDFDisplayModeGreen = 3,
- CPDFDisplayModeCustom = 4
- };
- extern NSNotificationName const CPDFViewDocumentChangedNotification;
- extern NSNotificationName const CPDFViewPageChangedNotification;
- #pragma mark - CPDFEditArea
- @interface CPDFEditArea : NSObject
- @property (nonatomic,readonly) CPDFPage *page;
- @property (nonatomic,readonly) CGRect bounds;
- @property (nonatomic,readonly) CPDFSelection *selection;
- - (BOOL)IsTextArea;
- - (BOOL)IsImageArea;
- @end
- #pragma mark - CPDFEditTextArea
- @interface CPDFEditTextArea : CPDFEditArea
- @end
- #pragma mark - CPDFEditImageArea
- @interface CPDFEditImageArea : CPDFEditArea
- @property (nonatomic,readonly) CGRect cropRect;
- @property (nonatomic,assign) BOOL isCropMode;
- @end
- #pragma mark - CPDFEditingConfig
- @interface CPDFEditingConfig : NSObject
- @property (nonatomic,retain) CPDFKitPlatformColor *editingBorderColor;
- @property (nonatomic,retain) CPDFKitPlatformColor *editingSelectionBorderColor;
- @property (nonatomic,assign) CGFloat editingBorderWidth;
- @property (nonatomic,retain) NSArray * editingBorderDashPattern;
- @property (nonatomic,assign) CGFloat editingOffsetGap;
- @property (nonatomic,assign) CGFloat pageSpacingGap;
- @end
- @protocol CPDFViewDelegate <NSObject>
- @optional
- - (void)PDFViewDocumentDidLoaded:(CPDFView *)pdfView;
- - (void)PDFViewCurrentPageDidChanged:(CPDFView *)pdfView;
- - (void)PDFViewDidClickOnLink:(CPDFView *)pdfView withURL:(NSString *)url;
- - (void)PDFViewPerformURL:(CPDFView *)pdfView withContent:(NSString *)content;
- - (void)PDFViewPerformUOP:(CPDFView *)pdfView withContent:(NSString *)content;
- - (void)PDFViewPerformPrint:(CPDFView *)pdfView;
- - (void)PDFViewPerformReset:(CPDFView *)pdfView;
- - (void)PDFViewShouldBeginEditing:(CPDFView *)pdfView textView:(UITextView *)textView forAnnotation:(CPDFFreeTextAnnotation *)annotation;
- - (void)PDFViewShouldEndEditing:(CPDFView *)pdfView textView:(UITextView *)textView forAnnotation:(CPDFFreeTextAnnotation *)annotation;
- - (void)PDFViewShouldBeginEditing:(CPDFView *)pdfView textView:(UITextView *)textView forTextWidget:(CPDFTextWidgetAnnotation *)textWidget;
- - (void)PDFViewShouldEndEditing:(CPDFView *)pdfView textView:(UITextView *)textView forTextWidget:(CPDFTextWidgetAnnotation *)textWidget;
- - (void)PDFViewDidEndDragging:(CPDFView *)pdfView;
- - (void)PDFViewEditingCropBoundsDidChanged:(CPDFView *)pdfView editingArea:(CPDFEditArea *)editArea;
- - (void)PDFViewEditingOperationDidChanged:(CPDFView *)pdfView;
- - (void)PDFViewEditingSelectStateDidChanged:(CPDFView *)pdfView;
- - (void)PDFEditingViewShouldBeginEditing:(CPDFView *)pdfView textView:(UITextView *)textView;
- - (void)PDFEditingViewShouldEndEditing:(CPDFView *)pdfView textView:(UITextView *)textView;
- @end
- @interface CPDFView : UIView
- #pragma mark - Document
- @property (nonatomic,retain) CPDFDocument *document;
- #pragma mark - Accessors
- @property (nonatomic,assign) id<CPDFViewDelegate> delegate;
- @property (nonatomic,assign) BOOL displayTwoUp;
- @property (nonatomic,assign) BOOL displaysAsBook;
- @property (nonatomic,assign) CPDFDisplayDirection displayDirection;
- @property (nonatomic,assign) BOOL displaysPageBreaks;
- @property (nonatomic,assign) UIEdgeInsets pageBreakMargins;
- @property (nonatomic,assign) CPDFDisplayMode displayMode;
- @property (nonatomic,retain) UIColor *displayModeCustomColor;
- @property (nonatomic,assign) BOOL displayCrop;
- @property (nonatomic,assign) BOOL scrollEnabled;
- @property (nonatomic,assign) BOOL directionaHorizontalLockEnabled;
- @property (nonatomic,assign) CGFloat scaleFactor;
- - (void)setScaleFactor:(CGFloat)scaleFactor animated:(BOOL)animated;
- #pragma mark - Draw
- @property (nonatomic,readonly) BOOL isDrawing;
- @property (nonatomic,readonly) BOOL isDrawErasing;
- - (void)beginDrawing;
- - (void)endDrawing;
- - (void)commitDrawing;
- - (void)setDrawErasing:(BOOL)isErasing;
- - (void)drawUndo;
- - (void)drawRedo;
- #pragma mark - Annotation
- - (void)editAnnotationFreeText:(CPDFFreeTextAnnotation *)freeText;
- - (void)commitEditAnnotationFreeText;
- - (void)setEditAnnotationFreeTextFont:(UIFont *)font;
- - (void)setEditAnnotationFreeTextColor:(UIColor *)color;
- #pragma mark - Page
- @property (nonatomic,readonly) NSInteger currentPageIndex;
- - (void)goToPageIndex:(NSInteger)pageIndex animated:(BOOL)animated;
- @property (nonatomic,readonly) CPDFDestination *currentDestination;
- - (void)goToDestination:(CPDFDestination *)destination animated:(BOOL)animated;
- - (void)goToRect:(CGRect)rect onPage:(CPDFPage *)page animated:(BOOL)animated;
- @property (nonatomic,readonly) NSArray<CPDFPage *> *visiblePages;
- #pragma mark - Selection
- @property (nonatomic,assign) BOOL textSelectionMode;
- @property (nonatomic,readonly) CPDFSelection *currentSelection;
- - (void)clearSelection;
- - (void)goToSelection:(CPDFSelection *)selection animated:(BOOL)animated;
- - (void)setHighlightedSelection:(CPDFSelection *)selection animated:(BOOL)animated;
- #pragma mark - Display
- - (UIScrollView *)documentView;
- - (void)layoutDocumentView;
- - (void)setNeedsDisplayForVisiblePages;
- - (void)setNeedsDisplayForPage:(CPDFPage *)page;
- #pragma mark - Rendering
- - (void)drawPage:(CPDFPage *)page toContext:(CGContextRef)context;
- #pragma mark - Menu
- - (NSArray<UIMenuItem *> *)menuItemsAtPoint:(CGPoint)point forPage:(CPDFPage *)page;
- #pragma mark - Touch
- - (void)touchBeganAtPoint:(CGPoint)point forPage:(CPDFPage *)page;
- - (void)touchMovedAtPoint:(CGPoint)point forPage:(CPDFPage *)page;
- - (void)touchEndedAtPoint:(CGPoint)point forPage:(CPDFPage *)page;
- - (void)touchCancelledAtPoint:(CGPoint)point forPage:(CPDFPage *)page;
- - (void)longPressAnnotation:(CPDFAnnotation *)annotation atPoint:(CGPoint)point forPage:(CPDFPage *)page;
- #pragma mark - Conversion
- - (CGPoint)convertPoint:(CGPoint)point toPage:(CPDFPage *)page;
- - (CGRect)convertRect:(CGRect)rect toPage:(CPDFPage *)page;
- - (CGPoint)convertPoint:(CGPoint)point fromPage:(CPDFPage *)page;
- - (CGRect)convertRect:(CGRect)rect fromPage:(CPDFPage *)page;
- #pragma mark - Edit
- @property (nonatomic,retain) CPDFEditingConfig *editingConfig;
- @property (nonatomic,readonly) CEditingLoadType editingLoadType ;
- - (void)beginEditingLoadType:(CEditingLoadType)editingLoadType;
- - (void)changeEditingLoadType:(CEditingLoadType)editingLoadType;
- - (void)endOfEditing;
- - (void)commitEditing;
- - (BOOL)isEditing;
- - (BOOL)isEdited;
- - (CPDFEditArea *)editingArea;
- - (NSArray<UIMenuItem *> *)menuItemsEditingAtPoint:(CGPoint)point forPage:(CPDFPage *)page;
- - (CEditingSelectState )editStatus;
- #pragma mark - Edit Text & Image
- - (void)setBoundsEditArea:(CPDFEditArea *)editArea withBounds:(CGRect)bounds;
- - (void)deleteEditingArea:(CPDFEditArea *)editArea;
- - (BOOL)canEditTextUndo;
- - (BOOL)canEditTextRedo;
- - (void)editTextUndo;
- - (void)editTextRedo;
- #pragma mark - Edit Text
- - (CGFloat)editingSelectionFontSize;
- - (void)setEditingSelectionFontSize:(CGFloat)fontSize;
- - (CPDFKitPlatformColor *)editingSelectionFontColor;
- - (void)setEditingSelectionFontColor:(CPDFKitPlatformColor *)fontColor;
- - (NSTextAlignment)editingSelectionAlignment;
- - (void)setCurrentSelectionAlignment:(NSTextAlignment)alignment;
- - (NSString *)editingSelectionFontName;
- - (void)setEditingSelectionFontName:(NSString *)fontName;
- - (void)setCurrentSelectionIsItalic:(BOOL)isItalic;
- - (BOOL)isItalicCurrentSelection;
- - (void)setCurrentSelectionIsBold:(BOOL)isBold;
- - (BOOL)isBoldCurrentSelection;
- - (BOOL)createEmptyStringBounds:(CGRect)rect withAttributes:(NSDictionary<NSAttributedStringKey, id> *)attributes page:(CPDFPage *)page;
- - (BOOL)setCharsFontTransparency:(float)transparency;
- - (CGFloat)getCurrentOpacity;
- - (NSArray*)getFontList;
- #pragma mark - Edit Image
- - (CGFloat)getRotationEditArea:(CPDFEditImageArea*)editArea;
- - (void)rotateEditArea:(CPDFEditImageArea *)editArea rotateAngle:(float)angle;
- - (BOOL)horizontalMirrorEditArea:(CPDFEditImageArea *)editArea;
- - (BOOL)verticalMirrorEditArea:(CPDFEditImageArea *)editArea;
- - (void)cropEditArea:(CPDFEditImageArea *)editArea withRect:(CGRect)rect;
- - (CGRect)getClipRectEditArea:(CPDFEditImageArea *)editArea;
- - (void)beginCropEditArea:(CPDFEditImageArea *)editArea;
- - (void)endCropEditArea:(CPDFEditImageArea *)editArea;
- - (BOOL)extractImageEditArea:(CPDFEditImageArea *)editArea filePath:(NSString*)filePath;
- - (BOOL)extractImageWithEditImageArea:(CPDFEditArea *)editArea;
- - (float)getImageTransparencyEditArea:(CPDFEditImageArea *)editArea;
- - (BOOL)setImageTransparencyEditArea:(CPDFEditImageArea *)editArea transparency:(float)transparency;
- - (BOOL)createEmptyImage:(CGRect)rect page:(CPDFPage *)page path:(NSString*)imagePath;
- - (BOOL)replaceEditImageArea:(CPDFEditImageArea *)editArea imagePath:(NSString *)imagePath;
- @end
|