KMBookletManager.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // BLBookletManager.h
  3. // Booklet
  4. //
  5. // Created by 蒋志鹏 on 2018/5/3.
  6. // Copyright © 2018年 NO1. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <Quartz/Quartz.h>
  10. @class PDFPage;
  11. @class KMBookletParameterModel;
  12. typedef void(^Booklet_GenerateNewPDFBlock)(BOOL success,NSString *urlString);
  13. @interface KMBookletManager : NSObject
  14. //单例方法
  15. + (instancetype)sharedManager;
  16. /**
  17. 根据参数对象生成PDF
  18. @param parameterModel 参数对象
  19. @param handle 回调
  20. */
  21. - (void)generateNewPDFWithParameterModel:(KMBookletParameterModel*)parameterModel
  22. completionHandler:(Booklet_GenerateNewPDFBlock) handle;
  23. /**
  24. 根据模型对象,生成最后用来绘制的数组,其中,每个数组两个元素(一张page画两个page)
  25. @param parameterModel 参数对象
  26. @return 绘制数组
  27. */
  28. - (NSArray *)fetchDrawPageArraysWithModel:(KMBookletParameterModel *)parameterModel;
  29. /**
  30. 绘制PDF
  31. @param myPDFContext 画布对象
  32. @param parameterModel 参数对象
  33. @param subArr 绘制page数组
  34. */
  35. - (void)drawPageWithContext:(CGContextRef) myPDFContext
  36. parameterModel:(KMBookletParameterModel *)parameterModel
  37. printArray:(NSArray *)subArr;
  38. /**
  39. 对原始数组进行重组,比如0,1,2,3,4,5--> [0,5],[4,1],[2,3],数字代表数组下标
  40. @param primaryArray 待处理数组
  41. @return 处理好的数组
  42. */
  43. - (NSMutableArray *)regroupBothSidesPrintArrayWithPrimaryArray:(NSArray *)primaryArray;
  44. @end