@hussmartinez/pdf-sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +66 -0
  3. package/README.md +84 -2
  4. package/dist/assets/pdfjs/build/pdf.worker.min.mjs +28 -0
  5. package/dist/assets/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  6. package/dist/assets/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  7. package/dist/assets/pdfjs/cmaps/78-H.bcmap +0 -0
  8. package/dist/assets/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  9. package/dist/assets/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  10. package/dist/assets/pdfjs/cmaps/78-V.bcmap +0 -0
  11. package/dist/assets/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  12. package/dist/assets/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  13. package/dist/assets/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  14. package/dist/assets/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  15. package/dist/assets/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  16. package/dist/assets/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  17. package/dist/assets/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  18. package/dist/assets/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  19. package/dist/assets/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  20. package/dist/assets/pdfjs/cmaps/Add-H.bcmap +0 -0
  21. package/dist/assets/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  22. package/dist/assets/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  23. package/dist/assets/pdfjs/cmaps/Add-V.bcmap +0 -0
  24. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  25. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  26. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  27. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  28. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  29. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  30. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  31. package/dist/assets/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  32. package/dist/assets/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  33. package/dist/assets/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  34. package/dist/assets/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  35. package/dist/assets/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  36. package/dist/assets/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  37. package/dist/assets/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  38. package/dist/assets/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  39. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  40. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  41. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  42. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  43. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  44. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  45. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  46. package/dist/assets/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  47. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  48. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  49. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  50. package/dist/assets/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  51. package/dist/assets/pdfjs/cmaps/B5-H.bcmap +0 -0
  52. package/dist/assets/pdfjs/cmaps/B5-V.bcmap +0 -0
  53. package/dist/assets/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  54. package/dist/assets/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  55. package/dist/assets/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  56. package/dist/assets/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  57. package/dist/assets/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  58. package/dist/assets/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  59. package/dist/assets/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  60. package/dist/assets/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  61. package/dist/assets/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  62. package/dist/assets/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  63. package/dist/assets/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  64. package/dist/assets/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  65. package/dist/assets/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  66. package/dist/assets/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  67. package/dist/assets/pdfjs/cmaps/EUC-H.bcmap +0 -0
  68. package/dist/assets/pdfjs/cmaps/EUC-V.bcmap +0 -0
  69. package/dist/assets/pdfjs/cmaps/Ext-H.bcmap +0 -0
  70. package/dist/assets/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  71. package/dist/assets/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  72. package/dist/assets/pdfjs/cmaps/Ext-V.bcmap +0 -0
  73. package/dist/assets/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  74. package/dist/assets/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  75. package/dist/assets/pdfjs/cmaps/GB-H.bcmap +4 -0
  76. package/dist/assets/pdfjs/cmaps/GB-V.bcmap +0 -0
  77. package/dist/assets/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  78. package/dist/assets/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  79. package/dist/assets/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  80. package/dist/assets/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  81. package/dist/assets/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  82. package/dist/assets/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  83. package/dist/assets/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  84. package/dist/assets/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  85. package/dist/assets/pdfjs/cmaps/GBT-H.bcmap +0 -0
  86. package/dist/assets/pdfjs/cmaps/GBT-V.bcmap +0 -0
  87. package/dist/assets/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  88. package/dist/assets/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  89. package/dist/assets/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  90. package/dist/assets/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  91. package/dist/assets/pdfjs/cmaps/H.bcmap +0 -0
  92. package/dist/assets/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  93. package/dist/assets/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  94. package/dist/assets/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  95. package/dist/assets/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  96. package/dist/assets/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  97. package/dist/assets/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  98. package/dist/assets/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  99. package/dist/assets/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  100. package/dist/assets/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  101. package/dist/assets/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  102. package/dist/assets/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  103. package/dist/assets/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  104. package/dist/assets/pdfjs/cmaps/Hankaku.bcmap +0 -0
  105. package/dist/assets/pdfjs/cmaps/Hiragana.bcmap +0 -0
  106. package/dist/assets/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  107. package/dist/assets/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  108. package/dist/assets/pdfjs/cmaps/KSC-H.bcmap +0 -0
  109. package/dist/assets/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  110. package/dist/assets/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  111. package/dist/assets/pdfjs/cmaps/KSC-V.bcmap +0 -0
  112. package/dist/assets/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  113. package/dist/assets/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  114. package/dist/assets/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  115. package/dist/assets/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  116. package/dist/assets/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  117. package/dist/assets/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  118. package/dist/assets/pdfjs/cmaps/Katakana.bcmap +0 -0
  119. package/dist/assets/pdfjs/cmaps/LICENSE +36 -0
  120. package/dist/assets/pdfjs/cmaps/NWP-H.bcmap +0 -0
  121. package/dist/assets/pdfjs/cmaps/NWP-V.bcmap +0 -0
  122. package/dist/assets/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  123. package/dist/assets/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  124. package/dist/assets/pdfjs/cmaps/Roman.bcmap +0 -0
  125. package/dist/assets/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  126. package/dist/assets/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  127. package/dist/assets/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  128. package/dist/assets/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  129. package/dist/assets/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  130. package/dist/assets/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  131. package/dist/assets/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  132. package/dist/assets/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  133. package/dist/assets/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  134. package/dist/assets/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  135. package/dist/assets/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  136. package/dist/assets/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  137. package/dist/assets/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  138. package/dist/assets/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  139. package/dist/assets/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  140. package/dist/assets/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  141. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  142. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  143. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  144. package/dist/assets/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  145. package/dist/assets/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  146. package/dist/assets/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  147. package/dist/assets/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  148. package/dist/assets/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  149. package/dist/assets/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  150. package/dist/assets/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  151. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  152. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  153. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  154. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  155. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  156. package/dist/assets/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  157. package/dist/assets/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  158. package/dist/assets/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  159. package/dist/assets/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  160. package/dist/assets/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  161. package/dist/assets/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  162. package/dist/assets/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  163. package/dist/assets/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  164. package/dist/assets/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  165. package/dist/assets/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  166. package/dist/assets/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  167. package/dist/assets/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  168. package/dist/assets/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  169. package/dist/assets/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  170. package/dist/assets/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  171. package/dist/assets/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  172. package/dist/assets/pdfjs/cmaps/V.bcmap +0 -0
  173. package/dist/assets/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  174. package/dist/assets/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  175. package/dist/assets/pdfjs/iccs/LICENSE +116 -0
  176. package/dist/assets/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  177. package/dist/assets/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  178. package/dist/assets/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  179. package/dist/assets/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  180. package/dist/assets/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  181. package/dist/assets/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  182. package/dist/assets/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  183. package/dist/assets/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  184. package/dist/assets/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  185. package/dist/assets/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  186. package/dist/assets/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  187. package/dist/assets/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  188. package/dist/assets/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  189. package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  190. package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  191. package/dist/assets/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  192. package/dist/assets/pdfjs/wasm/LICENSE_QCMS +21 -0
  193. package/dist/assets/pdfjs/wasm/jbig2.wasm +0 -0
  194. package/dist/assets/pdfjs/wasm/openjpeg.wasm +0 -0
  195. package/dist/assets/pdfjs/wasm/qcms_bg.wasm +0 -0
  196. package/dist/assets/processing/processing.worker.js +57 -0
  197. package/dist/assets/processing/qpdf.wasm +0 -0
  198. package/dist/element.d.ts +12 -0
  199. package/dist/element.js +0 -0
  200. package/dist/index.d.ts +1286 -0
  201. package/dist/index.js +1 -0
  202. package/dist/lazy/78-EUC-H.bcmap-sYP3SMNV.js +3 -0
  203. package/dist/lazy/78-EUC-V.bcmap-w3SY_Y_q.js +3 -0
  204. package/dist/lazy/78-H.bcmap-CeA2DrtT.js +3 -0
  205. package/dist/lazy/78-RKSJ-H.bcmap-D4cLhL3_.js +3 -0
  206. package/dist/lazy/78-RKSJ-V.bcmap-DdK1ZiTU.js +3 -0
  207. package/dist/lazy/78-V.bcmap-CVoLO4i0.js +3 -0
  208. package/dist/lazy/78ms-RKSJ-H.bcmap-B20DW4UH.js +3 -0
  209. package/dist/lazy/78ms-RKSJ-V.bcmap-CLnY5REh.js +3 -0
  210. package/dist/lazy/83pv-RKSJ-H.bcmap-Ck3Sc38p.js +3 -0
  211. package/dist/lazy/90ms-RKSJ-H.bcmap-C-vgp7Oe.js +3 -0
  212. package/dist/lazy/90ms-RKSJ-V.bcmap-CnYvCBfH.js +3 -0
  213. package/dist/lazy/90msp-RKSJ-H.bcmap-BIx2U_Lw.js +3 -0
  214. package/dist/lazy/90msp-RKSJ-V.bcmap-LSpKnFnA.js +3 -0
  215. package/dist/lazy/90pv-RKSJ-H.bcmap-ohvXiazb.js +3 -0
  216. package/dist/lazy/90pv-RKSJ-V.bcmap-DiMSuPqu.js +3 -0
  217. package/dist/lazy/Add-H.bcmap-D50q_cPt.js +3 -0
  218. package/dist/lazy/Add-RKSJ-H.bcmap-DLQ79XiS.js +3 -0
  219. package/dist/lazy/Add-RKSJ-V.bcmap-DgMvx1Yl.js +3 -0
  220. package/dist/lazy/Add-V.bcmap-njFd39xE.js +3 -0
  221. package/dist/lazy/Adobe-CNS1-0.bcmap-DC9aIYc6.js +3 -0
  222. package/dist/lazy/Adobe-CNS1-1.bcmap-CjXhkA0W.js +3 -0
  223. package/dist/lazy/Adobe-CNS1-2.bcmap-BfDCyJYh.js +3 -0
  224. package/dist/lazy/Adobe-CNS1-3.bcmap-C5_dNXD-.js +3 -0
  225. package/dist/lazy/Adobe-CNS1-4.bcmap-DkB6y9PJ.js +3 -0
  226. package/dist/lazy/Adobe-CNS1-5.bcmap-13hTC0vp.js +3 -0
  227. package/dist/lazy/Adobe-CNS1-6.bcmap-CcQ66yT1.js +3 -0
  228. package/dist/lazy/Adobe-CNS1-UCS2.bcmap-jD7ZNdHN.js +3 -0
  229. package/dist/lazy/Adobe-GB1-0.bcmap-CwfHCw6h.js +3 -0
  230. package/dist/lazy/Adobe-GB1-1.bcmap-DRWrCran.js +3 -0
  231. package/dist/lazy/Adobe-GB1-2.bcmap-0nedEhcq.js +3 -0
  232. package/dist/lazy/Adobe-GB1-3.bcmap-Cq3lCVsW.js +3 -0
  233. package/dist/lazy/Adobe-GB1-4.bcmap-BzTb6Nsg.js +3 -0
  234. package/dist/lazy/Adobe-GB1-5.bcmap-BUHSmz5c.js +3 -0
  235. package/dist/lazy/Adobe-GB1-UCS2.bcmap-DUfIxWQW.js +3 -0
  236. package/dist/lazy/Adobe-Japan1-0.bcmap-BjG9GiRM.js +3 -0
  237. package/dist/lazy/Adobe-Japan1-1.bcmap-DQTj-iQt.js +3 -0
  238. package/dist/lazy/Adobe-Japan1-2.bcmap-BOsCSmmm.js +3 -0
  239. package/dist/lazy/Adobe-Japan1-3.bcmap-ChGf7g8t.js +3 -0
  240. package/dist/lazy/Adobe-Japan1-4.bcmap-CI6iUMgQ.js +3 -0
  241. package/dist/lazy/Adobe-Japan1-5.bcmap-kbwPceJO.js +3 -0
  242. package/dist/lazy/Adobe-Japan1-6.bcmap-CAvvqYpW.js +3 -0
  243. package/dist/lazy/Adobe-Japan1-UCS2.bcmap-DbZiEgfC.js +3 -0
  244. package/dist/lazy/Adobe-Korea1-0.bcmap-Der5jvBG.js +3 -0
  245. package/dist/lazy/Adobe-Korea1-1.bcmap-DafpcUyn.js +3 -0
  246. package/dist/lazy/Adobe-Korea1-2.bcmap-D1nh75yR.js +3 -0
  247. package/dist/lazy/Adobe-Korea1-UCS2.bcmap-CNeMfPHO.js +3 -0
  248. package/dist/lazy/B5-H.bcmap-gyhuoKf7.js +3 -0
  249. package/dist/lazy/B5-V.bcmap-BGqDqEjZ.js +3 -0
  250. package/dist/lazy/B5pc-H.bcmap-C8B_dVbb.js +3 -0
  251. package/dist/lazy/B5pc-V.bcmap-ETo7py2B.js +3 -0
  252. package/dist/lazy/CNS-EUC-H.bcmap-BgwyrNdN.js +3 -0
  253. package/dist/lazy/CNS-EUC-V.bcmap-BbC68G9k.js +3 -0
  254. package/dist/lazy/CNS1-H.bcmap-DZIguuvp.js +3 -0
  255. package/dist/lazy/CNS1-V.bcmap-DjthPwLF.js +3 -0
  256. package/dist/lazy/CNS2-H.bcmap-CTuiQP8Z.js +3 -0
  257. package/dist/lazy/CNS2-V.bcmap-BU5ZzL4C.js +3 -0
  258. package/dist/lazy/ETHK-B5-H.bcmap-AYx-kODg.js +3 -0
  259. package/dist/lazy/ETHK-B5-V.bcmap-C_2Sxwdm.js +3 -0
  260. package/dist/lazy/ETen-B5-H.bcmap-BAKuplan.js +3 -0
  261. package/dist/lazy/ETen-B5-V.bcmap-Dnm6aXlS.js +3 -0
  262. package/dist/lazy/ETenms-B5-H.bcmap-DZ8Y3Rnc.js +3 -0
  263. package/dist/lazy/ETenms-B5-V.bcmap-DPnnTEiA.js +3 -0
  264. package/dist/lazy/EUC-H.bcmap-B1COGDXX.js +3 -0
  265. package/dist/lazy/EUC-V.bcmap-BRvFq5yx.js +3 -0
  266. package/dist/lazy/Ext-H.bcmap-CNU3PCfs.js +3 -0
  267. package/dist/lazy/Ext-RKSJ-H.bcmap-T22CGXk4.js +3 -0
  268. package/dist/lazy/Ext-RKSJ-V.bcmap-K2DXeZ3P.js +3 -0
  269. package/dist/lazy/Ext-V.bcmap-3sNuPEfV.js +3 -0
  270. package/dist/lazy/FoxitDingbats.pfb-DVieKaw5.js +3 -0
  271. package/dist/lazy/FoxitFixed.pfb-Cxgpn9hN.js +3 -0
  272. package/dist/lazy/FoxitFixedBold.pfb-SBojmP3G.js +3 -0
  273. package/dist/lazy/FoxitFixedBoldItalic.pfb-DhsbZ2IP.js +3 -0
  274. package/dist/lazy/FoxitFixedItalic.pfb-Dm09mdyI.js +3 -0
  275. package/dist/lazy/FoxitSerif.pfb-DyMzSE_0.js +3 -0
  276. package/dist/lazy/FoxitSerifBold.pfb-DTzLt76W.js +3 -0
  277. package/dist/lazy/FoxitSerifBoldItalic.pfb-X3fHgghe.js +3 -0
  278. package/dist/lazy/FoxitSerifItalic.pfb-Nz1cnSKc.js +3 -0
  279. package/dist/lazy/FoxitSymbol.pfb-BL-rU8nS.js +3 -0
  280. package/dist/lazy/GB-EUC-H.bcmap-CsgH6-Rh.js +3 -0
  281. package/dist/lazy/GB-EUC-V.bcmap-DUouvrJu.js +3 -0
  282. package/dist/lazy/GB-H.bcmap-CuVli79K.js +3 -0
  283. package/dist/lazy/GB-V.bcmap-C3uPsDRC.js +3 -0
  284. package/dist/lazy/GBK-EUC-H.bcmap-BBDA5YUr.js +3 -0
  285. package/dist/lazy/GBK-EUC-V.bcmap-CjEpjWSW.js +3 -0
  286. package/dist/lazy/GBK2K-H.bcmap-DEJkj1gN.js +3 -0
  287. package/dist/lazy/GBK2K-V.bcmap-NYgNeNsu.js +3 -0
  288. package/dist/lazy/GBKp-EUC-H.bcmap-BIQuHkue.js +3 -0
  289. package/dist/lazy/GBKp-EUC-V.bcmap-BNBPmQ4v.js +3 -0
  290. package/dist/lazy/GBT-EUC-H.bcmap-D7OWs_0J.js +3 -0
  291. package/dist/lazy/GBT-EUC-V.bcmap-D_rNNyCu.js +3 -0
  292. package/dist/lazy/GBT-H.bcmap-B4SLNj_c.js +3 -0
  293. package/dist/lazy/GBT-V.bcmap-Cq6Niv8e.js +3 -0
  294. package/dist/lazy/GBTpc-EUC-H.bcmap-CX8SXrun.js +3 -0
  295. package/dist/lazy/GBTpc-EUC-V.bcmap-hM7BhuwC.js +3 -0
  296. package/dist/lazy/GBpc-EUC-H.bcmap-BIEXt7KG.js +3 -0
  297. package/dist/lazy/GBpc-EUC-V.bcmap-DWeqNOzl.js +3 -0
  298. package/dist/lazy/H.bcmap-DsMNeuh7.js +3 -0
  299. package/dist/lazy/HKdla-B5-H.bcmap-CI5u0d4T.js +3 -0
  300. package/dist/lazy/HKdla-B5-V.bcmap-yk9YM4CN.js +3 -0
  301. package/dist/lazy/HKdlb-B5-H.bcmap-DenLwP2C.js +3 -0
  302. package/dist/lazy/HKdlb-B5-V.bcmap-BKFxIrzq.js +3 -0
  303. package/dist/lazy/HKgccs-B5-H.bcmap-i607pEmt.js +3 -0
  304. package/dist/lazy/HKgccs-B5-V.bcmap-BA9Nvcnu.js +3 -0
  305. package/dist/lazy/HKm314-B5-H.bcmap-BamdAWrg.js +3 -0
  306. package/dist/lazy/HKm314-B5-V.bcmap-JIFeW7D_.js +3 -0
  307. package/dist/lazy/HKm471-B5-H.bcmap-CIOwD0zn.js +3 -0
  308. package/dist/lazy/HKm471-B5-V.bcmap-BkDoTPME.js +3 -0
  309. package/dist/lazy/HKscs-B5-H.bcmap--SdxOf4z.js +3 -0
  310. package/dist/lazy/HKscs-B5-V.bcmap-DmqMO-Th.js +3 -0
  311. package/dist/lazy/Hankaku.bcmap-B2fyvO8A.js +3 -0
  312. package/dist/lazy/Hiragana.bcmap-DP3YLVOE.js +3 -0
  313. package/dist/lazy/KSC-EUC-H.bcmap-DQ5YvjA7.js +3 -0
  314. package/dist/lazy/KSC-EUC-V.bcmap-BNvwGfQX.js +3 -0
  315. package/dist/lazy/KSC-H.bcmap-Ca-HYPS4.js +3 -0
  316. package/dist/lazy/KSC-Johab-H.bcmap-CfF2UvBc.js +3 -0
  317. package/dist/lazy/KSC-Johab-V.bcmap-LBN9I8dg.js +3 -0
  318. package/dist/lazy/KSC-V.bcmap-5U7FPho3.js +3 -0
  319. package/dist/lazy/KSCms-UHC-H.bcmap-CmoPtsRN.js +3 -0
  320. package/dist/lazy/KSCms-UHC-HW-H.bcmap-CVBsfTPV.js +3 -0
  321. package/dist/lazy/KSCms-UHC-HW-V.bcmap-Dv90XUw-.js +3 -0
  322. package/dist/lazy/KSCms-UHC-V.bcmap-BlaojGc1.js +3 -0
  323. package/dist/lazy/KSCpc-EUC-H.bcmap-FrupvwaV.js +3 -0
  324. package/dist/lazy/KSCpc-EUC-V.bcmap-MG3GiZE4.js +3 -0
  325. package/dist/lazy/Katakana.bcmap-C8Bmgyhi.js +3 -0
  326. package/dist/lazy/NWP-H.bcmap-CAdIwPDs.js +3 -0
  327. package/dist/lazy/NWP-V.bcmap-DJ8FpnB4.js +3 -0
  328. package/dist/lazy/RKSJ-H.bcmap-qGRAHcEF.js +3 -0
  329. package/dist/lazy/RKSJ-V.bcmap-Dg3ddxaN.js +3 -0
  330. package/dist/lazy/Roman.bcmap-D4SBc9em.js +3 -0
  331. package/dist/lazy/UniCNS-UCS2-H.bcmap-CAjdESaO.js +3 -0
  332. package/dist/lazy/UniCNS-UCS2-V.bcmap-BHZM4Vzw.js +3 -0
  333. package/dist/lazy/UniCNS-UTF16-H.bcmap-Cm4ZnlrX.js +3 -0
  334. package/dist/lazy/UniCNS-UTF16-V.bcmap-BP1BFVyb.js +3 -0
  335. package/dist/lazy/UniCNS-UTF32-H.bcmap-DGLG7zQ_.js +3 -0
  336. package/dist/lazy/UniCNS-UTF32-V.bcmap-C6v0CIVn.js +3 -0
  337. package/dist/lazy/UniCNS-UTF8-H.bcmap-97YD5l2o.js +3 -0
  338. package/dist/lazy/UniCNS-UTF8-V.bcmap-B_zdNm-u.js +3 -0
  339. package/dist/lazy/UniGB-UCS2-H.bcmap-BcioIbCK.js +3 -0
  340. package/dist/lazy/UniGB-UCS2-V.bcmap-Cu-XDS3_.js +3 -0
  341. package/dist/lazy/UniGB-UTF16-H.bcmap-DPDBbQj_.js +3 -0
  342. package/dist/lazy/UniGB-UTF16-V.bcmap-Bwwxp3b7.js +3 -0
  343. package/dist/lazy/UniGB-UTF32-H.bcmap-D-uBJmmw.js +3 -0
  344. package/dist/lazy/UniGB-UTF32-V.bcmap-CLe_N_q5.js +3 -0
  345. package/dist/lazy/UniGB-UTF8-H.bcmap-CadVYdlJ.js +3 -0
  346. package/dist/lazy/UniGB-UTF8-V.bcmap-B9mD6Kt7.js +3 -0
  347. package/dist/lazy/UniJIS-UCS2-H.bcmap-BaCSu9QA.js +3 -0
  348. package/dist/lazy/UniJIS-UCS2-HW-H.bcmap-CYQj9xSp.js +3 -0
  349. package/dist/lazy/UniJIS-UCS2-HW-V.bcmap-CDzIwh-J.js +3 -0
  350. package/dist/lazy/UniJIS-UCS2-V.bcmap-DqCxM_EZ.js +3 -0
  351. package/dist/lazy/UniJIS-UTF16-H.bcmap-9TPLuUCU.js +3 -0
  352. package/dist/lazy/UniJIS-UTF16-V.bcmap-D6-nIWTQ.js +3 -0
  353. package/dist/lazy/UniJIS-UTF32-H.bcmap-CzmUWSLA.js +3 -0
  354. package/dist/lazy/UniJIS-UTF32-V.bcmap--KhJJEJE.js +3 -0
  355. package/dist/lazy/UniJIS-UTF8-H.bcmap-BwrhFSFd.js +3 -0
  356. package/dist/lazy/UniJIS-UTF8-V.bcmap-DGwbFkaL.js +3 -0
  357. package/dist/lazy/UniJIS2004-UTF16-H.bcmap-CdsS_d3_.js +3 -0
  358. package/dist/lazy/UniJIS2004-UTF16-V.bcmap-BnlV29Vf.js +3 -0
  359. package/dist/lazy/UniJIS2004-UTF32-H.bcmap-DSULVyIs.js +3 -0
  360. package/dist/lazy/UniJIS2004-UTF32-V.bcmap-CzBB970E.js +3 -0
  361. package/dist/lazy/UniJIS2004-UTF8-H.bcmap-BBuoGqhC.js +3 -0
  362. package/dist/lazy/UniJIS2004-UTF8-V.bcmap-dXgQhdTV.js +3 -0
  363. package/dist/lazy/UniJISPro-UCS2-HW-V.bcmap-ePVViljk.js +3 -0
  364. package/dist/lazy/UniJISPro-UCS2-V.bcmap-b2Oljrl4.js +3 -0
  365. package/dist/lazy/UniJISPro-UTF8-V.bcmap-CbPXe9gt.js +3 -0
  366. package/dist/lazy/UniJISX0213-UTF32-H.bcmap-Blmknifg.js +3 -0
  367. package/dist/lazy/UniJISX0213-UTF32-V.bcmap-Dtggmq9y.js +3 -0
  368. package/dist/lazy/UniJISX02132004-UTF32-H.bcmap-3YBd8tyQ.js +3 -0
  369. package/dist/lazy/UniJISX02132004-UTF32-V.bcmap-B8VdB9qS.js +3 -0
  370. package/dist/lazy/UniKS-UCS2-H.bcmap-CIhkpKgh.js +3 -0
  371. package/dist/lazy/UniKS-UCS2-V.bcmap-Cg-GDuqq.js +3 -0
  372. package/dist/lazy/UniKS-UTF16-H.bcmap-EZHb2IFq.js +3 -0
  373. package/dist/lazy/UniKS-UTF16-V.bcmap-BhqhAhYP.js +3 -0
  374. package/dist/lazy/UniKS-UTF32-H.bcmap-Cgay0dIp.js +3 -0
  375. package/dist/lazy/UniKS-UTF32-V.bcmap-DYXyatLV.js +3 -0
  376. package/dist/lazy/UniKS-UTF8-H.bcmap-BvHYimUT.js +3 -0
  377. package/dist/lazy/UniKS-UTF8-V.bcmap-DStcP2w0.js +3 -0
  378. package/dist/lazy/V.bcmap-DuWGSyNm.js +3 -0
  379. package/dist/lazy/WP-Symbol.bcmap-GltcyRl-.js +3 -0
  380. package/dist/lazy/_virtual_hm-pdfjs-data-BSzhlxyq.js +194 -0
  381. package/dist/lazy/jbig2.wasm-CUnHTdWi.js +3 -0
  382. package/dist/lazy/openjpeg.wasm-bdyxAnqz.js +3 -0
  383. package/dist/lazy/processing-worker-CxoVSxEZ.js +30 -0
  384. package/dist/lazy/processing-worker-CxoVSxEZ.js.map +1 -0
  385. package/dist/lazy/render-worker-WgnZ-czI.js +30 -0
  386. package/dist/lazy/render-worker-WgnZ-czI.js.map +1 -0
  387. package/dist/lazy/runtime-G4hlayVF.js +22652 -0
  388. package/dist/lazy/runtime-G4hlayVF.js.map +1 -0
  389. package/dist/react.d.ts +1332 -0
  390. package/dist/react.js +899 -0
  391. package/dist/react.js.map +1 -0
  392. package/dist/shared/en-B0u26URn.js +1244 -0
  393. package/dist/shared/en-B0u26URn.js.map +1 -0
  394. package/dist/styles.css +335 -0
  395. package/package.json +107 -3
