PDFDrawable.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //
  2. // PDFDrawable.h
  3. // pdftest
  4. //
  5. // Created by Ray on 10/11/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import "UIKit/UIDocument.h"
  11. #import "const.h"
  12. //#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  13. @class PDFDrawable;
  14. @protocol PDFDrawableDelegate <NSObject>
  15. -(void) outofPage:(CGContextRef) context ;//indexPath :(NSIndexPath*) indexPath;
  16. -(void) addPageCount:(CGContextRef) context ;//indexPath :(NSIndexPath*) indexPath;
  17. @end
  18. @interface PDFDrawable : NSObject
  19. @property (nonatomic,strong) NSMutableDictionary* drawableTemplate;
  20. @property (nonatomic,strong) NSString* hAlign;
  21. @property (nonatomic,strong) NSString* vAlign;
  22. @property double margin_left;
  23. @property double margin_right;
  24. @property double margin_top;
  25. @property double margin_bottom;
  26. @property CGRect rect;
  27. //@property CGRect drawable_rect;
  28. @property (nonatomic, weak) id<PDFDrawableDelegate> delegate;
  29. -(CGRect) Query_Rect:(CGContextRef) context dataSource:(NSMutableDictionary*)data ParentRect:(CGRect)p_rect startX:(double) x startY:(double) y flipHeight:(double)flip_height range:(NSRange)between_header_and_footer;
  30. -(CGRect) Draw:(CGContextRef) context dataSource:(NSMutableDictionary*)data ParentRect:(CGRect)p_rect startX:(double) x startY:(double) y flipHeight:(double)flip_height range:(NSRange)between_header_and_footer;
  31. -(instancetype) init:(NSMutableDictionary *)drawableTemplate;
  32. -(CGRect)to_parent_rect:(CGRect)parentRect pos:(CGRect)rect offsetX:(double)x offsetY:(double)y;
  33. -(CGPoint)to_parent_point:(CGRect)parentRect point:(CGPoint)p offsetX:(double)x offsetY:(double)y;
  34. -(CGRect)parent_to_pdf_rect:(CGRect)rect contextHeight:(double) height;
  35. -(CGRect)to_pdf_rect:(CGRect)parentRect pos:(CGRect)rect contextHeight:(double) height;
  36. -(CGPoint)to_pdf_point:(CGRect)parentRect point:(CGPoint)p contextHeight:(double) height;
  37. +(NSMutableDictionary *) createDrawableTemplate:(CGRect) rect;
  38. -(void) DrawBound:(CGContextRef) context dataSource:(NSMutableDictionary*)data ParentRect:(CGRect)p_rect startX:(double) x startY:(double) y flipHeight:(double)flip_height range:(NSRange)between_header_and_footer;
  39. -(void) setMargin:(double)leftMargin right:(double)rightMargin top:(double)topMargin bottom:(double)bottomMargin;
  40. @end