RCTDocumentManager.m 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. // Copyright © 2014-2025 PDF Technologies, Inc. All Rights Reserved.
  2. //
  3. // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  4. // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  5. // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  6. // This notice may not be removed from this file.
  7. //
  8. #import <React/RCTBridgeModule.h>
  9. @interface RCT_EXTERN_MODULE(CPDFViewManager, NSObject)
  10. RCT_EXTERN_METHOD(save:(NSInteger)tag
  11. withResolver:(RCTPromiseResolveBlock)resolve
  12. withRejecter:(RCTPromiseRejectBlock)reject)
  13. RCT_EXTERN_METHOD(setMargins:(NSInteger)tag
  14. withEdges:[Int]edges)
  15. RCT_EXTERN_METHOD(removeAllAnnotations:(NSInteger)tag
  16. withResolver:(RCTPromiseResolveBlock)resolve
  17. withRejecter:(RCTPromiseRejectBlock)reject)
  18. RCT_EXTERN_METHOD(importAnnotations:(NSInteger)tag
  19. withXfdfFile:(NSURL *)xfdfFile
  20. withResolver:(RCTPromiseResolveBlock)resolve
  21. withRejecter:(RCTPromiseRejectBlock)reject)
  22. RCT_EXTERN_METHOD(exportAnnotations:(NSInteger)tag
  23. withResolver:(RCTPromiseResolveBlock)resolve
  24. withRejecter:(RCTPromiseRejectBlock)reject)
  25. RCT_EXTERN_METHOD(setDisplayPageIndex:(NSInteger)tag
  26. withPageIndex:(NSInteger)pageIndex)
  27. RCT_EXTERN_METHOD(getCurrentPageIndex:(NSInteger)tag
  28. withResolver:(RCTPromiseResolveBlock)resolve
  29. withRejecter:(RCTPromiseRejectBlock)reject)
  30. RCT_EXTERN_METHOD(hasChange:(NSInteger)tag
  31. withResolver:(RCTPromiseResolveBlock)resolve
  32. withRejecter:(RCTPromiseRejectBlock)reject)
  33. RCT_EXTERN_METHOD(setScale:(NSInteger)tag
  34. withScaleValue:(nonnull NSNumber *) scale)
  35. RCT_EXTERN_METHOD(getScale:(NSInteger)tag
  36. withResolver:(RCTPromiseResolveBlock)resolve
  37. withRejecter:(RCTPromiseRejectBlock)reject)
  38. RCT_EXTERN_METHOD(setReadBackgroundColor:(NSInteger)tag
  39. withThemes:(NSDictionary) themes)
  40. RCT_EXTERN_METHOD(getReadBackgroundColor:(NSInteger)tag
  41. withResolver:(RCTPromiseResolveBlock)resolve
  42. withRejecter:(RCTPromiseRejectBlock)reject)
  43. RCT_EXTERN_METHOD(setFormFieldHighlight:(NSInteger)tag
  44. withFormFieldHighlight:(BOOL) formFieldHighlight)
  45. RCT_EXTERN_METHOD(isFormFieldHighlight:(NSInteger)tag
  46. withResolver:(RCTPromiseResolveBlock)resolve
  47. withRejecter:(RCTPromiseRejectBlock)reject)
  48. RCT_EXTERN_METHOD(setLinkHighlight:(NSInteger)tag
  49. withLinkHighlight:(BOOL) linkHighlight)
  50. RCT_EXTERN_METHOD(isLinkHighlight:(NSInteger)tag
  51. withResolver:(RCTPromiseResolveBlock)resolve
  52. withRejecter:(RCTPromiseRejectBlock)reject)
  53. RCT_EXTERN_METHOD(setVerticalMode:(NSInteger)tag
  54. withVerticalMode:(BOOL) isVerticalMode)
  55. RCT_EXTERN_METHOD(isVerticalMode:(NSInteger)tag
  56. withResolver:(RCTPromiseResolveBlock)resolve
  57. withRejecter:(RCTPromiseRejectBlock)reject)
  58. RCT_EXTERN_METHOD(setContinueMode:(NSInteger)tag
  59. withContiueMode:(BOOL) isContinueMode)
  60. RCT_EXTERN_METHOD(isContinueMode:(NSInteger)tag
  61. withResolver:(RCTPromiseResolveBlock)resolve
  62. withRejecter:(RCTPromiseRejectBlock)reject)
  63. RCT_EXTERN_METHOD(setDoublePageMode:(NSInteger)tag
  64. withDoublePageMode:(BOOL) isDoublePageMode)
  65. RCT_EXTERN_METHOD(isDoublePageMode:(NSInteger)tag
  66. withResolver:(RCTPromiseResolveBlock)resolve
  67. withRejecter:(RCTPromiseRejectBlock)reject)
  68. RCT_EXTERN_METHOD(setCoverPageMode:(NSInteger)tag
  69. withCoverPageMode:(BOOL) isCoverPageMode)
  70. RCT_EXTERN_METHOD(isCoverPageMode:(NSInteger)tag
  71. withResolver:(RCTPromiseResolveBlock)resolve
  72. withRejecter:(RCTPromiseRejectBlock)reject)
  73. RCT_EXTERN_METHOD(setCropMode:(NSInteger)tag
  74. withCropMode:(BOOL) isCropMode)
  75. RCT_EXTERN_METHOD(isCropMode:(NSInteger)tag
  76. withResolver:(RCTPromiseResolveBlock)resolve
  77. withRejecter:(RCTPromiseRejectBlock)reject)
  78. RCT_EXTERN_METHOD(setPreviewMode:(NSInteger *)tag
  79. withViewMode:(NSString) viewMode)
  80. RCT_EXTERN_METHOD(getPreviewMode:(NSInteger *)tag
  81. withResolver:(RCTPromiseResolveBlock)resolve
  82. withRejecter:(RCTPromiseRejectBlock)reject)
  83. RCT_EXTERN_METHOD(showThumbnailView:(NSInteger *)tag
  84. withEditMode:(BOOL) editMode)
  85. RCT_EXTERN_METHOD(showBotaView:(NSInteger *)tag)
  86. RCT_EXTERN_METHOD(showAddWatermarkView:(NSInteger *)tag
  87. withSaveAsNewFile: (BOOL) saveAsNewFile)
  88. RCT_EXTERN_METHOD(showSecurityView:(NSInteger *)tag)
  89. RCT_EXTERN_METHOD(showDisplaySettingView:(NSInteger *)tag)
  90. RCT_EXTERN_METHOD(enterSnipMode:(NSInteger *)tag)
  91. RCT_EXTERN_METHOD(exitSnipMode:(NSInteger *)tag)
  92. RCT_EXTERN_METHOD(open:(NSInteger *)tag
  93. withDocument:(NSURL *) document
  94. withPassword:(NSString *) password
  95. withResolver:(RCTPromiseResolveBlock)resolve
  96. withRejecter:(RCTPromiseRejectBlock)reject)
  97. RCT_EXTERN_METHOD(getFileName:(NSInteger *) tag
  98. withResolver:(RCTPromiseResolveBlock)resolve
  99. withRejecter:(RCTPromiseRejectBlock)reject)
  100. RCT_EXTERN_METHOD(isEncrypted:(NSInteger *) tag
  101. withResolver:(RCTPromiseResolveBlock)resolve
  102. withRejecter:(RCTPromiseRejectBlock)reject)
  103. RCT_EXTERN_METHOD(isImageDoc:(NSInteger *) tag
  104. withResolver:(RCTPromiseResolveBlock)resolve
  105. withRejecter:(RCTPromiseRejectBlock)reject)
  106. RCT_EXTERN_METHOD(getPermissions:(NSInteger *) tag
  107. withResolver:(RCTPromiseResolveBlock)resolve
  108. withRejecter:(RCTPromiseRejectBlock)reject)
  109. RCT_EXTERN_METHOD(getPageCount:(NSInteger *) tag
  110. withResolver:(RCTPromiseResolveBlock)resolve
  111. withRejecter:(RCTPromiseRejectBlock)reject)
  112. RCT_EXTERN_METHOD(checkOwnerUnlocked:(NSInteger *) tag
  113. withResolver:(RCTPromiseResolveBlock)resolve
  114. withRejecter:(RCTPromiseRejectBlock)reject)
  115. RCT_EXTERN_METHOD(checkOwnerPassword:(NSInteger *) tag
  116. withPassword:(NSString *) password
  117. withResolver:(RCTPromiseResolveBlock)resolve
  118. withRejecter:(RCTPromiseRejectBlock)reject)
  119. RCT_EXTERN_METHOD(removePassword:(NSInteger *) tag
  120. withResolver:(RCTPromiseResolveBlock)resolve
  121. withRejecter:(RCTPromiseRejectBlock)reject)
  122. RCT_EXTERN_METHOD(setPassword:(NSInteger *) tag
  123. withInfo:(NSDictionary) info
  124. withResolver:(RCTPromiseResolveBlock)resolve
  125. withRejecter:(RCTPromiseRejectBlock)reject)
  126. RCT_EXTERN_METHOD(getEncryptAlgo:(NSInteger *) tag
  127. withResolver:(RCTPromiseResolveBlock)resolve
  128. withRejecter:(RCTPromiseRejectBlock)reject)
  129. RCT_EXTERN_METHOD(printDocument:(NSInteger *)tag)
  130. RCT_EXTERN_METHOD(importWidgets:(NSInteger)tag
  131. withXfdfFile:(NSURL *)xfdfFile
  132. withResolver:(RCTPromiseResolveBlock)resolve
  133. withRejecter:(RCTPromiseRejectBlock)reject)
  134. RCT_EXTERN_METHOD(exportWidgets:(NSInteger)tag
  135. withResolver:(RCTPromiseResolveBlock)resolve
  136. withRejecter:(RCTPromiseRejectBlock)reject)
  137. RCT_EXTERN_METHOD(getDocumentPath:(NSInteger *)tag
  138. withResolver:(RCTPromiseResolveBlock)resolve
  139. withRejecter:(RCTPromiseRejectBlock)reject)
  140. RCT_EXTERN_METHOD(flattenAllPages:(NSInteger)tag
  141. withSavePath:(NSURL *) savePath
  142. withFontSubset:(BOOL) fontSubset
  143. withResolver:(RCTPromiseResolveBlock)resolve
  144. withRejecter:(RCTPromiseRejectBlock)reject)
  145. RCT_EXTERN_METHOD(saveAs:(NSInteger)tag
  146. withSavePath:(NSURL *) savePath
  147. withRemoveSecurity:(BOOL) removeSecurity
  148. withFontSubset:(BOOL) fontSubset
  149. withResolver:(RCTPromiseResolveBlock)resolve
  150. withRejecter:(RCTPromiseRejectBlock)reject)
  151. RCT_EXTERN_METHOD(importDocument:(NSInteger)tag
  152. withFilePath:(NSURL *) filePath
  153. withInfo:(NSDictionary) info
  154. withResolver:(RCTPromiseResolveBlock)resolve
  155. withRejecter:(RCTPromiseRejectBlock)reject)
  156. RCT_EXTERN_METHOD(splitDocumentPages:(NSInteger)tag
  157. withSavePath:(NSURL *) savePath
  158. withPages:(NSArray *) pages
  159. withResolver:(RCTPromiseResolveBlock)resolve
  160. withRejecter:(RCTPromiseRejectBlock)reject)
  161. RCT_EXTERN_METHOD(getAnnotations:(NSInteger)tag
  162. withPageIndex:(NSInteger) pageIndex
  163. withResolver:(RCTPromiseResolveBlock)resolve
  164. withRejecter:(RCTPromiseRejectBlock)reject)
  165. RCT_EXTERN_METHOD(getForms:(NSInteger)tag
  166. withPageIndex:(NSInteger) pageIndex
  167. withResolver:(RCTPromiseResolveBlock)resolve
  168. withRejecter:(RCTPromiseRejectBlock)reject)
  169. + (BOOL)requiresMainQueueSetup
  170. {
  171. return NO;
  172. }
  173. @end