@@ -0,0 +1,1332 @@
1
+ /**
2
+ * React editor of the PDF SDK: `PdfEditor`, its building blocks and hooks.
3
+ *
4
+ * @remarks
5
+ * A client entry: it starts with `"use client"`, which the build keeps
6
+ * (ADR 0007). React and React DOM 18.3 or later are optional peer
7
+ * dependencies.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+
12
+ import { FilePolicyOverrides } from '@hussmartinez/sdk-core';
13
+ import { ForwardRefExoticComponent } from 'react';
14
+ import { MessageOverrides } from '@hussmartinez/sdk-core';
15
+ import type { Messages } from '@hussmartinez/sdk-core';
16
+ import { ReactNode } from 'react';
17
+ import { RefAttributes } from 'react';
18
+ import { SdkCoreErrorCode } from '@hussmartinez/sdk-core';
19
+ import { SdkError } from '@hussmartinez/sdk-core';
20
+
21
+ /**
22
+ * Adds an annotation to a page.
23
+ *
24
+ * @public
25
+ */
26
+ declare interface PdfAddAnnotationCommand {
27
+ readonly type: "pdf.addAnnotation";
28
+ /** The page's key. */
29
+ readonly page: string;
30
+ readonly annotation: PdfAnnotation;
31
+ /** Its position among the page's annotations. Defaults to the end. */
32
+ readonly index?: number;
33
+ }
34
+
35
+ /**
36
+ * Anything the editor draws on top of a page until it's flattened on export
37
+ * (ADR 0003). Annotations are plain data, so they can be stored in commands
38
+ * and sent to the processing worker.
39
+ *
40
+ * @public
41
+ */
42
+ declare type PdfAnnotation = PdfStrokeAnnotation | PdfTextAnnotation | PdfImageAnnotation;
43
+
44
+ /**
45
+ * Everything needed to build an output document from the page plan, in one
46
+ * call to the processor (ADR 0003): the sources, the pages in order, and the
47
+ * export options. Plain data, so it crosses the worker boundary as it is.
48
+ *
49
+ * The processor runs the steps in this order, skipping those with nothing to
50
+ * do: fill each source's form values, assemble the pages with their
51
+ * rotations, flatten the annotations, compress, encrypt.
52
+ *
53
+ * @public
54
+ */
55
+ declare interface PdfBuildJob {
56
+ readonly sources: readonly PdfBuildSource[];
57
+ readonly pages: readonly PdfBuildPage[];
58
+ readonly compress?: PdfCompression;
59
+ readonly encrypt?: PdfEncryption;
60
+ }
61
+
62
+ /**
63
+ * Options for {@link PdfProcessor.build}.
64
+ *
65
+ * @public
66
+ */
67
+ declare interface PdfBuildOptions extends PdfTransferOptions {
68
+ /** Called as the build moves through its steps. */
69
+ readonly onProgress?: (progress: PdfBuildProgress) => void;
70
+ }
71
+
72
+ /**
73
+ * One page of the output: a page of a source, with a rotation added to the
74
+ * page's own, and the annotations to draw on it.
75
+ *
76
+ * @public
77
+ */
78
+ declare interface PdfBuildPage {
79
+ /** The {@link PdfBuildSource.id} the page comes from. */
80
+ readonly source: string;
81
+ /** The page's zero-based index in its source. */
82
+ readonly pageIndex: number;
83
+ /** Rotation added to the page's own `/Rotate`. Defaults to 0. */
84
+ readonly rotation?: PdfRotation;
85
+ /** Annotations to flatten into the page's content. */
86
+ readonly annotations?: readonly PdfAnnotation[];
87
+ }
88
+
89
+ /**
90
+ * Progress of a build: the step running now, and the fraction of the whole
91
+ * build that's done, from 0 to 1.
92
+ *
93
+ * @public
94
+ */
95
+ declare interface PdfBuildProgress {
96
+ readonly step: PdfBuildStep;
97
+ readonly fraction: number;
98
+ }
99
+
100
+ /**
101
+ * One source document of a {@link PdfBuildJob}.
102
+ *
103
+ * @public
104
+ */
105
+ declare interface PdfBuildSource {
106
+ /** An identifier, unique within the job, that pages and form values refer to. */
107
+ readonly id: string;
108
+ readonly bytes: PdfBytes;
109
+ /** Form values to fill into this source before its pages are assembled. */
110
+ readonly formValues?: Readonly<Record<string, PdfFieldValue>>;
111
+ }
112
+
113
+ /**
114
+ * The steps of a build, reported as progress.
115
+ *
116
+ * @public
117
+ */
118
+ declare type PdfBuildStep = "fill" | "assemble" | "flatten" | "compress" | "encrypt";
119
+
120
+ /**
121
+ * PDF bytes as callers pass them. A `Uint8Array` may be a view into a larger
122
+ * buffer; only its own bytes are used.
123
+ *
124
+ * @public
125
+ */
126
+ declare type PdfBytes = ArrayBuffer | Uint8Array;
127
+
128
+ /**
129
+ * Options every port call accepts.
130
+ *
131
+ * @public
132
+ */
133
+ declare interface PdfCallOptions {
134
+ /**
135
+ * Cancels the call. It then rejects with a `PdfError` whose code is
136
+ * `ABORTED`, `TIMEOUT`, or the code of an `SdkError` given as the abort
137
+ * reason, such as `PROCESSING_TIME_EXCEEDED`.
138
+ */
139
+ readonly signal?: AbortSignal;
140
+ }
141
+
142
+ /**
143
+ * A colour as `#rrggbb`.
144
+ *
145
+ * @public
146
+ */
147
+ declare type PdfColor = `#${string}`;
148
+
149
+ /**
150
+ * An edit to the page plan (docs/adr/0003). Commands are plain,
151
+ * structured-cloneable data, never carry bytes, and each has an exact
152
+ * inverse, which is how undo works (ADR 0010).
153
+ *
154
+ * @public
155
+ */
156
+ declare type PdfCommand = PdfRotatePagesCommand | PdfDeletePagesCommand | PdfRestorePagesCommand | PdfMovePagesCommand | PdfReorderPagesCommand | PdfInsertPagesCommand | PdfSetFieldValueCommand | PdfAddAnnotationCommand | PdfRemoveAnnotationCommand;
157
+
158
+ /**
159
+ * How to compress the output. Compression is lossless unless `images` is set.
160
+ *
161
+ * @public
162
+ */
163
+ declare interface PdfCompression {
164
+ readonly images?: PdfImageCompression;
165
+ }
166
+
167
+ /**
168
+ * Removes pages from the plan. Their sources stay, so undo can bring them back.
169
+ *
170
+ * @public
171
+ */
172
+ declare interface PdfDeletePagesCommand {
173
+ readonly type: "pdf.deletePages";
174
+ readonly pages: readonly string[];
175
+ }
176
+
177
+ /**
178
+ * An open document. Pages are addressed by zero-based index.
179
+ *
180
+ * @public
181
+ */
182
+ declare interface PdfDocumentHandle {
183
+ /** The number of pages. */
184
+ readonly pageCount: number;
185
+ /**
186
+ * Reads a page's size and rotation.
187
+ *
188
+ * @throws `RangeError` for an index outside the document.
189
+ */
190
+ getPage(pageIndex: number, options?: PdfCallOptions): Promise<PdfPageInfo>;
191
+ /**
192
+ * Draws a page into a canvas, sizing the canvas's pixel dimensions and its
193
+ * CSS `width` and `height`.
194
+ *
195
+ * @throws `RangeError` for an index outside the document.
196
+ */
197
+ renderPage(pageIndex: number, canvas: HTMLCanvasElement, options: PdfRenderOptions): Promise<void>;
198
+ /**
199
+ * Reads a page's text, for the text layer and search.
200
+ *
201
+ * @throws `RangeError` for an index outside the document.
202
+ */
203
+ getTextContent(pageIndex: number, options?: PdfCallOptions): Promise<PdfTextContent>;
204
+ /**
205
+ * Reads the form fields on a page.
206
+ *
207
+ * @throws `RangeError` for an index outside the document.
208
+ */
209
+ getFormFields(pageIndex: number, options?: PdfCallOptions): Promise<readonly PdfFormField[]>;
210
+ /**
211
+ * Reads the links on a page to web pages and email addresses, filtered
212
+ * with `safeLinkUrl` (ADR 0012).
213
+ *
214
+ * @throws `RangeError` for an index outside the document.
215
+ */
216
+ getLinks(pageIndex: number, options?: PdfCallOptions): Promise<readonly PdfLink[]>;
217
+ /** Releases the document. Pending calls reject, and later calls throw. */
218
+ destroy(): Promise<void>;
219
+ }
220
+
221
+ /**
222
+ * The complete editor: a document's pages beside it as thumbnails, with
223
+ * designed states for no document, opening and a failed open (ADR 0014).
224
+ * It creates its own session, through `PdfSessionProvider`, unless one is
225
+ * passed, and releases what it created when it unmounts.
226
+ *
227
+ * Users open a PDF with the button, which keyboard and screen reader users
228
+ * reach like any other, or by dropping it on the editor. Opening and
229
+ * closing are announced, and focus moves to the document once it opens, or
230
+ * to the button to try again if it couldn't.
231
+ *
232
+ * Give the editor a bounded height, such as a grid row or a fixed height:
233
+ * its viewer and thumbnails scroll within it.
234
+ *
235
+ * @example
236
+ * ```tsx
237
+ * const editor = useRef<PdfEditorHandle>(null);
238
+ * <PdfEditor ref={editor} file={file} onChange={({ reason }) => setDirty(reason === "edit")} />;
239
+ * const bytes = await editor.current?.export();
240
+ * ```
241
+ *
242
+ * @public
243
+ */
244
+ export declare const PdfEditor: ForwardRefExoticComponent<PdfEditorProps & RefAttributes<PdfEditorHandle>>;
245
+
246
+ /**
247
+ * What changed in the editor's document, for {@link PdfEditorProps.onChange}.
248
+ *
249
+ * - `open`: a document opened, replacing any other.
250
+ * - `edit`: the document changed: an edit, an insert, an undo or a redo.
251
+ * - `close`: the document closed.
252
+ *
253
+ * @public
254
+ */
255
+ export declare interface PdfEditorChange {
256
+ /** What happened: see {@link PdfEditorChange}. */
257
+ readonly reason: "open" | "edit" | "close";
258
+ /** The document's page count after the change; 0 once it's closed. */
259
+ readonly pageCount: number;
260
+ }
261
+
262
+ /**
263
+ * What a ref to {@link PdfEditor} gives the host.
264
+ *
265
+ * @public
266
+ */
267
+ export declare interface PdfEditorHandle {
268
+ /** The editor's session, for commands and state beyond the handle's. */
269
+ readonly session: PdfSession;
270
+ /** Opens a document, replacing the current one once it has opened. */
271
+ open(file: Blob | PdfBytes): Promise<void>;
272
+ /** Builds the document as it is now. The result is a new buffer the caller owns. */
273
+ export(options?: PdfExportOptions): Promise<Uint8Array>;
274
+ /** Undoes the last edit, if there is one. */
275
+ undo(): void;
276
+ /** Redoes the last undone edit, if there is one. */
277
+ redo(): void;
278
+ /** Closes the document. */
279
+ close(): Promise<void>;
280
+ }
281
+
282
+ /**
283
+ * The parts of `PdfEditor` that take extra classes through `classNames`.
284
+ *
285
+ * @public
286
+ */
287
+ export declare type PdfEditorPart = "root" | "header" | "toolbar" | "body" | "sidebar" | "start" | "status" | "alert";
288
+
289
+ /**
290
+ * Props for {@link PdfEditor}. The session props are the provider's: pass a
291
+ * `session` of your own, or let the editor create one from `engine`,
292
+ * `processor`, `assetsUrl`, `filePolicy` and `onEvent`.
293
+ *
294
+ * @public
295
+ */
296
+ export declare interface PdfEditorProps extends Omit<PdfSessionProviderProps, "children"> {
297
+ /**
298
+ * A document to open. The editor opens it on mount, and again whenever a
299
+ * different file or buffer is passed; `null` closes the document. Files
300
+ * the user opens in the editor don't change this prop.
301
+ */
302
+ readonly file?: Blob | PdfBytes | null;
303
+ /** Called after the document opens, changes or closes. */
304
+ readonly onChange?: (change: PdfEditorChange) => void;
305
+ /** Extra classes on the root. */
306
+ readonly className?: string;
307
+ /** Extra classes on each part. */
308
+ readonly classNames?: Readonly<Partial<Record<PdfEditorPart, string>>>;
309
+ /** Drop the visual styles, keeping layout and accessibility. */
310
+ readonly unstyled?: boolean;
311
+ }
312
+
313
+ /**
314
+ * How to encrypt the output. Encryption is always AES-256.
315
+ *
316
+ * @public
317
+ */
318
+ declare interface PdfEncryption {
319
+ /** The password needed to open the document. */
320
+ readonly userPassword: string;
321
+ /** The password that grants full access. Defaults to the user password. */
322
+ readonly ownerPassword?: string;
323
+ }
324
+
325
+ /**
326
+ * The port for viewing PDFs: open a document, then read and render its pages
327
+ * (ADR 0008). The SDK's pdf.js adapter implements it; hosts can pass their
328
+ * own to the editor's `engine` prop, and every implementation must pass the
329
+ * engine's contract tests.
330
+ *
331
+ * Failures reject with `PdfError`: `INVALID_PDF` for a file that can't be
332
+ * parsed, `PASSWORD_REQUIRED` for an encrypted one, and sdk-core's codes for
333
+ * cancellation and worker failures.
334
+ *
335
+ * @public
336
+ */
337
+ declare interface PdfEngine {
338
+ /**
339
+ * Opens a document. The bytes are copied unless `transfer` is set.
340
+ */
341
+ open(source: PdfBytes, options?: PdfTransferOptions): Promise<PdfDocumentHandle>;
342
+ /** Releases the engine and its worker. Open documents are destroyed. */
343
+ destroy(): Promise<void>;
344
+ }
345
+
346
+ /**
347
+ * The error `@hussmartinez/pdf-sdk` throws and rejects with, with a stable
348
+ * `code`, structured `details` and the engine's error as `cause`. Show users
349
+ * the text for its code from {@link pdfMessages}, never its `message`, which
350
+ * is for developers and may contain text from the file.
351
+ *
352
+ * @example
353
+ * ```ts
354
+ * try {
355
+ * await session.open(file);
356
+ * } catch (error) {
357
+ * if (isPdfError(error, "PASSWORD_REQUIRED")) {
358
+ * askForPassword();
359
+ * } else {
360
+ * show(messages.error(error));
361
+ * }
362
+ * }
363
+ * ```
364
+ *
365
+ * @public
366
+ */
367
+ declare class PdfError extends SdkError<PdfErrorCode> {
368
+ /** Always `"PdfError"`, which survives minification and worker boundaries. */
369
+ readonly name = "PdfError";
370
+ }
371
+
372
+ /**
373
+ * Error codes of `@hussmartinez/pdf-sdk`: sdk-core's own codes, such as
374
+ * `ABORTED`, `WORKER_CRASHED` and `FILE_TOO_LARGE`, plus the PDF SDK's. They
375
+ * never change meaning once released.
376
+ *
377
+ * - `INVALID_PDF`: the file isn't a PDF, or is too damaged to open.
378
+ * - `PASSWORD_REQUIRED`: the PDF is encrypted, and opening it needs a
379
+ * password.
380
+ * - `PROCESSING_FAILED`: a PDF engine failed in a way no other code
381
+ * describes. `cause` holds the engine's error.
382
+ * - `TOO_MANY_PAGES`: a document, or the pages after an insert, exceed the
383
+ * `maxPages` limit.
384
+ * - `SESSION_TOO_LARGE`: the documents the session holds exceed the
385
+ * `maxSessionSize` limit.
386
+ * - `IMAGE_TOO_LARGE`: an image exceeds the `maxImagePixels` limit. It's
387
+ * reported as a warning, because the image is skipped rather than the
388
+ * document failing (ADR 0004).
389
+ *
390
+ * Limit codes carry `details` with the `limit`, its `maximum`, the `actual`
391
+ * value and the `unit`.
392
+ *
393
+ * @public
394
+ */
395
+ declare type PdfErrorCode = SdkCoreErrorCode | "INVALID_PDF" | "PASSWORD_REQUIRED" | "PROCESSING_FAILED" | "TOO_MANY_PAGES" | "SESSION_TOO_LARGE" | "IMAGE_TOO_LARGE";
396
+
397
+ /**
398
+ * Options for {@link PdfSession.export}.
399
+ *
400
+ * @public
401
+ */
402
+ declare interface PdfExportOptions extends PdfCallOptions {
403
+ /** Compress the result, losslessly unless `images` is set. */
404
+ readonly compress?: PdfCompression;
405
+ /** Encrypt the result with AES-256. */
406
+ readonly encrypt?: PdfEncryption;
407
+ /** Called as the export moves through its steps. */
408
+ readonly onProgress?: PdfBuildOptions["onProgress"];
409
+ }
410
+
411
+ /**
412
+ * A form field's value: text for text fields, checked or not for checkboxes.
413
+ *
414
+ * @public
415
+ */
416
+ declare type PdfFieldValue = string | boolean;
417
+
418
+ /**
419
+ * A host's `filePolicy`: a new maximum, or `{ maximum, warning }`, for any of
420
+ * the PDF SDK's limits. `Infinity` disables a maximum, which removes a
421
+ * protection against hostile files, or disables a warning. Unknown limit
422
+ * names throw `TypeError` when the policy is resolved.
423
+ *
424
+ * @example
425
+ * ```ts
426
+ * const filePolicy: PdfFilePolicyOverrides = {
427
+ * maxFileSize: { maximum: 300e6, warning: 100e6 },
428
+ * maxSessionSize: 600e6,
429
+ * };
430
+ * ```
431
+ *
432
+ * @public
433
+ */
434
+ declare type PdfFilePolicyOverrides = FilePolicyOverrides<PdfLimitDefinitions>;
435
+
436
+ /**
437
+ * An AcroForm field widget on a page.
438
+ *
439
+ * @public
440
+ */
441
+ declare interface PdfFormField {
442
+ /** The field's fully qualified name, unique within its document. */
443
+ readonly name: string;
444
+ /** The kind of field. Other kinds are not reported yet. */
445
+ readonly type: "text" | "checkbox";
446
+ /** Where the widget sits on the page. */
447
+ readonly rect: PdfRect;
448
+ /** The value stored in the document. */
449
+ readonly value: PdfFieldValue;
450
+ /** Whether the document marks the field as read-only. */
451
+ readonly readOnly: boolean;
452
+ }
453
+
454
+ /**
455
+ * A drawn signature, or another image, placed on the page.
456
+ *
457
+ * @public
458
+ */
459
+ declare interface PdfImageAnnotation {
460
+ readonly id: string;
461
+ readonly type: "signature";
462
+ /** The top-left corner of the image, in page fractions. */
463
+ readonly at: PdfPoint;
464
+ /** Width, as a fraction of the page's width. */
465
+ readonly width: number;
466
+ /** Height, as a fraction of the page's height. */
467
+ readonly height: number;
468
+ /** The image as PNG bytes. */
469
+ readonly png: Uint8Array;
470
+ }
471
+
472
+ /**
473
+ * Lossy image recompression, on top of lossless compression.
474
+ *
475
+ * @public
476
+ */
477
+ declare interface PdfImageCompression {
478
+ /** JPEG quality, from 0 to 1. */
479
+ readonly quality: number;
480
+ /** The longest image edge to keep, in pixels. Larger images are scaled down. */
481
+ readonly maxDimension: number;
482
+ }
483
+
484
+ /**
485
+ * Options for {@link PdfSession.insert}.
486
+ *
487
+ * @public
488
+ */
489
+ declare interface PdfInsertOptions extends PdfCallOptions {
490
+ /** The position of the first inserted page. Defaults to the end. */
491
+ readonly at?: number;
492
+ /** Zero-based indexes of the pages to insert. Defaults to every page. */
493
+ readonly pageIndexes?: readonly number[];
494
+ }
495
+
496
+ /**
497
+ * Inserts pages of a registered source document. The session registers the
498
+ * source and fills in `keys`, so redo inserts the same pages.
499
+ *
500
+ * @public
501
+ */
502
+ declare interface PdfInsertPagesCommand {
503
+ readonly type: "pdf.insertPages";
504
+ /** The source's ID. */
505
+ readonly source: string;
506
+ /** Zero-based indexes of the source's pages to insert, in order. */
507
+ readonly pageIndexes: readonly number[];
508
+ /** The zero-based position of the first inserted page in the resulting plan. */
509
+ readonly at: number;
510
+ /** The keys of the new pages, one per index. */
511
+ readonly keys: readonly string[];
512
+ }
513
+
514
+ /**
515
+ * The type of {@link pdfLimitDefinitions}.
516
+ *
517
+ * @public
518
+ */
519
+ declare type PdfLimitDefinitions = typeof pdfLimitDefinitions;
520
+
521
+ /**
522
+ * The PDF SDK's limit definitions: sdk-core's core limits plus three for PDFs
523
+ * (ADR 0004).
524
+ *
525
+ * | Limit | Code | Default maximum | Default warning |
526
+ * |---|---|---|---|
527
+ * | `maxFileSize` | `FILE_TOO_LARGE` | 100 MB | 50 MB |
528
+ * | `maxFiles` | `TOO_MANY_FILES` | 20 | none |
529
+ * | `maxDecodedSize` | `DECODED_SIZE_TOO_LARGE` | 500 MB | none |
530
+ * | `maxProcessingTime` | `PROCESSING_TIME_EXCEEDED` | 120 s | none |
531
+ * | `maxPages` | `TOO_MANY_PAGES` | 5,000 | 1,000 |
532
+ * | `maxSessionSize` | `SESSION_TOO_LARGE` | 300 MB | 150 MB |
533
+ * | `maxImagePixels` | `IMAGE_TOO_LARGE` | 100 megapixels | none |
534
+ *
535
+ * Sizes are decimal: 1 MB is 1,000,000 bytes.
536
+ *
537
+ * @public
538
+ */
539
+ declare const pdfLimitDefinitions: {
540
+ readonly maxPages: {
541
+ readonly code: "TOO_MANY_PAGES";
542
+ readonly unit: "count";
543
+ readonly default: 5000;
544
+ readonly warning: 1000;
545
+ };
546
+ readonly maxSessionSize: {
547
+ readonly code: "SESSION_TOO_LARGE";
548
+ readonly unit: "bytes";
549
+ readonly default: 300000000;
550
+ readonly warning: 150000000;
551
+ };
552
+ readonly maxImagePixels: {
553
+ readonly code: "IMAGE_TOO_LARGE";
554
+ readonly unit: "pixels";
555
+ readonly default: 100000000;
556
+ };
557
+ readonly maxFileSize: {
558
+ readonly code: "FILE_TOO_LARGE";
559
+ readonly unit: "bytes";
560
+ readonly default: 100000000;
561
+ readonly warning: 50000000;
562
+ };
563
+ readonly maxFiles: {
564
+ readonly code: "TOO_MANY_FILES";
565
+ readonly unit: "count";
566
+ readonly default: 20;
567
+ };
568
+ readonly maxDecodedSize: {
569
+ readonly code: "DECODED_SIZE_TOO_LARGE";
570
+ readonly unit: "bytes";
571
+ readonly default: 500000000;
572
+ };
573
+ readonly maxProcessingTime: {
574
+ readonly code: "PROCESSING_TIME_EXCEEDED";
575
+ readonly unit: "milliseconds";
576
+ readonly default: 120000;
577
+ };
578
+ };
579
+
580
+ /**
581
+ * The names of the PDF SDK's limits.
582
+ *
583
+ * @public
584
+ */
585
+ declare type PdfLimitName = keyof PdfLimitDefinitions;
586
+
587
+ /**
588
+ * A link on a page to a web page or an email address. Only `http`, `https`
589
+ * and `mailto` links are reported (ADR 0012); links into the document and
590
+ * every other scheme, such as `javascript:`, are left out.
591
+ *
592
+ * @public
593
+ */
594
+ declare interface PdfLink {
595
+ /** Where the link sits on the page, in fractions of the unrotated page. */
596
+ readonly rect: PdfRect;
597
+ /** The absolute URL, normalised. */
598
+ readonly url: string;
599
+ }
600
+
601
+ /**
602
+ * The type of {@link pdfMessages}, for typing a host's overrides with
603
+ * `MessageOverrides<PdfMessageCatalogue>`.
604
+ *
605
+ * @public
606
+ */
607
+ declare type PdfMessageCatalogue = typeof pdfMessages;
608
+
609
+ /**
610
+ * The PDF SDK's English message catalogue: sdk-core's messages, and text for
611
+ * every {@link PdfErrorCode} and every limit's warning. Pass it to
612
+ * `createMessages` from `@hussmartinez/sdk-core`, with the host's locale and
613
+ * overrides.
614
+ *
615
+ * Error text is looked up by code, with the error's `details` as
616
+ * parameters, and never taken from `error.message` (ADR 0019).
617
+ *
618
+ * @example
619
+ * ```ts
620
+ * const messages = createMessages(pdfMessages, { locale: "en", overrides: props.messages });
621
+ * messages.error(error); // "This document has 6,200 pages, which is over the 5,000-page limit."
622
+ * messages.t("warnings.maxPages", { actual: 1_200 });
623
+ * ```
624
+ *
625
+ * @public
626
+ */
627
+ declare const pdfMessages: {
628
+ readonly "errors.INVALID_PDF": "This file isn't a PDF, or it's too damaged to open.";
629
+ readonly "errors.PASSWORD_REQUIRED": "This PDF is protected with a password.";
630
+ readonly "errors.PROCESSING_FAILED": "Something went wrong while processing this PDF. Please try again.";
631
+ readonly "errors.TOO_MANY_PAGES": "This document has {actual, number} pages, which is over the {maximum, number}-page limit.";
632
+ readonly "errors.SESSION_TOO_LARGE": "The open documents would use {actual, fileSize}, which is over the {maximum, fileSize} limit. Close a document, or clear the undo history, and try again.";
633
+ readonly "errors.IMAGE_TOO_LARGE": "Some images are too large to show. They're kept unchanged in the document.";
634
+ readonly "warnings.maxPages": {
635
+ readonly $plural: "actual";
636
+ } & {
637
+ readonly one: "This document has {actual} page. Large documents may be slow.";
638
+ readonly other: "This document has {actual} pages. Large documents may be slow.";
639
+ };
640
+ readonly "warnings.maxSessionSize": "The open documents use {actual, fileSize}. Clearing the undo history frees memory.";
641
+ readonly "warnings.maxImagePixels": "Some images are very large and may be slow to show.";
642
+ readonly "viewer.label": "Document";
643
+ readonly "viewer.empty": "No document is open.";
644
+ readonly "viewer.page": "Page {page} of {count}";
645
+ readonly "viewer.webLink": "Link to {destination}, opens in a new tab";
646
+ readonly "viewer.emailLink": "Email {destination}";
647
+ readonly "thumbnails.label": "Pages";
648
+ readonly "thumbnails.page": "Page {page} of {count}";
649
+ readonly "thumbnails.number": "{page}";
650
+ readonly "editor.label": "PDF editor";
651
+ readonly "editor.start.title": "Open a PDF to get started";
652
+ readonly "editor.start.retryTitle": "Try another PDF";
653
+ readonly "editor.start.choose": "Choose a PDF";
654
+ readonly "editor.start.retry": "Choose another PDF";
655
+ readonly "editor.start.hint": "Or drop one here. Your file stays on this device and is never uploaded.";
656
+ readonly "editor.opening": "Opening the PDF…";
657
+ readonly "editor.opened": {
658
+ readonly $plural: "count";
659
+ } & {
660
+ readonly one: "Opened a PDF with {count} page.";
661
+ readonly other: "Opened a PDF with {count} pages.";
662
+ };
663
+ readonly "editor.closed": "The PDF was closed.";
664
+ readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
665
+ readonly "errors.ABORTED": "The operation was cancelled.";
666
+ readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
667
+ readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
668
+ readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
669
+ readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
670
+ readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
671
+ readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
672
+ readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
673
+ readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
674
+ readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
675
+ readonly "errors.TOO_MANY_FILES": {
676
+ readonly $plural: "maximum";
677
+ } & {
678
+ readonly one: "You can add {maximum} file at a time.";
679
+ readonly other: "You can add up to {maximum} files at a time.";
680
+ };
681
+ readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
682
+ readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
683
+ readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
684
+ readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
685
+ readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
686
+ readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
687
+ readonly "keys.control": "Ctrl";
688
+ readonly "keys.alt": "Alt";
689
+ readonly "keys.shift": "Shift";
690
+ readonly "keys.meta": "Meta";
691
+ readonly "keys.apple.control": "\u2303";
692
+ readonly "keys.apple.alt": "\u2325";
693
+ readonly "keys.apple.shift": "\u21E7";
694
+ readonly "keys.apple.meta": "\u2318";
695
+ readonly "keys.space": "Space";
696
+ readonly "keys.enter": "Enter";
697
+ readonly "keys.escape": "Esc";
698
+ readonly "keys.tab": "Tab";
699
+ readonly "keys.delete": "Delete";
700
+ readonly "keys.backspace": "Backspace";
701
+ readonly "keys.arrowUp": "\u2191";
702
+ readonly "keys.arrowDown": "\u2193";
703
+ readonly "keys.arrowLeft": "\u2190";
704
+ readonly "keys.arrowRight": "\u2192";
705
+ readonly "keys.home": "Home";
706
+ readonly "keys.end": "End";
707
+ readonly "keys.pageUp": "Page Up";
708
+ readonly "keys.pageDown": "Page Down";
709
+ };
710
+
711
+ /**
712
+ * Moves pages, keeping their relative order, so that the first of them ends
713
+ * up at position `to` of the resulting plan.
714
+ *
715
+ * @public
716
+ */
717
+ declare interface PdfMovePagesCommand {
718
+ readonly type: "pdf.movePages";
719
+ readonly pages: readonly string[];
720
+ /** The zero-based position of the first moved page in the resulting plan. */
721
+ readonly to: number;
722
+ }
723
+
724
+ /**
725
+ * Facts about one page of a source document.
726
+ *
727
+ * @public
728
+ */
729
+ declare interface PdfPageInfo {
730
+ /** Width of the unrotated media box, in PDF points (1/72 inch). */
731
+ readonly width: number;
732
+ /** Height of the unrotated media box, in PDF points. */
733
+ readonly height: number;
734
+ /** The page's own rotation, from its `/Rotate` entry. */
735
+ readonly rotation: PdfRotation;
736
+ }
737
+
738
+ /**
739
+ * The document being edited, as a plan over immutable sources
740
+ * (docs/adr/0003): the pages in order, and form values per source. Bytes
741
+ * are only built from it on export.
742
+ *
743
+ * @public
744
+ */
745
+ declare interface PdfPlan {
746
+ readonly pages: readonly PdfPlanPage[];
747
+ /** Form values set in the session, by source ID, then field name. */
748
+ readonly formValues: Readonly<Record<string, Readonly<Record<string, PdfFieldValue>>>>;
749
+ }
750
+
751
+ /**
752
+ * One page of the page plan (docs/adr/0003): a page of a source document,
753
+ * with a rotation added to its own, and the annotations drawn on it. The key
754
+ * is stable while the page moves, so annotations, thumbnails and the
755
+ * selection follow it.
756
+ *
757
+ * @public
758
+ */
759
+ declare interface PdfPlanPage {
760
+ /** Unique within the session, and never reused. */
761
+ readonly key: string;
762
+ /** The ID of the source document the page comes from. */
763
+ readonly source: string;
764
+ /** The page's zero-based index in its source. */
765
+ readonly pageIndex: number;
766
+ /** Rotation added to the page's own `/Rotate`. */
767
+ readonly rotation: PdfRotation;
768
+ /** Annotations drawn on the page, in drawing order. */
769
+ readonly annotations: readonly PdfAnnotation[];
770
+ }
771
+
772
+ /**
773
+ * A point on a page, as fractions of the page's unrotated media box: `x`
774
+ * from the left edge and `y` from the top edge, each from 0 to 1. Fractions
775
+ * keep positions independent of zoom and of the rotation the page is shown
776
+ * with (ADR 0003).
777
+ *
778
+ * @public
779
+ */
780
+ declare interface PdfPoint {
781
+ readonly x: number;
782
+ readonly y: number;
783
+ }
784
+
785
+ /**
786
+ * The port for transforming PDFs: build an output document from sources,
787
+ * pages and export options (ADR 0003, ADR 0008). The SDK's qpdf adapter
788
+ * implements it in a worker; hosts can pass their own to the editor's
789
+ * `processor` prop, and every implementation must pass the processor's
790
+ * contract tests.
791
+ *
792
+ * One call runs the whole pipeline, so the bytes cross the worker boundary
793
+ * once in each direction. Failures reject with `PdfError`.
794
+ *
795
+ * @public
796
+ */
797
+ declare interface PdfProcessor {
798
+ /**
799
+ * Builds a document. The sources' bytes are copied unless `transfer` is
800
+ * set. The result is a new buffer the caller owns.
801
+ *
802
+ * @throws `PdfError` with `INVALID_PDF` when a source can't be read,
803
+ * `PASSWORD_REQUIRED` when one is encrypted, and `TypeError` or
804
+ * `RangeError` for a job that refers to an unknown source or page.
805
+ */
806
+ build(job: PdfBuildJob, options?: PdfBuildOptions): Promise<Uint8Array>;
807
+ /** Releases the processor and its worker. Pending builds reject. */
808
+ destroy(): Promise<void>;
809
+ }
810
+
811
+ /**
812
+ * A rectangle on a page, in the same fractions as {@link PdfPoint}: its
813
+ * top-left corner, width and height.
814
+ *
815
+ * @public
816
+ */
817
+ declare interface PdfRect {
818
+ readonly x: number;
819
+ readonly y: number;
820
+ readonly width: number;
821
+ readonly height: number;
822
+ }
823
+
824
+ /**
825
+ * Removes an annotation from a page.
826
+ *
827
+ * @public
828
+ */
829
+ declare interface PdfRemoveAnnotationCommand {
830
+ readonly type: "pdf.removeAnnotation";
831
+ readonly page: string;
832
+ /** The annotation's ID. */
833
+ readonly id: string;
834
+ }
835
+
836
+ /**
837
+ * How to render a page.
838
+ *
839
+ * @public
840
+ */
841
+ declare interface PdfRenderOptions extends PdfCallOptions {
842
+ /** CSS pixels per PDF point. `1` renders a US Letter page 612 CSS pixels wide. */
843
+ readonly scale: number;
844
+ /**
845
+ * Device pixels per CSS pixel, usually `window.devicePixelRatio`. Defaults
846
+ * to 1. The engine lowers it as needed to stay within
847
+ * {@link PDF_MAX_CANVAS_PIXELS}.
848
+ */
849
+ readonly pixelRatio?: number;
850
+ /** Rotation added to the page's own, for the page plan (ADR 0003). Defaults to 0. */
851
+ readonly rotation?: PdfRotation;
852
+ }
853
+
854
+ /**
855
+ * Puts every page in a new order, given as every key exactly once. It's what
856
+ * undoing a move runs.
857
+ *
858
+ * @public
859
+ */
860
+ declare interface PdfReorderPagesCommand {
861
+ readonly type: "pdf.reorderPages";
862
+ readonly order: readonly string[];
863
+ }
864
+
865
+ /**
866
+ * Puts deleted pages back at their positions. It's what undoing a delete
867
+ * runs, and it can be used directly.
868
+ *
869
+ * @public
870
+ */
871
+ declare interface PdfRestorePagesCommand {
872
+ readonly type: "pdf.restorePages";
873
+ /** Each page, and the index it takes in the resulting plan, in increasing order. */
874
+ readonly entries: readonly {
875
+ readonly index: number;
876
+ readonly page: PdfPlanPage;
877
+ }[];
878
+ }
879
+
880
+ /**
881
+ * Rotates pages by an angle, added to their current rotation.
882
+ *
883
+ * @public
884
+ */
885
+ declare interface PdfRotatePagesCommand {
886
+ readonly type: "pdf.rotatePages";
887
+ /** The keys of the pages to rotate. */
888
+ readonly pages: readonly string[];
889
+ /** Degrees, clockwise, in multiples of 90. Negative turns anticlockwise. */
890
+ readonly angle: number;
891
+ }
892
+
893
+ /**
894
+ * A rotation in degrees, clockwise.
895
+ *
896
+ * @public
897
+ */
898
+ declare type PdfRotation = 0 | 90 | 180 | 270;
899
+
900
+ /**
901
+ * The document being edited, as a framework-agnostic store (ADR 0008): a
902
+ * page plan over the documents opened and inserted, edited with commands,
903
+ * with undo and redo (ADR 0010, docs/adr/0003). React binds to it with
904
+ * `useSyncExternalStore`, and the element binds to the same store.
905
+ *
906
+ * @public
907
+ */
908
+ declare interface PdfSession {
909
+ /** The current snapshot, the same object until something changes. */
910
+ getSnapshot(): PdfSessionSnapshot;
911
+ /** Calls the listener after every change. Returns a function that unsubscribes. */
912
+ subscribe(listener: () => void): () => void;
913
+ /**
914
+ * Opens a document, replacing the current one and its history once it has
915
+ * opened. The file is checked against the file policy before it's read.
916
+ * Rejects with a `PdfError`, which the snapshot also holds; the current
917
+ * document, if any, stays open.
918
+ */
919
+ open(file: Blob | PdfBytes, options?: PdfCallOptions): Promise<void>;
920
+ /**
921
+ * Inserts the pages of another document, as one undoable step. If the
922
+ * documents held would then exceed `maxSessionSize`, the session first
923
+ * drops the redo steps, then the oldest undo steps, as far as needed to
924
+ * release documents only they refer to, and sets `historyTrimmed`. If even
925
+ * that isn't enough, it rejects with `SESSION_TOO_LARGE` and changes
926
+ * nothing.
927
+ */
928
+ insert(file: Blob | PdfBytes, options?: PdfInsertOptions): Promise<void>;
929
+ /**
930
+ * Runs one command, or several as one undoable step. Throws `TypeError`
931
+ * or `RangeError` for a command that doesn't fit the plan, and changes
932
+ * nothing then.
933
+ */
934
+ execute(commands: PdfCommand | readonly PdfCommand[]): void;
935
+ undo(): void;
936
+ redo(): void;
937
+ /** A plan page's size, and its rotation as shown: its own plus the plan's. */
938
+ getPage(key: string, options?: PdfCallOptions): Promise<PdfPageInfo>;
939
+ /** Renders a plan page with its rotation. */
940
+ renderPage(key: string, canvas: HTMLCanvasElement, options: Omit<PdfRenderOptions, "rotation">): Promise<void>;
941
+ /** A plan page's text, positioned on the unrotated page. */
942
+ getTextContent(key: string, options?: PdfCallOptions): Promise<PdfTextContent>;
943
+ /** A plan page's form fields, with the session's values applied. */
944
+ getFormFields(key: string, options?: PdfCallOptions): Promise<readonly PdfFormField[]>;
945
+ /** A plan page's web and email links, positioned on the unrotated page. */
946
+ getLinks(key: string, options?: PdfCallOptions): Promise<readonly PdfLink[]>;
947
+ /**
948
+ * Builds the document as it is now: its pages in plan order, with their
949
+ * rotations, form values and annotations, compressed or encrypted if asked.
950
+ * An unchanged document with no options is returned as its original bytes,
951
+ * without the processor. The result is a new buffer the caller owns.
952
+ */
953
+ export(options?: PdfExportOptions): Promise<Uint8Array>;
954
+ /**
955
+ * Selects pages, by key, replacing the selection. Keys the plan doesn't
956
+ * have are ignored.
957
+ */
958
+ select(keys: readonly string[]): void;
959
+ /** Records the page the user is looking at, as a viewer scrolls. */
960
+ setCurrentPage(key: string): void;
961
+ /** Makes a page current and asks viewers to bring it into view. */
962
+ goToPage(key: string): void;
963
+ /** Closes the document and releases its sources. */
964
+ close(): Promise<void>;
965
+ }
966
+
967
+ /**
968
+ * Anonymous usage events, for a host's analytics (ADR 0010). They never
969
+ * contain file names, contents, form values or annotation text.
970
+ *
971
+ * @public
972
+ */
973
+ declare type PdfSessionEvent = {
974
+ readonly type: "document_opened";
975
+ readonly pageCount: number;
976
+ } | {
977
+ readonly type: "document_closed";
978
+ } | {
979
+ readonly type: "pages_inserted";
980
+ readonly pageCount: number;
981
+ } | {
982
+ readonly type: "command";
983
+ readonly commands: readonly PdfCommand["type"][];
984
+ } | {
985
+ readonly type: "undo";
986
+ } | {
987
+ readonly type: "redo";
988
+ } | {
989
+ readonly type: "document_exported";
990
+ readonly pageCount: number;
991
+ readonly compressed: boolean;
992
+ readonly encrypted: boolean;
993
+ } | {
994
+ readonly type: "failed";
995
+ readonly operation: "open" | "insert" | "export";
996
+ readonly code: string;
997
+ };
998
+
999
+ /**
1000
+ * Makes a PDF session and the SDK's text available to the components and
1001
+ * hooks below it, such as `PdfViewer` and `usePdfDocument` (ADR 0008).
1002
+ *
1003
+ * @example
1004
+ * ```tsx
1005
+ * <PdfSessionProvider locale="de" messages={{ "viewer.empty": "Kein Dokument geöffnet." }}>
1006
+ * <PdfViewer />
1007
+ * </PdfSessionProvider>
1008
+ * ```
1009
+ *
1010
+ * @public
1011
+ */
1012
+ export declare function PdfSessionProvider(props: PdfSessionProviderProps): ReactNode;
1013
+
1014
+ /**
1015
+ * Props for {@link PdfSessionProvider}.
1016
+ *
1017
+ * @public
1018
+ */
1019
+ export declare interface PdfSessionProviderProps {
1020
+ /**
1021
+ * A session you created and own. Without it, the provider creates one,
1022
+ * with the options below, and closes it when it unmounts. The options are
1023
+ * read once, when the provider first renders.
1024
+ */
1025
+ readonly session?: PdfSession;
1026
+ /** The engine for a session the provider creates. Defaults to pdf.js. */
1027
+ readonly engine?: PdfEngine;
1028
+ /** The processor for a session the provider creates. Defaults to qpdf. */
1029
+ readonly processor?: PdfProcessor;
1030
+ /**
1031
+ * Where your application serves the package's `dist/assets/`, for the
1032
+ * default engine and processor (docs/adr/0007). By default, they're inlined.
1033
+ */
1034
+ readonly assetsUrl?: string | URL;
1035
+ /** File limits for a session the provider creates (docs/adr/0004). */
1036
+ readonly filePolicy?: PdfFilePolicyOverrides;
1037
+ /** Anonymous usage events from a session the provider creates. */
1038
+ readonly onEvent?: (event: PdfSessionEvent) => void;
1039
+ /** Text overrides, typed against the English catalogue (ADR 0019). */
1040
+ readonly messages?: MessageOverrides<PdfMessageCatalogue>;
1041
+ /** The locale for numbers, sizes and plurals. Defaults to `"en"`. */
1042
+ readonly locale?: string;
1043
+ /** The components that use the session, such as `PdfViewer`. */
1044
+ readonly children?: ReactNode;
1045
+ }
1046
+
1047
+ /**
1048
+ * The session's state at one moment. Snapshots are immutable: every change
1049
+ * makes a new one, so `useSyncExternalStore` and other subscribers can
1050
+ * compare them by identity.
1051
+ *
1052
+ * @public
1053
+ */
1054
+ declare interface PdfSessionSnapshot {
1055
+ readonly status: PdfSessionStatus;
1056
+ /** The document being edited: its pages, in order, and form values. */
1057
+ readonly plan: PdfPlan;
1058
+ /** The source documents the session holds. */
1059
+ readonly sources: readonly PdfSourceInfo[];
1060
+ readonly canUndo: boolean;
1061
+ readonly canRedo: boolean;
1062
+ /** Whether a document is being opened or inserted. */
1063
+ readonly busy: boolean;
1064
+ /** Why the last open or insert failed. Show its text by its code. */
1065
+ readonly error: PdfError | undefined;
1066
+ /** Limits the open documents are close to. */
1067
+ readonly warnings: readonly PdfWarning[];
1068
+ /**
1069
+ * The bytes of every document the session holds, which the
1070
+ * `maxSessionSize` limit counts: those the plan uses, and those the undo
1071
+ * and redo history can bring back (docs/adr/0004).
1072
+ */
1073
+ readonly sessionBytes: number;
1074
+ /**
1075
+ * Whether undo steps were dropped since the document opened, to make room
1076
+ * for an insert within `maxSessionSize`. Editors say so, because the
1077
+ * earliest edits can no longer be undone (ADR 0010).
1078
+ */
1079
+ readonly historyTrimmed: boolean;
1080
+ /**
1081
+ * The keys of the selected pages, in plan order. Tools act on them, such as
1082
+ * rotating the selection. View state: not undoable, and never in events.
1083
+ */
1084
+ readonly selection: readonly string[];
1085
+ /** The key of the page the user is looking at, if a document is open. */
1086
+ readonly currentPage: string | undefined;
1087
+ /**
1088
+ * The latest request to bring a page into view, from `goToPage`. Viewers
1089
+ * scroll to `page` each time `sequence` changes.
1090
+ */
1091
+ readonly navigation: {
1092
+ readonly page: string;
1093
+ readonly sequence: number;
1094
+ } | undefined;
1095
+ }
1096
+
1097
+ /**
1098
+ * What the session is doing.
1099
+ *
1100
+ * - `empty`: no document is open.
1101
+ * - `opening`: a document is being opened, replacing any other.
1102
+ * - `ready`: a document is open.
1103
+ * - `error`: no document is open, because the last open failed; `error`
1104
+ * says why. A failed open while a document is open keeps that document,
1105
+ * with the status `ready` and `error` set.
1106
+ *
1107
+ * @public
1108
+ */
1109
+ declare type PdfSessionStatus = "empty" | "opening" | "ready" | "error";
1110
+
1111
+ /**
1112
+ * Sets a form field's value in one source, or clears the session's value with
1113
+ * `null`, so the document's own value applies again.
1114
+ *
1115
+ * @public
1116
+ */
1117
+ declare interface PdfSetFieldValueCommand {
1118
+ readonly type: "pdf.setFieldValue";
1119
+ readonly source: string;
1120
+ readonly field: string;
1121
+ readonly value: PdfFieldValue | null;
1122
+ }
1123
+
1124
+ /**
1125
+ * A source document the session holds: opened or inserted, never changed.
1126
+ *
1127
+ * @public
1128
+ */
1129
+ declare interface PdfSourceInfo {
1130
+ /** Unique within the session, and never reused. */
1131
+ readonly id: string;
1132
+ readonly pageCount: number;
1133
+ /** The size of its bytes. */
1134
+ readonly byteLength: number;
1135
+ }
1136
+
1137
+ /**
1138
+ * A freehand pen stroke, or a highlighter stroke, which is drawn translucent.
1139
+ *
1140
+ * @public
1141
+ */
1142
+ declare interface PdfStrokeAnnotation {
1143
+ readonly id: string;
1144
+ readonly type: "pen" | "highlight";
1145
+ /** The stroke's points, in page fractions. */
1146
+ readonly points: readonly PdfPoint[];
1147
+ readonly color: PdfColor;
1148
+ /** Line width, as a fraction of the page's height. */
1149
+ readonly width: number;
1150
+ }
1151
+
1152
+ /**
1153
+ * A text note placed on the page.
1154
+ *
1155
+ * @public
1156
+ */
1157
+ declare interface PdfTextAnnotation {
1158
+ readonly id: string;
1159
+ readonly type: "text";
1160
+ /** The top-left corner of the text, in page fractions. */
1161
+ readonly at: PdfPoint;
1162
+ /** The note's text. It's drawn as text, never interpreted as markup. */
1163
+ readonly text: string;
1164
+ /** Font size, as a fraction of the page's height. */
1165
+ readonly size: number;
1166
+ readonly color: PdfColor;
1167
+ }
1168
+
1169
+ /**
1170
+ * The text of one page, in reading order as the document stores it.
1171
+ *
1172
+ * @public
1173
+ */
1174
+ declare interface PdfTextContent {
1175
+ readonly items: readonly PdfTextItem[];
1176
+ }
1177
+
1178
+ /**
1179
+ * A run of text on a page, for the text layer, selection, assistive
1180
+ * technology and search. Positions are fractions of the unrotated media box
1181
+ * ({@link PdfRect}).
1182
+ *
1183
+ * @public
1184
+ */
1185
+ declare interface PdfTextItem {
1186
+ /** The text, as the document encodes it. Always rendered as text, never as markup. */
1187
+ readonly text: string;
1188
+ /** The box the text occupies. */
1189
+ readonly rect: PdfRect;
1190
+ /** Rotation of the text's baseline, in degrees, counter-clockwise. */
1191
+ readonly angle: number;
1192
+ /** Whether a line break follows this item. */
1193
+ readonly endOfLine: boolean;
1194
+ }
1195
+
1196
+ /**
1197
+ * A column of page thumbnails to see the whole document and choose pages
1198
+ * (ADR 0014): a listbox with several pages selectable, where the selection
1199
+ * follows focus and the chosen page is brought into view in `PdfViewer`.
1200
+ * Like the viewer, it only draws the thumbnails near its viewport.
1201
+ *
1202
+ * Keyboard: the arrow keys, Home and End move to a page, select it and show
1203
+ * it; with Shift they extend the selection; with Ctrl or ⌘ they move without
1204
+ * selecting, and Space then adds or removes the page. Ctrl or ⌘ + A selects
1205
+ * every page, and Escape keeps only the focused one. With a pointer: click,
1206
+ * Ctrl or ⌘ + click, and Shift + click.
1207
+ *
1208
+ * @public
1209
+ */
1210
+ export declare function PdfThumbnails(props: PdfThumbnailsProps): ReactNode;
1211
+
1212
+ /**
1213
+ * The parts of `PdfThumbnails` that take extra classes through `classNames`.
1214
+ *
1215
+ * @public
1216
+ */
1217
+ export declare type PdfThumbnailsPart = "root" | "thumbnail" | "frame" | "canvas" | "number";
1218
+
1219
+ /**
1220
+ * Props for {@link PdfThumbnails}.
1221
+ *
1222
+ * @public
1223
+ */
1224
+ export declare interface PdfThumbnailsProps {
1225
+ /** Extra classes on the root. */
1226
+ readonly className?: string;
1227
+ /** Extra classes on each part. */
1228
+ readonly classNames?: Readonly<Partial<Record<PdfThumbnailsPart, string>>>;
1229
+ /** Drop the visual styles, keeping layout and accessibility. */
1230
+ readonly unstyled?: boolean;
1231
+ /** How many thumbnails are drawn at once. Defaults to 2. */
1232
+ readonly concurrency?: number;
1233
+ }
1234
+
1235
+ /**
1236
+ * Options for calls that take PDF bytes.
1237
+ *
1238
+ * @public
1239
+ */
1240
+ declare interface PdfTransferOptions extends PdfCallOptions {
1241
+ /**
1242
+ * Hand the bytes' buffers to the worker instead of copying them. The
1243
+ * caller's buffers are detached and must not be used afterwards. Defaults
1244
+ * to `false`, so a caller's bytes are never detached by surprise.
1245
+ */
1246
+ readonly transfer?: boolean;
1247
+ }
1248
+
1249
+ /**
1250
+ * Shows the session's pages in a scrolling column (docs/adr/0003): each page
1251
+ * keeps its place at the right size, and only pages near the viewport are
1252
+ * drawn, a few at a time. Pages that scroll away are cancelled or give their
1253
+ * pixels back. The text is selectable, for copying and for screen readers,
1254
+ * and links are real links, limited to safe URLs and labelled with where
1255
+ * they lead (ADR 0012, ADR 0014).
1256
+ *
1257
+ * The viewer is a focusable region, so keyboard users scroll it with the
1258
+ * arrow, Page Up, Page Down, Home and End keys.
1259
+ *
1260
+ * @public
1261
+ */
1262
+ export declare function PdfViewer(props: PdfViewerProps): ReactNode;
1263
+
1264
+ /**
1265
+ * Extra classes for each part of `PdfViewer`.
1266
+ *
1267
+ * @public
1268
+ */
1269
+ export declare type PdfViewerClassNames = Readonly<Partial<Record<PdfViewerPart, string>>>;
1270
+
1271
+ /**
1272
+ * The parts of `PdfViewer` that take extra classes through `classNames`.
1273
+ *
1274
+ * @public
1275
+ */
1276
+ export declare type PdfViewerPart = "root" | "pages" | "page" | "canvas" | "textLayer" | "linkLayer" | "link" | "error" | "empty";
1277
+
1278
+ /**
1279
+ * Props for {@link PdfViewer}.
1280
+ *
1281
+ * @public
1282
+ */
1283
+ export declare interface PdfViewerProps {
1284
+ /** Extra classes on the root. */
1285
+ readonly className?: string;
1286
+ /** Extra classes on each part. */
1287
+ readonly classNames?: PdfViewerClassNames;
1288
+ /** Drop the visual styles, keeping layout and accessibility. */
1289
+ readonly unstyled?: boolean;
1290
+ /** Page width relative to the viewer's width. Defaults to 1, fitting the width. */
1291
+ readonly zoom?: number;
1292
+ /** How many page renders run at once. Defaults to 2. */
1293
+ readonly concurrency?: number;
1294
+ }
1295
+
1296
+ /**
1297
+ * A file policy warning: a value at or above a limit's warning threshold,
1298
+ * but within its maximum (ADR 0020). Show its text from
1299
+ * `warnings.<limit>` in the message catalogue, with `actual` as a parameter.
1300
+ *
1301
+ * @public
1302
+ */
1303
+ declare interface PdfWarning {
1304
+ readonly limit: PdfLimitName;
1305
+ readonly actual: number;
1306
+ }
1307
+
1308
+ /**
1309
+ * The session's current snapshot, re-rendering whenever it changes, through
1310
+ * `useSyncExternalStore`, so it's safe with concurrent rendering and server
1311
+ * rendering (ADR 0008).
1312
+ *
1313
+ * @public
1314
+ */
1315
+ export declare function usePdfDocument(): PdfSessionSnapshot;
1316
+
1317
+ /**
1318
+ * The SDK's text for the provider's locale and overrides (ADR 0019).
1319
+ *
1320
+ * @public
1321
+ */
1322
+ export declare function usePdfMessages(): Messages<PdfMessageCatalogue>;
1323
+
1324
+ /**
1325
+ * The session of the nearest `PdfSessionProvider`, to open documents, run
1326
+ * commands, undo and export.
1327
+ *
1328
+ * @public
1329
+ */
1330
+ export declare function usePdfSession(): PdfSession;
1331
+
1332
+ export { }