@hussmartinez/pdf-sdk 0.0.0-stage → 0.2.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 +119 -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 +1304 -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-DU8GEYFs.js +30 -0
  384. package/dist/lazy/processing-worker-DU8GEYFs.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 +1587 -0
  390. package/dist/react.js +1157 -0
  391. package/dist/react.js.map +1 -0
  392. package/dist/shared/en-BYB_GHqG.js +1265 -0
  393. package/dist/shared/en-BYB_GHqG.js.map +1 -0
  394. package/dist/styles.css +337 -0
  395. package/package.json +111 -3
@@ -0,0 +1,1587 @@
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 { IconComponent } from '@hussmartinez/ui/react';
15
+ import { MessageOverrides } from '@hussmartinez/sdk-core';
16
+ import type { Messages } from '@hussmartinez/sdk-core';
17
+ import { ReactNode } from 'react';
18
+ import { RefAttributes } from 'react';
19
+ import { SdkCoreErrorCode } from '@hussmartinez/sdk-core';
20
+ import { SdkError } from '@hussmartinez/sdk-core';
21
+ import type { ShortcutRegistry } from '@hussmartinez/sdk-core';
22
+ import type { Tool } from '@hussmartinez/sdk-core';
23
+ import type { ToolRegistry } from '@hussmartinez/sdk-core';
24
+
25
+ /**
26
+ * Adds an annotation to a page.
27
+ *
28
+ * @public
29
+ */
30
+ declare interface PdfAddAnnotationCommand {
31
+ readonly type: "pdf.addAnnotation";
32
+ /** The page's key. */
33
+ readonly page: string;
34
+ readonly annotation: PdfAnnotation;
35
+ /** Its position among the page's annotations. Defaults to the end. */
36
+ readonly index?: number;
37
+ }
38
+
39
+ /**
40
+ * Anything the editor draws on top of a page until it's flattened on export
41
+ * (ADR 0003). Annotations are plain data, so they can be stored in commands
42
+ * and sent to the processing worker.
43
+ *
44
+ * @public
45
+ */
46
+ declare type PdfAnnotation = PdfStrokeAnnotation | PdfTextAnnotation | PdfImageAnnotation;
47
+
48
+ /**
49
+ * Everything needed to build an output document from the page plan, in one
50
+ * call to the processor (ADR 0003): the sources, the pages in order, and the
51
+ * export options. Plain data, so it crosses the worker boundary as it is.
52
+ *
53
+ * The processor runs the steps in this order, skipping those with nothing to
54
+ * do: fill each source's form values, assemble the pages with their
55
+ * rotations, flatten the annotations, compress, encrypt.
56
+ *
57
+ * @public
58
+ */
59
+ declare interface PdfBuildJob {
60
+ readonly sources: readonly PdfBuildSource[];
61
+ readonly pages: readonly PdfBuildPage[];
62
+ readonly compress?: PdfCompression;
63
+ readonly encrypt?: PdfEncryption;
64
+ }
65
+
66
+ /**
67
+ * Options for {@link PdfProcessor.build}.
68
+ *
69
+ * @public
70
+ */
71
+ declare interface PdfBuildOptions extends PdfTransferOptions {
72
+ /** Called as the build moves through its steps. */
73
+ readonly onProgress?: (progress: PdfBuildProgress) => void;
74
+ }
75
+
76
+ /**
77
+ * One page of the output: a page of a source, with a rotation added to the
78
+ * page's own, and the annotations to draw on it.
79
+ *
80
+ * @public
81
+ */
82
+ declare interface PdfBuildPage {
83
+ /** The {@link PdfBuildSource.id} the page comes from. */
84
+ readonly source: string;
85
+ /** The page's zero-based index in its source. */
86
+ readonly pageIndex: number;
87
+ /** Rotation added to the page's own `/Rotate`. Defaults to 0. */
88
+ readonly rotation?: PdfRotation;
89
+ /** Annotations to flatten into the page's content. */
90
+ readonly annotations?: readonly PdfAnnotation[];
91
+ }
92
+
93
+ /**
94
+ * Progress of a build: the step running now, and the fraction of the whole
95
+ * build that's done, from 0 to 1.
96
+ *
97
+ * @public
98
+ */
99
+ declare interface PdfBuildProgress {
100
+ readonly step: PdfBuildStep;
101
+ readonly fraction: number;
102
+ }
103
+
104
+ /**
105
+ * One source document of a {@link PdfBuildJob}.
106
+ *
107
+ * @public
108
+ */
109
+ declare interface PdfBuildSource {
110
+ /** An identifier, unique within the job, that pages and form values refer to. */
111
+ readonly id: string;
112
+ readonly bytes: PdfBytes;
113
+ /** Form values to fill into this source before its pages are assembled. */
114
+ readonly formValues?: Readonly<Record<string, PdfFieldValue>>;
115
+ }
116
+
117
+ /**
118
+ * The steps of a build, reported as progress.
119
+ *
120
+ * @public
121
+ */
122
+ declare type PdfBuildStep = "fill" | "assemble" | "flatten" | "compress" | "encrypt";
123
+
124
+ /**
125
+ * PDF bytes as callers pass them. A `Uint8Array` may be a view into a larger
126
+ * buffer; only its own bytes are used.
127
+ *
128
+ * @public
129
+ */
130
+ declare type PdfBytes = ArrayBuffer | Uint8Array;
131
+
132
+ /**
133
+ * Options every port call accepts.
134
+ *
135
+ * @public
136
+ */
137
+ declare interface PdfCallOptions {
138
+ /**
139
+ * Cancels the call. It then rejects with a `PdfError` whose code is
140
+ * `ABORTED`, `TIMEOUT`, or the code of an `SdkError` given as the abort
141
+ * reason, such as `PROCESSING_TIME_EXCEEDED`.
142
+ */
143
+ readonly signal?: AbortSignal;
144
+ }
145
+
146
+ /**
147
+ * A colour as `#rrggbb`.
148
+ *
149
+ * @public
150
+ */
151
+ declare type PdfColor = `#${string}`;
152
+
153
+ /**
154
+ * An edit to the page plan (docs/adr/0003). Commands are plain,
155
+ * structured-cloneable data, never carry bytes, and each has an exact
156
+ * inverse, which is how undo works (ADR 0010).
157
+ *
158
+ * @public
159
+ */
160
+ declare type PdfCommand = PdfRotatePagesCommand | PdfDeletePagesCommand | PdfRestorePagesCommand | PdfMovePagesCommand | PdfReorderPagesCommand | PdfInsertPagesCommand | PdfSetFieldValueCommand | PdfAddAnnotationCommand | PdfRemoveAnnotationCommand;
161
+
162
+ /**
163
+ * How to compress the output. Compression is lossless unless `images` is set.
164
+ *
165
+ * @public
166
+ */
167
+ declare interface PdfCompression {
168
+ readonly images?: PdfImageCompression;
169
+ }
170
+
171
+ /**
172
+ * Removes pages from the plan. Their sources stay, so undo can bring them back.
173
+ *
174
+ * @public
175
+ */
176
+ declare interface PdfDeletePagesCommand {
177
+ readonly type: "pdf.deletePages";
178
+ readonly pages: readonly string[];
179
+ }
180
+
181
+ /**
182
+ * An open document. Pages are addressed by zero-based index.
183
+ *
184
+ * @public
185
+ */
186
+ declare interface PdfDocumentHandle {
187
+ /** The number of pages. */
188
+ readonly pageCount: number;
189
+ /**
190
+ * Reads a page's size and rotation.
191
+ *
192
+ * @throws `RangeError` for an index outside the document.
193
+ */
194
+ getPage(pageIndex: number, options?: PdfCallOptions): Promise<PdfPageInfo>;
195
+ /**
196
+ * Draws a page into a canvas, sizing the canvas's pixel dimensions and its
197
+ * CSS `width` and `height`.
198
+ *
199
+ * @throws `RangeError` for an index outside the document.
200
+ */
201
+ renderPage(pageIndex: number, canvas: HTMLCanvasElement, options: PdfRenderOptions): Promise<void>;
202
+ /**
203
+ * Reads a page's text, for the text layer and search.
204
+ *
205
+ * @throws `RangeError` for an index outside the document.
206
+ */
207
+ getTextContent(pageIndex: number, options?: PdfCallOptions): Promise<PdfTextContent>;
208
+ /**
209
+ * Reads the form fields on a page.
210
+ *
211
+ * @throws `RangeError` for an index outside the document.
212
+ */
213
+ getFormFields(pageIndex: number, options?: PdfCallOptions): Promise<readonly PdfFormField[]>;
214
+ /**
215
+ * Reads the links on a page to web pages and email addresses, filtered
216
+ * with `safeLinkUrl` (ADR 0012).
217
+ *
218
+ * @throws `RangeError` for an index outside the document.
219
+ */
220
+ getLinks(pageIndex: number, options?: PdfCallOptions): Promise<readonly PdfLink[]>;
221
+ /** Releases the document. Pending calls reject, and later calls throw. */
222
+ destroy(): Promise<void>;
223
+ }
224
+
225
+ /**
226
+ * The complete editor: a document's pages beside it as thumbnails, with
227
+ * designed states for no document, opening and a failed open (ADR 0014).
228
+ * It creates its own session, through `PdfSessionProvider`, unless one is
229
+ * passed, and releases what it created when it unmounts.
230
+ *
231
+ * Users open a PDF with the button, which keyboard and screen reader users
232
+ * reach like any other, or by dropping it on the editor. Opening and
233
+ * closing are announced, and focus moves to the document once it opens, or
234
+ * to the button to try again if it couldn't.
235
+ *
236
+ * Its toolbar is built from {@link pdfTools}: choose them with `tools` and
237
+ * arrange them with `toolbar`. Each tool's shortcut works while focus is in
238
+ * the editor, and undoing, redoing and rotating are announced.
239
+ *
240
+ * Load `@hussmartinez/ui/styles.css` once, before the SDK's stylesheet: the
241
+ * toolbar's focus rings and target sizes are in it (sdk-core ADR 0036).
242
+ *
243
+ * Give the editor a bounded height, such as a grid row or a fixed height:
244
+ * its viewer and thumbnails scroll within it.
245
+ *
246
+ * @example
247
+ * ```tsx
248
+ * const editor = useRef<PdfEditorHandle>(null);
249
+ * <PdfEditor ref={editor} file={file} onChange={({ reason }) => setDirty(reason === "edit")} />;
250
+ * const bytes = await editor.current?.export();
251
+ * ```
252
+ *
253
+ * @public
254
+ */
255
+ export declare const PdfEditor: ForwardRefExoticComponent<PdfEditorProps & RefAttributes<PdfEditorHandle>>;
256
+
257
+ /**
258
+ * What changed in the editor's document, for {@link PdfEditorProps.onChange}.
259
+ *
260
+ * - `open`: a document opened, replacing any other.
261
+ * - `edit`: the document changed: an edit, an insert, an undo or a redo.
262
+ * - `close`: the document closed.
263
+ *
264
+ * @public
265
+ */
266
+ export declare interface PdfEditorChange {
267
+ /** What happened: see {@link PdfEditorChange}. */
268
+ readonly reason: "open" | "edit" | "close";
269
+ /** The document's page count after the change; 0 once it's closed. */
270
+ readonly pageCount: number;
271
+ }
272
+
273
+ /**
274
+ * What a ref to {@link PdfEditor} gives the host.
275
+ *
276
+ * @public
277
+ */
278
+ export declare interface PdfEditorHandle {
279
+ /** The editor's session, for commands and state beyond the handle's. */
280
+ readonly session: PdfSession;
281
+ /** Opens a document, replacing the current one once it has opened. */
282
+ open(file: Blob | PdfBytes): Promise<void>;
283
+ /** Builds the document as it is now. The result is a new buffer the caller owns. */
284
+ export(options?: PdfExportOptions): Promise<Uint8Array>;
285
+ /** Undoes the last edit, if there is one. */
286
+ undo(): void;
287
+ /** Redoes the last undone edit, if there is one. */
288
+ redo(): void;
289
+ /** Closes the document. */
290
+ close(): Promise<void>;
291
+ }
292
+
293
+ /**
294
+ * The type of {@link pdfEditorMessages}, for typing the editor's `messages`
295
+ * overrides with `MessageOverrides<PdfEditorMessageCatalogue>`.
296
+ *
297
+ * @public
298
+ */
299
+ export declare type PdfEditorMessageCatalogue = typeof pdfEditorMessages;
300
+
301
+ /**
302
+ * The editor's English message catalogue: the SDK's own, which includes
303
+ * sdk-core's, and `@hussmartinez/ui`'s, for the ui components the editor
304
+ * renders (sdk-core ADR 0046). The editor builds one `Messages` object from
305
+ * it, with the host's locale and overrides, and gives the same object to
306
+ * its own components and to ui's.
307
+ *
308
+ * It's defined in the React entry, so the headless `.` entry and its
309
+ * `pdfMessages` don't carry ui's text.
310
+ *
311
+ * @public
312
+ */
313
+ export declare const pdfEditorMessages: {
314
+ readonly "dialog.close": "Close";
315
+ readonly "fileDropZone.choose": "Choose a file";
316
+ readonly "fileDropZone.chooseMultiple": "Choose files";
317
+ readonly "fileDropZone.hint": "or drop it here";
318
+ readonly "fileDropZone.hintMultiple": "or drop them here";
319
+ readonly "progress.label": "Progress";
320
+ readonly "spinner.label": "Loading";
321
+ readonly "errors.INVALID_THEME_TOKEN": "The theme setting {token} has a value that can't be used.";
322
+ readonly "errors.INVALID_THEME_SELECTOR": "The theme can't be applied to the selector {selector}.";
323
+ readonly "errors.INVALID_PDF": "This file isn't a PDF, or it's too damaged to open.";
324
+ readonly "errors.PASSWORD_REQUIRED": "This PDF is protected with a password.";
325
+ readonly "errors.PROCESSING_FAILED": "Something went wrong while processing this PDF. Please try again.";
326
+ readonly "errors.TOO_MANY_PAGES": "This document has {actual, number} pages, which is over the {maximum, number}-page limit.";
327
+ 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.";
328
+ readonly "errors.IMAGE_TOO_LARGE": "Some images are too large to show. They're kept unchanged in the document.";
329
+ readonly "warnings.maxPages": {
330
+ readonly $plural: "actual";
331
+ } & {
332
+ readonly one: "This document has {actual} page. Large documents may be slow.";
333
+ readonly other: "This document has {actual} pages. Large documents may be slow.";
334
+ };
335
+ readonly "warnings.maxSessionSize": "The open documents use {actual, fileSize}. Clearing the undo history frees memory.";
336
+ readonly "warnings.maxImagePixels": "Some images are very large and may be slow to show.";
337
+ readonly "viewer.label": "Document";
338
+ readonly "viewer.empty": "No document is open.";
339
+ readonly "viewer.page": "Page {page} of {count}";
340
+ readonly "viewer.webLink": "Link to {destination}, opens in a new tab";
341
+ readonly "viewer.emailLink": "Email {destination}";
342
+ readonly "thumbnails.label": "Pages";
343
+ readonly "thumbnails.page": "Page {page} of {count}";
344
+ readonly "thumbnails.number": "{page}";
345
+ readonly "editor.label": "PDF editor";
346
+ readonly "editor.start.title": "Open a PDF to get started";
347
+ readonly "editor.start.retryTitle": "Try another PDF";
348
+ readonly "editor.start.choose": "Choose a PDF";
349
+ readonly "editor.start.retry": "Choose another PDF";
350
+ readonly "editor.start.hint": "Or drop one here. Your file stays on this device and is never uploaded.";
351
+ readonly "editor.opening": "Opening the PDF…";
352
+ readonly "editor.opened": {
353
+ readonly $plural: "count";
354
+ } & {
355
+ readonly one: "Opened a PDF with {count} page.";
356
+ readonly other: "Opened a PDF with {count} pages.";
357
+ };
358
+ readonly "editor.closed": "The PDF was closed.";
359
+ readonly "editor.undone": "Undone.";
360
+ readonly "editor.redone": "Redone.";
361
+ readonly "editor.rotated": {
362
+ readonly $plural: "count";
363
+ } & {
364
+ readonly one: "Rotated {count} page.";
365
+ readonly other: "Rotated {count} pages.";
366
+ };
367
+ readonly "toolbar.label": "PDF tools";
368
+ readonly "toolbar.groups.file": "File";
369
+ readonly "toolbar.groups.history": "History";
370
+ readonly "toolbar.groups.pages": "Pages";
371
+ readonly "toolbar.groups.other": "More tools";
372
+ readonly "tools.open": "Open a PDF";
373
+ readonly "tools.undo": "Undo";
374
+ readonly "tools.redo": "Redo";
375
+ readonly "tools.rotate-left": "Rotate left";
376
+ readonly "tools.rotate-right": "Rotate right";
377
+ readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
378
+ readonly "errors.ABORTED": "The operation was cancelled.";
379
+ readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
380
+ readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
381
+ readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
382
+ readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
383
+ readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
384
+ readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
385
+ readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
386
+ readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
387
+ readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
388
+ readonly "errors.TOO_MANY_FILES": {
389
+ readonly $plural: "maximum";
390
+ } & {
391
+ readonly one: "You can add {maximum} file at a time.";
392
+ readonly other: "You can add up to {maximum} files at a time.";
393
+ };
394
+ readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
395
+ readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
396
+ readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
397
+ readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
398
+ readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
399
+ readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
400
+ readonly "keys.control": "Ctrl";
401
+ readonly "keys.alt": "Alt";
402
+ readonly "keys.shift": "Shift";
403
+ readonly "keys.meta": "Meta";
404
+ readonly "keys.apple.control": "\u2303";
405
+ readonly "keys.apple.alt": "\u2325";
406
+ readonly "keys.apple.shift": "\u21E7";
407
+ readonly "keys.apple.meta": "\u2318";
408
+ readonly "keys.space": "Space";
409
+ readonly "keys.enter": "Enter";
410
+ readonly "keys.escape": "Esc";
411
+ readonly "keys.tab": "Tab";
412
+ readonly "keys.delete": "Delete";
413
+ readonly "keys.backspace": "Backspace";
414
+ readonly "keys.arrowUp": "\u2191";
415
+ readonly "keys.arrowDown": "\u2193";
416
+ readonly "keys.arrowLeft": "\u2190";
417
+ readonly "keys.arrowRight": "\u2192";
418
+ readonly "keys.home": "Home";
419
+ readonly "keys.end": "End";
420
+ readonly "keys.pageUp": "Page Up";
421
+ readonly "keys.pageDown": "Page Down";
422
+ };
423
+
424
+ /**
425
+ * The parts of `PdfEditor` that take extra classes through `classNames`.
426
+ *
427
+ * @public
428
+ */
429
+ export declare type PdfEditorPart = "root" | "header" | "toolbar" | "body" | "sidebar" | "start" | "status" | "alert";
430
+
431
+ /**
432
+ * Props for {@link PdfEditor}. The session props are the provider's: pass a
433
+ * `session` of your own, or let the editor create one from `engine`,
434
+ * `processor`, `assetsUrl`, `filePolicy` and `onEvent`.
435
+ *
436
+ * @public
437
+ */
438
+ export declare interface PdfEditorProps extends Omit<PdfSessionProviderProps, "children" | "messages"> {
439
+ /**
440
+ * Text overrides, typed against the editor's English catalogue, which
441
+ * includes ui's text for the ui components it renders (sdk-core ADR 0046).
442
+ */
443
+ readonly messages?: MessageOverrides<PdfEditorMessageCatalogue>;
444
+ /**
445
+ * A document to open. The editor opens it on mount, and again whenever a
446
+ * different file or buffer is passed; `null` closes the document. Files
447
+ * the user opens in the editor don't change this prop.
448
+ */
449
+ readonly file?: Blob | PdfBytes | null;
450
+ /** Called after the document opens, changes or closes. */
451
+ readonly onChange?: (change: PdfEditorChange) => void;
452
+ /**
453
+ * Which tools are present, by id, in order, such as
454
+ * `["pdf.undo", "pdf.redo"]`. All of {@link pdfTools} by default. Their
455
+ * shortcuts work only while they're present.
456
+ */
457
+ readonly tools?: readonly string[];
458
+ /**
459
+ * The toolbar's groups, as tool ids, such as
460
+ * `[["pdf.undo", "pdf.redo"], ["pdf.rotate-left", "pdf.rotate-right"]]`.
461
+ * Defaults to the present tools in their usual groups; `[]` hides the
462
+ * toolbar, keeping the shortcuts. An unknown id throws.
463
+ */
464
+ readonly toolbar?: readonly (readonly string[])[];
465
+ /** Icon components by name, over the SDK's own from ui. */
466
+ readonly icons?: Readonly<Record<string, IconComponent>>;
467
+ /** Extra classes on the root. */
468
+ readonly className?: string;
469
+ /** Extra classes on each part. */
470
+ readonly classNames?: Readonly<Partial<Record<PdfEditorPart, string>>>;
471
+ /** Drop the visual styles, keeping layout and accessibility. */
472
+ readonly unstyled?: boolean;
473
+ }
474
+
475
+ /**
476
+ * How to encrypt the output. Encryption is always AES-256.
477
+ *
478
+ * @public
479
+ */
480
+ declare interface PdfEncryption {
481
+ /** The password needed to open the document. */
482
+ readonly userPassword: string;
483
+ /** The password that grants full access. Defaults to the user password. */
484
+ readonly ownerPassword?: string;
485
+ }
486
+
487
+ /**
488
+ * The port for viewing PDFs: open a document, then read and render its pages
489
+ * (ADR 0008). The SDK's pdf.js adapter implements it; hosts can pass their
490
+ * own to the editor's `engine` prop, and every implementation must pass the
491
+ * engine's contract tests.
492
+ *
493
+ * Failures reject with `PdfError`: `INVALID_PDF` for a file that can't be
494
+ * parsed, `PASSWORD_REQUIRED` for an encrypted one, and sdk-core's codes for
495
+ * cancellation and worker failures.
496
+ *
497
+ * @public
498
+ */
499
+ declare interface PdfEngine {
500
+ /**
501
+ * Opens a document. The bytes are copied unless `transfer` is set.
502
+ */
503
+ open(source: PdfBytes, options?: PdfTransferOptions): Promise<PdfDocumentHandle>;
504
+ /** Releases the engine and its worker. Open documents are destroyed. */
505
+ destroy(): Promise<void>;
506
+ }
507
+
508
+ /**
509
+ * The error `@hussmartinez/pdf-sdk` throws and rejects with, with a stable
510
+ * `code`, structured `details` and the engine's error as `cause`. Show users
511
+ * the text for its code from {@link pdfMessages}, never its `message`, which
512
+ * is for developers and may contain text from the file.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * try {
517
+ * await session.open(file);
518
+ * } catch (error) {
519
+ * if (isPdfError(error, "PASSWORD_REQUIRED")) {
520
+ * askForPassword();
521
+ * } else {
522
+ * show(messages.error(error));
523
+ * }
524
+ * }
525
+ * ```
526
+ *
527
+ * @public
528
+ */
529
+ declare class PdfError extends SdkError<PdfErrorCode> {
530
+ /** Always `"PdfError"`, which survives minification and worker boundaries. */
531
+ readonly name = "PdfError";
532
+ }
533
+
534
+ /**
535
+ * Error codes of `@hussmartinez/pdf-sdk`: sdk-core's own codes, such as
536
+ * `ABORTED`, `WORKER_CRASHED` and `FILE_TOO_LARGE`, plus the PDF SDK's. They
537
+ * never change meaning once released.
538
+ *
539
+ * - `INVALID_PDF`: the file isn't a PDF, or is too damaged to open.
540
+ * - `PASSWORD_REQUIRED`: the PDF is encrypted, and opening it needs a
541
+ * password.
542
+ * - `PROCESSING_FAILED`: a PDF engine failed in a way no other code
543
+ * describes. `cause` holds the engine's error.
544
+ * - `TOO_MANY_PAGES`: a document, or the pages after an insert, exceed the
545
+ * `maxPages` limit.
546
+ * - `SESSION_TOO_LARGE`: the documents the session holds exceed the
547
+ * `maxSessionSize` limit.
548
+ * - `IMAGE_TOO_LARGE`: an image exceeds the `maxImagePixels` limit. It's
549
+ * reported as a warning, because the image is skipped rather than the
550
+ * document failing (ADR 0004).
551
+ *
552
+ * Limit codes carry `details` with the `limit`, its `maximum`, the `actual`
553
+ * value and the `unit`.
554
+ *
555
+ * @public
556
+ */
557
+ declare type PdfErrorCode = SdkCoreErrorCode | "INVALID_PDF" | "PASSWORD_REQUIRED" | "PROCESSING_FAILED" | "TOO_MANY_PAGES" | "SESSION_TOO_LARGE" | "IMAGE_TOO_LARGE";
558
+
559
+ /**
560
+ * Options for {@link PdfSession.export}.
561
+ *
562
+ * @public
563
+ */
564
+ declare interface PdfExportOptions extends PdfCallOptions {
565
+ /** Compress the result, losslessly unless `images` is set. */
566
+ readonly compress?: PdfCompression;
567
+ /** Encrypt the result with AES-256. */
568
+ readonly encrypt?: PdfEncryption;
569
+ /** Called as the export moves through its steps. */
570
+ readonly onProgress?: PdfBuildOptions["onProgress"];
571
+ }
572
+
573
+ /**
574
+ * A form field's value: text for text fields, checked or not for checkboxes.
575
+ *
576
+ * @public
577
+ */
578
+ declare type PdfFieldValue = string | boolean;
579
+
580
+ /**
581
+ * A host's `filePolicy`: a new maximum, or `{ maximum, warning }`, for any of
582
+ * the PDF SDK's limits. `Infinity` disables a maximum, which removes a
583
+ * protection against hostile files, or disables a warning. Unknown limit
584
+ * names throw `TypeError` when the policy is resolved.
585
+ *
586
+ * @example
587
+ * ```ts
588
+ * const filePolicy: PdfFilePolicyOverrides = {
589
+ * maxFileSize: { maximum: 300e6, warning: 100e6 },
590
+ * maxSessionSize: 600e6,
591
+ * };
592
+ * ```
593
+ *
594
+ * @public
595
+ */
596
+ declare type PdfFilePolicyOverrides = FilePolicyOverrides<PdfLimitDefinitions>;
597
+
598
+ /**
599
+ * An AcroForm field widget on a page.
600
+ *
601
+ * @public
602
+ */
603
+ declare interface PdfFormField {
604
+ /** The field's fully qualified name, unique within its document. */
605
+ readonly name: string;
606
+ /** The kind of field. Other kinds are not reported yet. */
607
+ readonly type: "text" | "checkbox";
608
+ /** Where the widget sits on the page. */
609
+ readonly rect: PdfRect;
610
+ /** The value stored in the document. */
611
+ readonly value: PdfFieldValue;
612
+ /** Whether the document marks the field as read-only. */
613
+ readonly readOnly: boolean;
614
+ }
615
+
616
+ /**
617
+ * The components of the icons the editor's tools name, from ui's set
618
+ * (sdk-core ADR 0030). A host's `icons` prop overrides any of them.
619
+ *
620
+ * @public
621
+ */
622
+ export declare const pdfIcons: Readonly<Record<string, IconComponent>>;
623
+
624
+ /**
625
+ * A drawn signature, or another image, placed on the page.
626
+ *
627
+ * @public
628
+ */
629
+ declare interface PdfImageAnnotation {
630
+ readonly id: string;
631
+ readonly type: "signature";
632
+ /** The top-left corner of the image, in page fractions. */
633
+ readonly at: PdfPoint;
634
+ /** Width, as a fraction of the page's width. */
635
+ readonly width: number;
636
+ /** Height, as a fraction of the page's height. */
637
+ readonly height: number;
638
+ /** The image as PNG bytes. */
639
+ readonly png: Uint8Array;
640
+ }
641
+
642
+ /**
643
+ * Lossy image recompression, on top of lossless compression.
644
+ *
645
+ * @public
646
+ */
647
+ declare interface PdfImageCompression {
648
+ /** JPEG quality, from 0 to 1. */
649
+ readonly quality: number;
650
+ /** The longest image edge to keep, in pixels. Larger images are scaled down. */
651
+ readonly maxDimension: number;
652
+ }
653
+
654
+ /**
655
+ * Options for {@link PdfSession.insert}.
656
+ *
657
+ * @public
658
+ */
659
+ declare interface PdfInsertOptions extends PdfCallOptions {
660
+ /** The position of the first inserted page. Defaults to the end. */
661
+ readonly at?: number;
662
+ /** Zero-based indexes of the pages to insert. Defaults to every page. */
663
+ readonly pageIndexes?: readonly number[];
664
+ }
665
+
666
+ /**
667
+ * Inserts pages of a registered source document. The session registers the
668
+ * source and fills in `keys`, so redo inserts the same pages.
669
+ *
670
+ * @public
671
+ */
672
+ declare interface PdfInsertPagesCommand {
673
+ readonly type: "pdf.insertPages";
674
+ /** The source's ID. */
675
+ readonly source: string;
676
+ /** Zero-based indexes of the source's pages to insert, in order. */
677
+ readonly pageIndexes: readonly number[];
678
+ /** The zero-based position of the first inserted page in the resulting plan. */
679
+ readonly at: number;
680
+ /** The keys of the new pages, one per index. */
681
+ readonly keys: readonly string[];
682
+ }
683
+
684
+ /**
685
+ * The type of {@link pdfLimitDefinitions}.
686
+ *
687
+ * @public
688
+ */
689
+ declare type PdfLimitDefinitions = typeof pdfLimitDefinitions;
690
+
691
+ /**
692
+ * The PDF SDK's limit definitions: sdk-core's core limits plus three for PDFs
693
+ * (ADR 0004).
694
+ *
695
+ * | Limit | Code | Default maximum | Default warning |
696
+ * |---|---|---|---|
697
+ * | `maxFileSize` | `FILE_TOO_LARGE` | 100 MB | 50 MB |
698
+ * | `maxFiles` | `TOO_MANY_FILES` | 20 | none |
699
+ * | `maxDecodedSize` | `DECODED_SIZE_TOO_LARGE` | 500 MB | none |
700
+ * | `maxProcessingTime` | `PROCESSING_TIME_EXCEEDED` | 120 s | none |
701
+ * | `maxPages` | `TOO_MANY_PAGES` | 5,000 | 1,000 |
702
+ * | `maxSessionSize` | `SESSION_TOO_LARGE` | 300 MB | 150 MB |
703
+ * | `maxImagePixels` | `IMAGE_TOO_LARGE` | 100 megapixels | none |
704
+ *
705
+ * Sizes are decimal: 1 MB is 1,000,000 bytes.
706
+ *
707
+ * @public
708
+ */
709
+ declare const pdfLimitDefinitions: {
710
+ readonly maxPages: {
711
+ readonly code: "TOO_MANY_PAGES";
712
+ readonly unit: "count";
713
+ readonly default: 5000;
714
+ readonly warning: 1000;
715
+ };
716
+ readonly maxSessionSize: {
717
+ readonly code: "SESSION_TOO_LARGE";
718
+ readonly unit: "bytes";
719
+ readonly default: 300000000;
720
+ readonly warning: 150000000;
721
+ };
722
+ readonly maxImagePixels: {
723
+ readonly code: "IMAGE_TOO_LARGE";
724
+ readonly unit: "pixels";
725
+ readonly default: 100000000;
726
+ };
727
+ readonly maxFileSize: {
728
+ readonly code: "FILE_TOO_LARGE";
729
+ readonly unit: "bytes";
730
+ readonly default: 100000000;
731
+ readonly warning: 50000000;
732
+ };
733
+ readonly maxFiles: {
734
+ readonly code: "TOO_MANY_FILES";
735
+ readonly unit: "count";
736
+ readonly default: 20;
737
+ };
738
+ readonly maxDecodedSize: {
739
+ readonly code: "DECODED_SIZE_TOO_LARGE";
740
+ readonly unit: "bytes";
741
+ readonly default: 500000000;
742
+ };
743
+ readonly maxProcessingTime: {
744
+ readonly code: "PROCESSING_TIME_EXCEEDED";
745
+ readonly unit: "milliseconds";
746
+ readonly default: 120000;
747
+ };
748
+ };
749
+
750
+ /**
751
+ * The names of the PDF SDK's limits.
752
+ *
753
+ * @public
754
+ */
755
+ declare type PdfLimitName = keyof PdfLimitDefinitions;
756
+
757
+ /**
758
+ * A link on a page to a web page or an email address. Only `http`, `https`
759
+ * and `mailto` links are reported (ADR 0012); links into the document and
760
+ * every other scheme, such as `javascript:`, are left out.
761
+ *
762
+ * @public
763
+ */
764
+ declare interface PdfLink {
765
+ /** Where the link sits on the page, in fractions of the unrotated page. */
766
+ readonly rect: PdfRect;
767
+ /** The absolute URL, normalised. */
768
+ readonly url: string;
769
+ }
770
+
771
+ /**
772
+ * The type of {@link pdfMessages}, for typing a host's overrides with
773
+ * `MessageOverrides<PdfMessageCatalogue>`.
774
+ *
775
+ * @public
776
+ */
777
+ declare type PdfMessageCatalogue = typeof pdfMessages;
778
+
779
+ /**
780
+ * The PDF SDK's English message catalogue: sdk-core's messages, and text for
781
+ * every {@link PdfErrorCode} and every limit's warning. Pass it to
782
+ * `createMessages` from `@hussmartinez/sdk-core`, with the host's locale and
783
+ * overrides.
784
+ *
785
+ * Error text is looked up by code, with the error's `details` as
786
+ * parameters, and never taken from `error.message` (ADR 0019).
787
+ *
788
+ * @example
789
+ * ```ts
790
+ * const messages = createMessages(pdfMessages, { locale: "en", overrides: props.messages });
791
+ * messages.error(error); // "This document has 6,200 pages, which is over the 5,000-page limit."
792
+ * messages.t("warnings.maxPages", { actual: 1_200 });
793
+ * ```
794
+ *
795
+ * @public
796
+ */
797
+ declare const pdfMessages: {
798
+ readonly "errors.INVALID_PDF": "This file isn't a PDF, or it's too damaged to open.";
799
+ readonly "errors.PASSWORD_REQUIRED": "This PDF is protected with a password.";
800
+ readonly "errors.PROCESSING_FAILED": "Something went wrong while processing this PDF. Please try again.";
801
+ readonly "errors.TOO_MANY_PAGES": "This document has {actual, number} pages, which is over the {maximum, number}-page limit.";
802
+ 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.";
803
+ readonly "errors.IMAGE_TOO_LARGE": "Some images are too large to show. They're kept unchanged in the document.";
804
+ readonly "warnings.maxPages": {
805
+ readonly $plural: "actual";
806
+ } & {
807
+ readonly one: "This document has {actual} page. Large documents may be slow.";
808
+ readonly other: "This document has {actual} pages. Large documents may be slow.";
809
+ };
810
+ readonly "warnings.maxSessionSize": "The open documents use {actual, fileSize}. Clearing the undo history frees memory.";
811
+ readonly "warnings.maxImagePixels": "Some images are very large and may be slow to show.";
812
+ readonly "viewer.label": "Document";
813
+ readonly "viewer.empty": "No document is open.";
814
+ readonly "viewer.page": "Page {page} of {count}";
815
+ readonly "viewer.webLink": "Link to {destination}, opens in a new tab";
816
+ readonly "viewer.emailLink": "Email {destination}";
817
+ readonly "thumbnails.label": "Pages";
818
+ readonly "thumbnails.page": "Page {page} of {count}";
819
+ readonly "thumbnails.number": "{page}";
820
+ readonly "editor.label": "PDF editor";
821
+ readonly "editor.start.title": "Open a PDF to get started";
822
+ readonly "editor.start.retryTitle": "Try another PDF";
823
+ readonly "editor.start.choose": "Choose a PDF";
824
+ readonly "editor.start.retry": "Choose another PDF";
825
+ readonly "editor.start.hint": "Or drop one here. Your file stays on this device and is never uploaded.";
826
+ readonly "editor.opening": "Opening the PDF…";
827
+ readonly "editor.opened": {
828
+ readonly $plural: "count";
829
+ } & {
830
+ readonly one: "Opened a PDF with {count} page.";
831
+ readonly other: "Opened a PDF with {count} pages.";
832
+ };
833
+ readonly "editor.closed": "The PDF was closed.";
834
+ readonly "editor.undone": "Undone.";
835
+ readonly "editor.redone": "Redone.";
836
+ readonly "editor.rotated": {
837
+ readonly $plural: "count";
838
+ } & {
839
+ readonly one: "Rotated {count} page.";
840
+ readonly other: "Rotated {count} pages.";
841
+ };
842
+ readonly "toolbar.label": "PDF tools";
843
+ readonly "toolbar.groups.file": "File";
844
+ readonly "toolbar.groups.history": "History";
845
+ readonly "toolbar.groups.pages": "Pages";
846
+ readonly "toolbar.groups.other": "More tools";
847
+ readonly "tools.open": "Open a PDF";
848
+ readonly "tools.undo": "Undo";
849
+ readonly "tools.redo": "Redo";
850
+ readonly "tools.rotate-left": "Rotate left";
851
+ readonly "tools.rotate-right": "Rotate right";
852
+ readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
853
+ readonly "errors.ABORTED": "The operation was cancelled.";
854
+ readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
855
+ readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
856
+ readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
857
+ readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
858
+ readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
859
+ readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
860
+ readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
861
+ readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
862
+ readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
863
+ readonly "errors.TOO_MANY_FILES": {
864
+ readonly $plural: "maximum";
865
+ } & {
866
+ readonly one: "You can add {maximum} file at a time.";
867
+ readonly other: "You can add up to {maximum} files at a time.";
868
+ };
869
+ readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
870
+ readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
871
+ readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
872
+ readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
873
+ readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
874
+ readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
875
+ readonly "keys.control": "Ctrl";
876
+ readonly "keys.alt": "Alt";
877
+ readonly "keys.shift": "Shift";
878
+ readonly "keys.meta": "Meta";
879
+ readonly "keys.apple.control": "\u2303";
880
+ readonly "keys.apple.alt": "\u2325";
881
+ readonly "keys.apple.shift": "\u21E7";
882
+ readonly "keys.apple.meta": "\u2318";
883
+ readonly "keys.space": "Space";
884
+ readonly "keys.enter": "Enter";
885
+ readonly "keys.escape": "Esc";
886
+ readonly "keys.tab": "Tab";
887
+ readonly "keys.delete": "Delete";
888
+ readonly "keys.backspace": "Backspace";
889
+ readonly "keys.arrowUp": "\u2191";
890
+ readonly "keys.arrowDown": "\u2193";
891
+ readonly "keys.arrowLeft": "\u2190";
892
+ readonly "keys.arrowRight": "\u2192";
893
+ readonly "keys.home": "Home";
894
+ readonly "keys.end": "End";
895
+ readonly "keys.pageUp": "Page Up";
896
+ readonly "keys.pageDown": "Page Down";
897
+ };
898
+
899
+ /**
900
+ * Moves pages, keeping their relative order, so that the first of them ends
901
+ * up at position `to` of the resulting plan.
902
+ *
903
+ * @public
904
+ */
905
+ declare interface PdfMovePagesCommand {
906
+ readonly type: "pdf.movePages";
907
+ readonly pages: readonly string[];
908
+ /** The zero-based position of the first moved page in the resulting plan. */
909
+ readonly to: number;
910
+ }
911
+
912
+ /**
913
+ * Facts about one page of a source document.
914
+ *
915
+ * @public
916
+ */
917
+ declare interface PdfPageInfo {
918
+ /** Width of the unrotated media box, in PDF points (1/72 inch). */
919
+ readonly width: number;
920
+ /** Height of the unrotated media box, in PDF points. */
921
+ readonly height: number;
922
+ /** The page's own rotation, from its `/Rotate` entry. */
923
+ readonly rotation: PdfRotation;
924
+ }
925
+
926
+ /**
927
+ * The document being edited, as a plan over immutable sources
928
+ * (docs/adr/0003): the pages in order, and form values per source. Bytes
929
+ * are only built from it on export.
930
+ *
931
+ * @public
932
+ */
933
+ declare interface PdfPlan {
934
+ readonly pages: readonly PdfPlanPage[];
935
+ /** Form values set in the session, by source ID, then field name. */
936
+ readonly formValues: Readonly<Record<string, Readonly<Record<string, PdfFieldValue>>>>;
937
+ }
938
+
939
+ /**
940
+ * One page of the page plan (docs/adr/0003): a page of a source document,
941
+ * with a rotation added to its own, and the annotations drawn on it. The key
942
+ * is stable while the page moves, so annotations, thumbnails and the
943
+ * selection follow it.
944
+ *
945
+ * @public
946
+ */
947
+ declare interface PdfPlanPage {
948
+ /** Unique within the session, and never reused. */
949
+ readonly key: string;
950
+ /** The ID of the source document the page comes from. */
951
+ readonly source: string;
952
+ /** The page's zero-based index in its source. */
953
+ readonly pageIndex: number;
954
+ /** Rotation added to the page's own `/Rotate`. */
955
+ readonly rotation: PdfRotation;
956
+ /** Annotations drawn on the page, in drawing order. */
957
+ readonly annotations: readonly PdfAnnotation[];
958
+ }
959
+
960
+ /**
961
+ * A point on a page, as fractions of the page's unrotated media box: `x`
962
+ * from the left edge and `y` from the top edge, each from 0 to 1. Fractions
963
+ * keep positions independent of zoom and of the rotation the page is shown
964
+ * with (ADR 0003).
965
+ *
966
+ * @public
967
+ */
968
+ declare interface PdfPoint {
969
+ readonly x: number;
970
+ readonly y: number;
971
+ }
972
+
973
+ /**
974
+ * The port for transforming PDFs: build an output document from sources,
975
+ * pages and export options (ADR 0003, ADR 0008). The SDK's qpdf adapter
976
+ * implements it in a worker; hosts can pass their own to the editor's
977
+ * `processor` prop, and every implementation must pass the processor's
978
+ * contract tests.
979
+ *
980
+ * One call runs the whole pipeline, so the bytes cross the worker boundary
981
+ * once in each direction. Failures reject with `PdfError`.
982
+ *
983
+ * @public
984
+ */
985
+ declare interface PdfProcessor {
986
+ /**
987
+ * Builds a document. The sources' bytes are copied unless `transfer` is
988
+ * set. The result is a new buffer the caller owns.
989
+ *
990
+ * @throws `PdfError` with `INVALID_PDF` when a source can't be read,
991
+ * `PASSWORD_REQUIRED` when one is encrypted, and `TypeError` or
992
+ * `RangeError` for a job that refers to an unknown source or page.
993
+ */
994
+ build(job: PdfBuildJob, options?: PdfBuildOptions): Promise<Uint8Array>;
995
+ /** Releases the processor and its worker. Pending builds reject. */
996
+ destroy(): Promise<void>;
997
+ }
998
+
999
+ /**
1000
+ * A rectangle on a page, in the same fractions as {@link PdfPoint}: its
1001
+ * top-left corner, width and height.
1002
+ *
1003
+ * @public
1004
+ */
1005
+ declare interface PdfRect {
1006
+ readonly x: number;
1007
+ readonly y: number;
1008
+ readonly width: number;
1009
+ readonly height: number;
1010
+ }
1011
+
1012
+ /**
1013
+ * Removes an annotation from a page.
1014
+ *
1015
+ * @public
1016
+ */
1017
+ declare interface PdfRemoveAnnotationCommand {
1018
+ readonly type: "pdf.removeAnnotation";
1019
+ readonly page: string;
1020
+ /** The annotation's ID. */
1021
+ readonly id: string;
1022
+ }
1023
+
1024
+ /**
1025
+ * How to render a page.
1026
+ *
1027
+ * @public
1028
+ */
1029
+ declare interface PdfRenderOptions extends PdfCallOptions {
1030
+ /** CSS pixels per PDF point. `1` renders a US Letter page 612 CSS pixels wide. */
1031
+ readonly scale: number;
1032
+ /**
1033
+ * Device pixels per CSS pixel, usually `window.devicePixelRatio`. Defaults
1034
+ * to 1. The engine lowers it as needed to stay within
1035
+ * {@link PDF_MAX_CANVAS_PIXELS}.
1036
+ */
1037
+ readonly pixelRatio?: number;
1038
+ /** Rotation added to the page's own, for the page plan (ADR 0003). Defaults to 0. */
1039
+ readonly rotation?: PdfRotation;
1040
+ }
1041
+
1042
+ /**
1043
+ * Puts every page in a new order, given as every key exactly once. It's what
1044
+ * undoing a move runs.
1045
+ *
1046
+ * @public
1047
+ */
1048
+ declare interface PdfReorderPagesCommand {
1049
+ readonly type: "pdf.reorderPages";
1050
+ readonly order: readonly string[];
1051
+ }
1052
+
1053
+ /**
1054
+ * Puts deleted pages back at their positions. It's what undoing a delete
1055
+ * runs, and it can be used directly.
1056
+ *
1057
+ * @public
1058
+ */
1059
+ declare interface PdfRestorePagesCommand {
1060
+ readonly type: "pdf.restorePages";
1061
+ /** Each page, and the index it takes in the resulting plan, in increasing order. */
1062
+ readonly entries: readonly {
1063
+ readonly index: number;
1064
+ readonly page: PdfPlanPage;
1065
+ }[];
1066
+ }
1067
+
1068
+ /**
1069
+ * Rotates pages by an angle, added to their current rotation.
1070
+ *
1071
+ * @public
1072
+ */
1073
+ declare interface PdfRotatePagesCommand {
1074
+ readonly type: "pdf.rotatePages";
1075
+ /** The keys of the pages to rotate. */
1076
+ readonly pages: readonly string[];
1077
+ /** Degrees, clockwise, in multiples of 90. Negative turns anticlockwise. */
1078
+ readonly angle: number;
1079
+ }
1080
+
1081
+ /**
1082
+ * A rotation in degrees, clockwise.
1083
+ *
1084
+ * @public
1085
+ */
1086
+ declare type PdfRotation = 0 | 90 | 180 | 270;
1087
+
1088
+ /**
1089
+ * The document being edited, as a framework-agnostic store (ADR 0008): a
1090
+ * page plan over the documents opened and inserted, edited with commands,
1091
+ * with undo and redo (ADR 0010, docs/adr/0003). React binds to it with
1092
+ * `useSyncExternalStore`, and the element binds to the same store.
1093
+ *
1094
+ * @public
1095
+ */
1096
+ declare interface PdfSession {
1097
+ /** The current snapshot, the same object until something changes. */
1098
+ getSnapshot(): PdfSessionSnapshot;
1099
+ /** Calls the listener after every change. Returns a function that unsubscribes. */
1100
+ subscribe(listener: () => void): () => void;
1101
+ /**
1102
+ * Opens a document, replacing the current one and its history once it has
1103
+ * opened. The file is checked against the file policy before it's read.
1104
+ * Rejects with a `PdfError`, which the snapshot also holds; the current
1105
+ * document, if any, stays open.
1106
+ */
1107
+ open(file: Blob | PdfBytes, options?: PdfCallOptions): Promise<void>;
1108
+ /**
1109
+ * Inserts the pages of another document, as one undoable step. If the
1110
+ * documents held would then exceed `maxSessionSize`, the session first
1111
+ * drops the redo steps, then the oldest undo steps, as far as needed to
1112
+ * release documents only they refer to, and sets `historyTrimmed`. If even
1113
+ * that isn't enough, it rejects with `SESSION_TOO_LARGE` and changes
1114
+ * nothing.
1115
+ */
1116
+ insert(file: Blob | PdfBytes, options?: PdfInsertOptions): Promise<void>;
1117
+ /**
1118
+ * Runs one command, or several as one undoable step. Throws `TypeError`
1119
+ * or `RangeError` for a command that doesn't fit the plan, and changes
1120
+ * nothing then.
1121
+ */
1122
+ execute(commands: PdfCommand | readonly PdfCommand[]): void;
1123
+ undo(): void;
1124
+ redo(): void;
1125
+ /** A plan page's size, and its rotation as shown: its own plus the plan's. */
1126
+ getPage(key: string, options?: PdfCallOptions): Promise<PdfPageInfo>;
1127
+ /** Renders a plan page with its rotation. */
1128
+ renderPage(key: string, canvas: HTMLCanvasElement, options: Omit<PdfRenderOptions, "rotation">): Promise<void>;
1129
+ /** A plan page's text, positioned on the unrotated page. */
1130
+ getTextContent(key: string, options?: PdfCallOptions): Promise<PdfTextContent>;
1131
+ /** A plan page's form fields, with the session's values applied. */
1132
+ getFormFields(key: string, options?: PdfCallOptions): Promise<readonly PdfFormField[]>;
1133
+ /** A plan page's web and email links, positioned on the unrotated page. */
1134
+ getLinks(key: string, options?: PdfCallOptions): Promise<readonly PdfLink[]>;
1135
+ /**
1136
+ * Builds the document as it is now: its pages in plan order, with their
1137
+ * rotations, form values and annotations, compressed or encrypted if asked.
1138
+ * An unchanged document with no options is returned as its original bytes,
1139
+ * without the processor. The result is a new buffer the caller owns.
1140
+ */
1141
+ export(options?: PdfExportOptions): Promise<Uint8Array>;
1142
+ /**
1143
+ * Selects pages, by key, replacing the selection. Keys the plan doesn't
1144
+ * have are ignored.
1145
+ */
1146
+ select(keys: readonly string[]): void;
1147
+ /** Records the page the user is looking at, as a viewer scrolls. */
1148
+ setCurrentPage(key: string): void;
1149
+ /** Makes a page current and asks viewers to bring it into view. */
1150
+ goToPage(key: string): void;
1151
+ /** Closes the document and releases its sources. */
1152
+ close(): Promise<void>;
1153
+ }
1154
+
1155
+ /**
1156
+ * Anonymous usage events, for a host's analytics (ADR 0010). They never
1157
+ * contain file names, contents, form values or annotation text.
1158
+ *
1159
+ * @public
1160
+ */
1161
+ declare type PdfSessionEvent = {
1162
+ readonly type: "document_opened";
1163
+ readonly pageCount: number;
1164
+ } | {
1165
+ readonly type: "document_closed";
1166
+ } | {
1167
+ readonly type: "pages_inserted";
1168
+ readonly pageCount: number;
1169
+ } | {
1170
+ readonly type: "command";
1171
+ readonly commands: readonly PdfCommand["type"][];
1172
+ } | {
1173
+ readonly type: "undo";
1174
+ } | {
1175
+ readonly type: "redo";
1176
+ } | {
1177
+ readonly type: "document_exported";
1178
+ readonly pageCount: number;
1179
+ readonly compressed: boolean;
1180
+ readonly encrypted: boolean;
1181
+ } | {
1182
+ readonly type: "failed";
1183
+ readonly operation: "open" | "insert" | "export";
1184
+ readonly code: string;
1185
+ };
1186
+
1187
+ /**
1188
+ * Makes a PDF session and the SDK's text available to the components and
1189
+ * hooks below it, such as `PdfViewer` and `usePdfDocument` (ADR 0008).
1190
+ *
1191
+ * @example
1192
+ * ```tsx
1193
+ * <PdfSessionProvider locale="de" messages={{ "viewer.empty": "Kein Dokument geöffnet." }}>
1194
+ * <PdfViewer />
1195
+ * </PdfSessionProvider>
1196
+ * ```
1197
+ *
1198
+ * @public
1199
+ */
1200
+ export declare function PdfSessionProvider(props: PdfSessionProviderProps): ReactNode;
1201
+
1202
+ /**
1203
+ * Props for {@link PdfSessionProvider}.
1204
+ *
1205
+ * @public
1206
+ */
1207
+ export declare interface PdfSessionProviderProps {
1208
+ /**
1209
+ * A session you created and own. Without it, the provider creates one,
1210
+ * with the options below, and closes it when it unmounts. The options are
1211
+ * read once, when the provider first renders.
1212
+ */
1213
+ readonly session?: PdfSession;
1214
+ /** The engine for a session the provider creates. Defaults to pdf.js. */
1215
+ readonly engine?: PdfEngine;
1216
+ /** The processor for a session the provider creates. Defaults to qpdf. */
1217
+ readonly processor?: PdfProcessor;
1218
+ /**
1219
+ * Where your application serves the package's `dist/assets/`, for the
1220
+ * default engine and processor (docs/adr/0007). By default, they're inlined.
1221
+ */
1222
+ readonly assetsUrl?: string | URL;
1223
+ /** File limits for a session the provider creates (docs/adr/0004). */
1224
+ readonly filePolicy?: PdfFilePolicyOverrides;
1225
+ /** Anonymous usage events from a session the provider creates. */
1226
+ readonly onEvent?: (event: PdfSessionEvent) => void;
1227
+ /** Text overrides, typed against the English catalogue (ADR 0019). */
1228
+ readonly messages?: MessageOverrides<PdfMessageCatalogue>;
1229
+ /** The locale for numbers, sizes and plurals. Defaults to `"en"`. */
1230
+ readonly locale?: string;
1231
+ /** The components that use the session, such as `PdfViewer`. */
1232
+ readonly children?: ReactNode;
1233
+ }
1234
+
1235
+ /**
1236
+ * The session's state at one moment. Snapshots are immutable: every change
1237
+ * makes a new one, so `useSyncExternalStore` and other subscribers can
1238
+ * compare them by identity.
1239
+ *
1240
+ * @public
1241
+ */
1242
+ declare interface PdfSessionSnapshot {
1243
+ readonly status: PdfSessionStatus;
1244
+ /** The document being edited: its pages, in order, and form values. */
1245
+ readonly plan: PdfPlan;
1246
+ /** The source documents the session holds. */
1247
+ readonly sources: readonly PdfSourceInfo[];
1248
+ readonly canUndo: boolean;
1249
+ readonly canRedo: boolean;
1250
+ /** Whether a document is being opened or inserted. */
1251
+ readonly busy: boolean;
1252
+ /** Why the last open or insert failed. Show its text by its code. */
1253
+ readonly error: PdfError | undefined;
1254
+ /** Limits the open documents are close to. */
1255
+ readonly warnings: readonly PdfWarning[];
1256
+ /**
1257
+ * The bytes of every document the session holds, which the
1258
+ * `maxSessionSize` limit counts: those the plan uses, and those the undo
1259
+ * and redo history can bring back (docs/adr/0004).
1260
+ */
1261
+ readonly sessionBytes: number;
1262
+ /**
1263
+ * Whether undo steps were dropped since the document opened, to make room
1264
+ * for an insert within `maxSessionSize`. Editors say so, because the
1265
+ * earliest edits can no longer be undone (ADR 0010).
1266
+ */
1267
+ readonly historyTrimmed: boolean;
1268
+ /**
1269
+ * The keys of the selected pages, in plan order. Tools act on them, such as
1270
+ * rotating the selection. View state: not undoable, and never in events.
1271
+ */
1272
+ readonly selection: readonly string[];
1273
+ /** The key of the page the user is looking at, if a document is open. */
1274
+ readonly currentPage: string | undefined;
1275
+ /**
1276
+ * The latest request to bring a page into view, from `goToPage`. Viewers
1277
+ * scroll to `page` each time `sequence` changes.
1278
+ */
1279
+ readonly navigation: {
1280
+ readonly page: string;
1281
+ readonly sequence: number;
1282
+ } | undefined;
1283
+ }
1284
+
1285
+ /**
1286
+ * What the session is doing.
1287
+ *
1288
+ * - `empty`: no document is open.
1289
+ * - `opening`: a document is being opened, replacing any other.
1290
+ * - `ready`: a document is open.
1291
+ * - `error`: no document is open, because the last open failed; `error`
1292
+ * says why. A failed open while a document is open keeps that document,
1293
+ * with the status `ready` and `error` set.
1294
+ *
1295
+ * @public
1296
+ */
1297
+ declare type PdfSessionStatus = "empty" | "opening" | "ready" | "error";
1298
+
1299
+ /**
1300
+ * Sets a form field's value in one source, or clears the session's value with
1301
+ * `null`, so the document's own value applies again.
1302
+ *
1303
+ * @public
1304
+ */
1305
+ declare interface PdfSetFieldValueCommand {
1306
+ readonly type: "pdf.setFieldValue";
1307
+ readonly source: string;
1308
+ readonly field: string;
1309
+ readonly value: PdfFieldValue | null;
1310
+ }
1311
+
1312
+ /**
1313
+ * A source document the session holds: opened or inserted, never changed.
1314
+ *
1315
+ * @public
1316
+ */
1317
+ declare interface PdfSourceInfo {
1318
+ /** Unique within the session, and never reused. */
1319
+ readonly id: string;
1320
+ readonly pageCount: number;
1321
+ /** The size of its bytes. */
1322
+ readonly byteLength: number;
1323
+ }
1324
+
1325
+ /**
1326
+ * A freehand pen stroke, or a highlighter stroke, which is drawn translucent.
1327
+ *
1328
+ * @public
1329
+ */
1330
+ declare interface PdfStrokeAnnotation {
1331
+ readonly id: string;
1332
+ readonly type: "pen" | "highlight";
1333
+ /** The stroke's points, in page fractions. */
1334
+ readonly points: readonly PdfPoint[];
1335
+ readonly color: PdfColor;
1336
+ /** Line width, as a fraction of the page's height. */
1337
+ readonly width: number;
1338
+ }
1339
+
1340
+ /**
1341
+ * A text note placed on the page.
1342
+ *
1343
+ * @public
1344
+ */
1345
+ declare interface PdfTextAnnotation {
1346
+ readonly id: string;
1347
+ readonly type: "text";
1348
+ /** The top-left corner of the text, in page fractions. */
1349
+ readonly at: PdfPoint;
1350
+ /** The note's text. It's drawn as text, never interpreted as markup. */
1351
+ readonly text: string;
1352
+ /** Font size, as a fraction of the page's height. */
1353
+ readonly size: number;
1354
+ readonly color: PdfColor;
1355
+ }
1356
+
1357
+ /**
1358
+ * The text of one page, in reading order as the document stores it.
1359
+ *
1360
+ * @public
1361
+ */
1362
+ declare interface PdfTextContent {
1363
+ readonly items: readonly PdfTextItem[];
1364
+ }
1365
+
1366
+ /**
1367
+ * A run of text on a page, for the text layer, selection, assistive
1368
+ * technology and search. Positions are fractions of the unrotated media box
1369
+ * ({@link PdfRect}).
1370
+ *
1371
+ * @public
1372
+ */
1373
+ declare interface PdfTextItem {
1374
+ /** The text, as the document encodes it. Always rendered as text, never as markup. */
1375
+ readonly text: string;
1376
+ /** The box the text occupies. */
1377
+ readonly rect: PdfRect;
1378
+ /** Rotation of the text's baseline, in degrees, counter-clockwise. */
1379
+ readonly angle: number;
1380
+ /** Whether a line break follows this item. */
1381
+ readonly endOfLine: boolean;
1382
+ }
1383
+
1384
+ /**
1385
+ * A column of page thumbnails to see the whole document and choose pages
1386
+ * (ADR 0014): a listbox with several pages selectable, where the selection
1387
+ * follows focus and the chosen page is brought into view in `PdfViewer`.
1388
+ * Like the viewer, it only draws the thumbnails near its viewport.
1389
+ *
1390
+ * Keyboard: the arrow keys, Home and End move to a page, select it and show
1391
+ * it; with Shift they extend the selection; with Ctrl or ⌘ they move without
1392
+ * selecting, and Space then adds or removes the page. Ctrl or ⌘ + A selects
1393
+ * every page, and Escape keeps only the focused one. With a pointer: click,
1394
+ * Ctrl or ⌘ + click, and Shift + click.
1395
+ *
1396
+ * @public
1397
+ */
1398
+ export declare function PdfThumbnails(props: PdfThumbnailsProps): ReactNode;
1399
+
1400
+ /**
1401
+ * The parts of `PdfThumbnails` that take extra classes through `classNames`.
1402
+ *
1403
+ * @public
1404
+ */
1405
+ export declare type PdfThumbnailsPart = "root" | "thumbnail" | "frame" | "canvas" | "number";
1406
+
1407
+ /**
1408
+ * Props for {@link PdfThumbnails}.
1409
+ *
1410
+ * @public
1411
+ */
1412
+ export declare interface PdfThumbnailsProps {
1413
+ /** Extra classes on the root. */
1414
+ readonly className?: string;
1415
+ /** Extra classes on each part. */
1416
+ readonly classNames?: Readonly<Partial<Record<PdfThumbnailsPart, string>>>;
1417
+ /** Drop the visual styles, keeping layout and accessibility. */
1418
+ readonly unstyled?: boolean;
1419
+ /** How many thumbnails are drawn at once. Defaults to 2. */
1420
+ readonly concurrency?: number;
1421
+ }
1422
+
1423
+ /**
1424
+ * One of the editor's tools (sdk-core ADR 0009 and ADR 0030): headless, so
1425
+ * the React editor and the custom element share it.
1426
+ *
1427
+ * @public
1428
+ */
1429
+ export declare type PdfTool = Tool<PdfToolState, PdfToolContext, undefined>;
1430
+
1431
+ /**
1432
+ * The editor's toolbar: ui's `Toolbar`, one labelled group per toolbar group
1433
+ * of the registry and one button per tool, disabled when the tool can't
1434
+ * run, with the tool's shortcuts as `aria-keyshortcuts`. Arrow keys move
1435
+ * between the buttons, as ui's toolbar does, so it's one tab stop.
1436
+ *
1437
+ * @public
1438
+ */
1439
+ export declare function PdfToolbar(props: PdfToolbarProps): ReactNode;
1440
+
1441
+ /**
1442
+ * Props for {@link PdfToolbar}.
1443
+ *
1444
+ * @public
1445
+ */
1446
+ export declare interface PdfToolbarProps {
1447
+ /** The editor's tools, from `createToolRegistry`. */
1448
+ readonly registry: ToolRegistry<PdfTool>;
1449
+ /** The editor's shortcuts, for each button's `aria-keyshortcuts`. */
1450
+ readonly shortcuts?: ShortcutRegistry;
1451
+ /** What the tools run against. */
1452
+ readonly context: PdfToolContext;
1453
+ /** Icon components by name. */
1454
+ readonly icons: Readonly<Record<string, IconComponent>>;
1455
+ /** Runs a tool. Defaults to running it against `context`. */
1456
+ readonly onRun?: (tool: PdfTool) => void;
1457
+ /** Extra classes on the root. */
1458
+ readonly className?: string;
1459
+ }
1460
+
1461
+ /**
1462
+ * What a tool runs against.
1463
+ *
1464
+ * @public
1465
+ */
1466
+ export declare interface PdfToolContext {
1467
+ /** The session the tool edits. */
1468
+ readonly session: PdfSession;
1469
+ /** Asks the user for a PDF and opens it, as the open tool does. */
1470
+ readonly chooseFile: () => void;
1471
+ }
1472
+
1473
+ /**
1474
+ * Every tool the editor knows, in their default order (sdk-core ADR 0030).
1475
+ *
1476
+ * @public
1477
+ */
1478
+ export declare const pdfTools: readonly PdfTool[];
1479
+
1480
+ /**
1481
+ * What a tool reads to decide whether it's available, enabled or active.
1482
+ *
1483
+ * @public
1484
+ */
1485
+ export declare interface PdfToolState {
1486
+ /** The session's current snapshot. */
1487
+ readonly snapshot: PdfSessionSnapshot;
1488
+ }
1489
+
1490
+ /**
1491
+ * Options for calls that take PDF bytes.
1492
+ *
1493
+ * @public
1494
+ */
1495
+ declare interface PdfTransferOptions extends PdfCallOptions {
1496
+ /**
1497
+ * Hand the bytes' buffers to the worker instead of copying them. The
1498
+ * caller's buffers are detached and must not be used afterwards. Defaults
1499
+ * to `false`, so a caller's bytes are never detached by surprise.
1500
+ */
1501
+ readonly transfer?: boolean;
1502
+ }
1503
+
1504
+ /**
1505
+ * Shows the session's pages in a scrolling column (docs/adr/0003): each page
1506
+ * keeps its place at the right size, and only pages near the viewport are
1507
+ * drawn, a few at a time. Pages that scroll away are cancelled or give their
1508
+ * pixels back. The text is selectable, for copying and for screen readers,
1509
+ * and links are real links, limited to safe URLs and labelled with where
1510
+ * they lead (ADR 0012, ADR 0014).
1511
+ *
1512
+ * The viewer is a focusable region, so keyboard users scroll it with the
1513
+ * arrow, Page Up, Page Down, Home and End keys.
1514
+ *
1515
+ * @public
1516
+ */
1517
+ export declare function PdfViewer(props: PdfViewerProps): ReactNode;
1518
+
1519
+ /**
1520
+ * Extra classes for each part of `PdfViewer`.
1521
+ *
1522
+ * @public
1523
+ */
1524
+ export declare type PdfViewerClassNames = Readonly<Partial<Record<PdfViewerPart, string>>>;
1525
+
1526
+ /**
1527
+ * The parts of `PdfViewer` that take extra classes through `classNames`.
1528
+ *
1529
+ * @public
1530
+ */
1531
+ export declare type PdfViewerPart = "root" | "pages" | "page" | "canvas" | "textLayer" | "linkLayer" | "link" | "error" | "empty";
1532
+
1533
+ /**
1534
+ * Props for {@link PdfViewer}.
1535
+ *
1536
+ * @public
1537
+ */
1538
+ export declare interface PdfViewerProps {
1539
+ /** Extra classes on the root. */
1540
+ readonly className?: string;
1541
+ /** Extra classes on each part. */
1542
+ readonly classNames?: PdfViewerClassNames;
1543
+ /** Drop the visual styles, keeping layout and accessibility. */
1544
+ readonly unstyled?: boolean;
1545
+ /** Page width relative to the viewer's width. Defaults to 1, fitting the width. */
1546
+ readonly zoom?: number;
1547
+ /** How many page renders run at once. Defaults to 2. */
1548
+ readonly concurrency?: number;
1549
+ }
1550
+
1551
+ /**
1552
+ * A file policy warning: a value at or above a limit's warning threshold,
1553
+ * but within its maximum (ADR 0020). Show its text from
1554
+ * `warnings.<limit>` in the message catalogue, with `actual` as a parameter.
1555
+ *
1556
+ * @public
1557
+ */
1558
+ declare interface PdfWarning {
1559
+ readonly limit: PdfLimitName;
1560
+ readonly actual: number;
1561
+ }
1562
+
1563
+ /**
1564
+ * The session's current snapshot, re-rendering whenever it changes, through
1565
+ * `useSyncExternalStore`, so it's safe with concurrent rendering and server
1566
+ * rendering (ADR 0008).
1567
+ *
1568
+ * @public
1569
+ */
1570
+ export declare function usePdfDocument(): PdfSessionSnapshot;
1571
+
1572
+ /**
1573
+ * The SDK's text for the provider's locale and overrides (ADR 0019).
1574
+ *
1575
+ * @public
1576
+ */
1577
+ export declare function usePdfMessages(): Messages<PdfMessageCatalogue>;
1578
+
1579
+ /**
1580
+ * The session of the nearest `PdfSessionProvider`, to open documents, run
1581
+ * commands, undo and export.
1582
+ *
1583
+ * @public
1584
+ */
1585
+ export declare function usePdfSession(): PdfSession;
1586
+
1587
+ export { }