@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,1304 @@
1
+ /**
2
+ * Headless core of the PDF SDK: contracts, errors, the document session and
3
+ * operations.
4
+ *
5
+ * @remarks
6
+ * This entry is server-safe: it has no React and touches no DOM on import, so
7
+ * Server Components and Node can import it (ADR 0004, ADR 0007).
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+
12
+ import { FilePolicy } from '@hussmartinez/sdk-core';
13
+ import { FilePolicyOverrides } from '@hussmartinez/sdk-core';
14
+ import { Limits } from '@hussmartinez/sdk-core';
15
+ import { SdkCoreErrorCode } from '@hussmartinez/sdk-core';
16
+ import { SdkError } from '@hussmartinez/sdk-core';
17
+
18
+ /**
19
+ * Adds two rotations, such as a page's own `/Rotate` and the rotation the
20
+ * page plan adds to it.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * addRotation(270, 180); // 90
25
+ * addRotation(90, -90); // 0
26
+ * ```
27
+ *
28
+ * @param rotation - The current rotation.
29
+ * @param angle - The angle to add, positive clockwise, in multiples of 90.
30
+ * @throws `RangeError` if `angle` isn't a multiple of 90.
31
+ * @public
32
+ */
33
+ export declare function addRotation(rotation: PdfRotation, angle: number): PdfRotation;
34
+
35
+ /**
36
+ * Creates the SDK's {@link PdfEngine}, backed by pdf.js (ADR 0001, ADR 0002).
37
+ *
38
+ * Nothing loads until the first `open()`: then pdf.js's display layer is
39
+ * imported, and its worker starts. Every document the engine opens shares one
40
+ * worker, and pdf.js runs without scripting or XFA (docs/adr/0001).
41
+ *
42
+ * By default everything is inlined: the worker, and the CMaps, standard
43
+ * fonts and image decoders that some documents need, each loaded only when a
44
+ * document needs it, with no network request. With `assetsUrl`, they load
45
+ * from your own origin instead (docs/adr/0002, docs/adr/0006).
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const engine = createPdfJsEngine();
50
+ * const document = await engine.open(await file.arrayBuffer(), { signal });
51
+ * await document.renderPage(0, canvas, { scale: 1.5, pixelRatio: devicePixelRatio });
52
+ * ```
53
+ *
54
+ * @public
55
+ */
56
+ export declare function createPdfJsEngine(options?: PdfJsEngineOptions): PdfEngine;
57
+
58
+ /**
59
+ * Creates the SDK's {@link PdfProcessor}, backed by qpdf and pdf-lib in a
60
+ * worker (docs/adr/0001, docs/adr/0002).
61
+ *
62
+ * Nothing starts until the first `build()`. By default the worker is
63
+ * inlined, which needs `worker-src blob:` and `script-src 'wasm-unsafe-eval'`
64
+ * in a Content Security Policy, and it never fetches anything. With
65
+ * `assetsUrl`, it loads from your own origin instead. A build that can't stop
66
+ * when cancelled terminates its worker, which starts again on the next build.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const processor = createPdfProcessor();
71
+ * const protectedPdf = await processor.build({
72
+ * sources: [{ id: "a", bytes }],
73
+ * pages: [{ source: "a", pageIndex: 0 }, { source: "a", pageIndex: 1, rotation: 90 }],
74
+ * encrypt: { userPassword: "correct horse" },
75
+ * });
76
+ * ```
77
+ *
78
+ * @public
79
+ */
80
+ export declare function createPdfProcessor(options?: PdfProcessorOptions): PdfProcessor;
81
+
82
+ /**
83
+ * Creates a {@link PdfSession}. Pass the engine to use; the headless core
84
+ * doesn't choose one, so it can't pull pdf.js into applications that don't
85
+ * want it.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * const session = createPdfSession({ engine: createPdfJsEngine() });
90
+ * await session.open(file);
91
+ * const [first] = session.getSnapshot().plan.pages;
92
+ * session.execute({ type: "pdf.rotatePages", pages: [first.key], angle: 90 });
93
+ * session.undo();
94
+ * ```
95
+ *
96
+ * @public
97
+ */
98
+ export declare function createPdfSession(options: PdfSessionOptions): PdfSession;
99
+
100
+ /**
101
+ * Checks whether a value is a {@link PdfError}, optionally with a given code.
102
+ *
103
+ * Unlike `instanceof`, it recognises errors from another copy of this
104
+ * package or another realm, and errors rebuilt after crossing a worker
105
+ * boundary.
106
+ *
107
+ * @param value - Any thrown value.
108
+ * @param code - When given, the error must also have this code.
109
+ * @public
110
+ */
111
+ export declare function isPdfError<Code extends PdfErrorCode = PdfErrorCode>(value: unknown, code?: Code): value is PdfError & {
112
+ readonly code: Code;
113
+ };
114
+
115
+ /**
116
+ * What a link really leads to, for people to check before following it: the
117
+ * host of a web link, without `www.`, or the address of an email link.
118
+ * Undefined for a URL `safeLinkUrl` refuses.
119
+ *
120
+ * @public
121
+ */
122
+ export declare function linkDestination(url: string): string | undefined;
123
+
124
+ /**
125
+ * The most pixels an engine draws into one canvas. Larger renders are drawn
126
+ * at a lower resolution instead, because iOS Safari, the strictest
127
+ * supported browser, refuses larger canvases (ADR 0004).
128
+ *
129
+ * @public
130
+ */
131
+ export declare const PDF_MAX_CANVAS_PIXELS = 16777216;
132
+
133
+ /**
134
+ * Adds an annotation to a page.
135
+ *
136
+ * @public
137
+ */
138
+ export declare interface PdfAddAnnotationCommand {
139
+ readonly type: "pdf.addAnnotation";
140
+ /** The page's key. */
141
+ readonly page: string;
142
+ readonly annotation: PdfAnnotation;
143
+ /** Its position among the page's annotations. Defaults to the end. */
144
+ readonly index?: number;
145
+ }
146
+
147
+ /**
148
+ * Anything the editor draws on top of a page until it's flattened on export
149
+ * (ADR 0003). Annotations are plain data, so they can be stored in commands
150
+ * and sent to the processing worker.
151
+ *
152
+ * @public
153
+ */
154
+ export declare type PdfAnnotation = PdfStrokeAnnotation | PdfTextAnnotation | PdfImageAnnotation;
155
+
156
+ /**
157
+ * Everything needed to build an output document from the page plan, in one
158
+ * call to the processor (ADR 0003): the sources, the pages in order, and the
159
+ * export options. Plain data, so it crosses the worker boundary as it is.
160
+ *
161
+ * The processor runs the steps in this order, skipping those with nothing to
162
+ * do: fill each source's form values, assemble the pages with their
163
+ * rotations, flatten the annotations, compress, encrypt.
164
+ *
165
+ * @public
166
+ */
167
+ export declare interface PdfBuildJob {
168
+ readonly sources: readonly PdfBuildSource[];
169
+ readonly pages: readonly PdfBuildPage[];
170
+ readonly compress?: PdfCompression;
171
+ readonly encrypt?: PdfEncryption;
172
+ }
173
+
174
+ /**
175
+ * Options for {@link PdfProcessor.build}.
176
+ *
177
+ * @public
178
+ */
179
+ export declare interface PdfBuildOptions extends PdfTransferOptions {
180
+ /** Called as the build moves through its steps. */
181
+ readonly onProgress?: (progress: PdfBuildProgress) => void;
182
+ }
183
+
184
+ /**
185
+ * One page of the output: a page of a source, with a rotation added to the
186
+ * page's own, and the annotations to draw on it.
187
+ *
188
+ * @public
189
+ */
190
+ export declare interface PdfBuildPage {
191
+ /** The {@link PdfBuildSource.id} the page comes from. */
192
+ readonly source: string;
193
+ /** The page's zero-based index in its source. */
194
+ readonly pageIndex: number;
195
+ /** Rotation added to the page's own `/Rotate`. Defaults to 0. */
196
+ readonly rotation?: PdfRotation;
197
+ /** Annotations to flatten into the page's content. */
198
+ readonly annotations?: readonly PdfAnnotation[];
199
+ }
200
+
201
+ /**
202
+ * Progress of a build: the step running now, and the fraction of the whole
203
+ * build that's done, from 0 to 1.
204
+ *
205
+ * @public
206
+ */
207
+ export declare interface PdfBuildProgress {
208
+ readonly step: PdfBuildStep;
209
+ readonly fraction: number;
210
+ }
211
+
212
+ /**
213
+ * One source document of a {@link PdfBuildJob}.
214
+ *
215
+ * @public
216
+ */
217
+ export declare interface PdfBuildSource {
218
+ /** An identifier, unique within the job, that pages and form values refer to. */
219
+ readonly id: string;
220
+ readonly bytes: PdfBytes;
221
+ /** Form values to fill into this source before its pages are assembled. */
222
+ readonly formValues?: Readonly<Record<string, PdfFieldValue>>;
223
+ }
224
+
225
+ /**
226
+ * The steps of a build, reported as progress.
227
+ *
228
+ * @public
229
+ */
230
+ export declare type PdfBuildStep = "fill" | "assemble" | "flatten" | "compress" | "encrypt";
231
+
232
+ /**
233
+ * PDF bytes as callers pass them. A `Uint8Array` may be a view into a larger
234
+ * buffer; only its own bytes are used.
235
+ *
236
+ * @public
237
+ */
238
+ export declare type PdfBytes = ArrayBuffer | Uint8Array;
239
+
240
+ /**
241
+ * Options every port call accepts.
242
+ *
243
+ * @public
244
+ */
245
+ export declare interface PdfCallOptions {
246
+ /**
247
+ * Cancels the call. It then rejects with a `PdfError` whose code is
248
+ * `ABORTED`, `TIMEOUT`, or the code of an `SdkError` given as the abort
249
+ * reason, such as `PROCESSING_TIME_EXCEEDED`.
250
+ */
251
+ readonly signal?: AbortSignal;
252
+ }
253
+
254
+ /**
255
+ * A colour as `#rrggbb`.
256
+ *
257
+ * @public
258
+ */
259
+ export declare type PdfColor = `#${string}`;
260
+
261
+ /**
262
+ * An edit to the page plan (docs/adr/0003). Commands are plain,
263
+ * structured-cloneable data, never carry bytes, and each has an exact
264
+ * inverse, which is how undo works (ADR 0010).
265
+ *
266
+ * @public
267
+ */
268
+ export declare type PdfCommand = PdfRotatePagesCommand | PdfDeletePagesCommand | PdfRestorePagesCommand | PdfMovePagesCommand | PdfReorderPagesCommand | PdfInsertPagesCommand | PdfSetFieldValueCommand | PdfAddAnnotationCommand | PdfRemoveAnnotationCommand;
269
+
270
+ /**
271
+ * How to compress the output. Compression is lossless unless `images` is set.
272
+ *
273
+ * @public
274
+ */
275
+ export declare interface PdfCompression {
276
+ readonly images?: PdfImageCompression;
277
+ }
278
+
279
+ /**
280
+ * Removes pages from the plan. Their sources stay, so undo can bring them back.
281
+ *
282
+ * @public
283
+ */
284
+ export declare interface PdfDeletePagesCommand {
285
+ readonly type: "pdf.deletePages";
286
+ readonly pages: readonly string[];
287
+ }
288
+
289
+ /**
290
+ * An open document. Pages are addressed by zero-based index.
291
+ *
292
+ * @public
293
+ */
294
+ export declare interface PdfDocumentHandle {
295
+ /** The number of pages. */
296
+ readonly pageCount: number;
297
+ /**
298
+ * Reads a page's size and rotation.
299
+ *
300
+ * @throws `RangeError` for an index outside the document.
301
+ */
302
+ getPage(pageIndex: number, options?: PdfCallOptions): Promise<PdfPageInfo>;
303
+ /**
304
+ * Draws a page into a canvas, sizing the canvas's pixel dimensions and its
305
+ * CSS `width` and `height`.
306
+ *
307
+ * @throws `RangeError` for an index outside the document.
308
+ */
309
+ renderPage(pageIndex: number, canvas: HTMLCanvasElement, options: PdfRenderOptions): Promise<void>;
310
+ /**
311
+ * Reads a page's text, for the text layer and search.
312
+ *
313
+ * @throws `RangeError` for an index outside the document.
314
+ */
315
+ getTextContent(pageIndex: number, options?: PdfCallOptions): Promise<PdfTextContent>;
316
+ /**
317
+ * Reads the form fields on a page.
318
+ *
319
+ * @throws `RangeError` for an index outside the document.
320
+ */
321
+ getFormFields(pageIndex: number, options?: PdfCallOptions): Promise<readonly PdfFormField[]>;
322
+ /**
323
+ * Reads the links on a page to web pages and email addresses, filtered
324
+ * with `safeLinkUrl` (ADR 0012).
325
+ *
326
+ * @throws `RangeError` for an index outside the document.
327
+ */
328
+ getLinks(pageIndex: number, options?: PdfCallOptions): Promise<readonly PdfLink[]>;
329
+ /** Releases the document. Pending calls reject, and later calls throw. */
330
+ destroy(): Promise<void>;
331
+ }
332
+
333
+ /**
334
+ * How to encrypt the output. Encryption is always AES-256.
335
+ *
336
+ * @public
337
+ */
338
+ export declare interface PdfEncryption {
339
+ /** The password needed to open the document. */
340
+ readonly userPassword: string;
341
+ /** The password that grants full access. Defaults to the user password. */
342
+ readonly ownerPassword?: string;
343
+ }
344
+
345
+ /**
346
+ * The port for viewing PDFs: open a document, then read and render its pages
347
+ * (ADR 0008). The SDK's pdf.js adapter implements it; hosts can pass their
348
+ * own to the editor's `engine` prop, and every implementation must pass the
349
+ * engine's contract tests.
350
+ *
351
+ * Failures reject with `PdfError`: `INVALID_PDF` for a file that can't be
352
+ * parsed, `PASSWORD_REQUIRED` for an encrypted one, and sdk-core's codes for
353
+ * cancellation and worker failures.
354
+ *
355
+ * @public
356
+ */
357
+ export declare interface PdfEngine {
358
+ /**
359
+ * Opens a document. The bytes are copied unless `transfer` is set.
360
+ */
361
+ open(source: PdfBytes, options?: PdfTransferOptions): Promise<PdfDocumentHandle>;
362
+ /** Releases the engine and its worker. Open documents are destroyed. */
363
+ destroy(): Promise<void>;
364
+ }
365
+
366
+ /**
367
+ * The error `@hussmartinez/pdf-sdk` throws and rejects with, with a stable
368
+ * `code`, structured `details` and the engine's error as `cause`. Show users
369
+ * the text for its code from {@link pdfMessages}, never its `message`, which
370
+ * is for developers and may contain text from the file.
371
+ *
372
+ * @example
373
+ * ```ts
374
+ * try {
375
+ * await session.open(file);
376
+ * } catch (error) {
377
+ * if (isPdfError(error, "PASSWORD_REQUIRED")) {
378
+ * askForPassword();
379
+ * } else {
380
+ * show(messages.error(error));
381
+ * }
382
+ * }
383
+ * ```
384
+ *
385
+ * @public
386
+ */
387
+ export declare class PdfError extends SdkError<PdfErrorCode> {
388
+ /** Always `"PdfError"`, which survives minification and worker boundaries. */
389
+ readonly name = "PdfError";
390
+ }
391
+
392
+ /**
393
+ * Error codes of `@hussmartinez/pdf-sdk`: sdk-core's own codes, such as
394
+ * `ABORTED`, `WORKER_CRASHED` and `FILE_TOO_LARGE`, plus the PDF SDK's. They
395
+ * never change meaning once released.
396
+ *
397
+ * - `INVALID_PDF`: the file isn't a PDF, or is too damaged to open.
398
+ * - `PASSWORD_REQUIRED`: the PDF is encrypted, and opening it needs a
399
+ * password.
400
+ * - `PROCESSING_FAILED`: a PDF engine failed in a way no other code
401
+ * describes. `cause` holds the engine's error.
402
+ * - `TOO_MANY_PAGES`: a document, or the pages after an insert, exceed the
403
+ * `maxPages` limit.
404
+ * - `SESSION_TOO_LARGE`: the documents the session holds exceed the
405
+ * `maxSessionSize` limit.
406
+ * - `IMAGE_TOO_LARGE`: an image exceeds the `maxImagePixels` limit. It's
407
+ * reported as a warning, because the image is skipped rather than the
408
+ * document failing (ADR 0004).
409
+ *
410
+ * Limit codes carry `details` with the `limit`, its `maximum`, the `actual`
411
+ * value and the `unit`.
412
+ *
413
+ * @public
414
+ */
415
+ export declare type PdfErrorCode = SdkCoreErrorCode | "INVALID_PDF" | "PASSWORD_REQUIRED" | "PROCESSING_FAILED" | "TOO_MANY_PAGES" | "SESSION_TOO_LARGE" | "IMAGE_TOO_LARGE";
416
+
417
+ /**
418
+ * Options for {@link PdfSession.export}.
419
+ *
420
+ * @public
421
+ */
422
+ export declare interface PdfExportOptions extends PdfCallOptions {
423
+ /** Compress the result, losslessly unless `images` is set. */
424
+ readonly compress?: PdfCompression;
425
+ /** Encrypt the result with AES-256. */
426
+ readonly encrypt?: PdfEncryption;
427
+ /** Called as the export moves through its steps. */
428
+ readonly onProgress?: PdfBuildOptions["onProgress"];
429
+ }
430
+
431
+ /**
432
+ * A form field's value: text for text fields, checked or not for checkboxes.
433
+ *
434
+ * @public
435
+ */
436
+ export declare type PdfFieldValue = string | boolean;
437
+
438
+ /**
439
+ * A resolved file policy for the PDF SDK. Violations throw {@link PdfError}.
440
+ *
441
+ * @public
442
+ */
443
+ export declare type PdfFilePolicy = FilePolicy<PdfLimitDefinitions>;
444
+
445
+ /**
446
+ * A host's `filePolicy`: a new maximum, or `{ maximum, warning }`, for any of
447
+ * the PDF SDK's limits. `Infinity` disables a maximum, which removes a
448
+ * protection against hostile files, or disables a warning. Unknown limit
449
+ * names throw `TypeError` when the policy is resolved.
450
+ *
451
+ * @example
452
+ * ```ts
453
+ * const filePolicy: PdfFilePolicyOverrides = {
454
+ * maxFileSize: { maximum: 300e6, warning: 100e6 },
455
+ * maxSessionSize: 600e6,
456
+ * };
457
+ * ```
458
+ *
459
+ * @public
460
+ */
461
+ export declare type PdfFilePolicyOverrides = FilePolicyOverrides<PdfLimitDefinitions>;
462
+
463
+ /**
464
+ * An AcroForm field widget on a page.
465
+ *
466
+ * @public
467
+ */
468
+ export declare interface PdfFormField {
469
+ /** The field's fully qualified name, unique within its document. */
470
+ readonly name: string;
471
+ /** The kind of field. Other kinds are not reported yet. */
472
+ readonly type: "text" | "checkbox";
473
+ /** Where the widget sits on the page. */
474
+ readonly rect: PdfRect;
475
+ /** The value stored in the document. */
476
+ readonly value: PdfFieldValue;
477
+ /** Whether the document marks the field as read-only. */
478
+ readonly readOnly: boolean;
479
+ }
480
+
481
+ /**
482
+ * A drawn signature, or another image, placed on the page.
483
+ *
484
+ * @public
485
+ */
486
+ export declare interface PdfImageAnnotation {
487
+ readonly id: string;
488
+ readonly type: "signature";
489
+ /** The top-left corner of the image, in page fractions. */
490
+ readonly at: PdfPoint;
491
+ /** Width, as a fraction of the page's width. */
492
+ readonly width: number;
493
+ /** Height, as a fraction of the page's height. */
494
+ readonly height: number;
495
+ /** The image as PNG bytes. */
496
+ readonly png: Uint8Array;
497
+ }
498
+
499
+ /**
500
+ * Lossy image recompression, on top of lossless compression.
501
+ *
502
+ * @public
503
+ */
504
+ export declare interface PdfImageCompression {
505
+ /** JPEG quality, from 0 to 1. */
506
+ readonly quality: number;
507
+ /** The longest image edge to keep, in pixels. Larger images are scaled down. */
508
+ readonly maxDimension: number;
509
+ }
510
+
511
+ /**
512
+ * Options for {@link PdfSession.insert}.
513
+ *
514
+ * @public
515
+ */
516
+ export declare interface PdfInsertOptions extends PdfCallOptions {
517
+ /** The position of the first inserted page. Defaults to the end. */
518
+ readonly at?: number;
519
+ /** Zero-based indexes of the pages to insert. Defaults to every page. */
520
+ readonly pageIndexes?: readonly number[];
521
+ }
522
+
523
+ /**
524
+ * Inserts pages of a registered source document. The session registers the
525
+ * source and fills in `keys`, so redo inserts the same pages.
526
+ *
527
+ * @public
528
+ */
529
+ export declare interface PdfInsertPagesCommand {
530
+ readonly type: "pdf.insertPages";
531
+ /** The source's ID. */
532
+ readonly source: string;
533
+ /** Zero-based indexes of the source's pages to insert, in order. */
534
+ readonly pageIndexes: readonly number[];
535
+ /** The zero-based position of the first inserted page in the resulting plan. */
536
+ readonly at: number;
537
+ /** The keys of the new pages, one per index. */
538
+ readonly keys: readonly string[];
539
+ }
540
+
541
+ /**
542
+ * Options for {@link createPdfJsEngine}.
543
+ *
544
+ * @public
545
+ */
546
+ export declare interface PdfJsEngineOptions {
547
+ /**
548
+ * Where your application serves the package's `dist/assets/` directory,
549
+ * on its own origin, such as `"/pdf-sdk/"`. pdf.js then loads its worker
550
+ * and its data files from its `pdfjs/` subdirectory, rather than from the
551
+ * inlined copies. Use it for Content Security Policies without
552
+ * `worker-src blob:`, and for accurate ICC colour, which only this mode
553
+ * supports (docs/adr/0006, docs/adr/0007). Pass the same URL to
554
+ * `createPdfProcessor`.
555
+ */
556
+ readonly assetsUrl?: string | URL;
557
+ /**
558
+ * The largest image pdf.js decodes, in pixels. Larger images are left
559
+ * unpainted. Defaults to the `maxImagePixels` limit, 100 megapixels.
560
+ */
561
+ readonly maxImagePixels?: number;
562
+ /* Excluded from this release type: _onDataRequest */
563
+ }
564
+
565
+ /**
566
+ * The type of {@link pdfLimitDefinitions}.
567
+ *
568
+ * @public
569
+ */
570
+ export declare type PdfLimitDefinitions = typeof pdfLimitDefinitions;
571
+
572
+ /**
573
+ * The PDF SDK's limit definitions: sdk-core's core limits plus three for PDFs
574
+ * (ADR 0004).
575
+ *
576
+ * | Limit | Code | Default maximum | Default warning |
577
+ * |---|---|---|---|
578
+ * | `maxFileSize` | `FILE_TOO_LARGE` | 100 MB | 50 MB |
579
+ * | `maxFiles` | `TOO_MANY_FILES` | 20 | none |
580
+ * | `maxDecodedSize` | `DECODED_SIZE_TOO_LARGE` | 500 MB | none |
581
+ * | `maxProcessingTime` | `PROCESSING_TIME_EXCEEDED` | 120 s | none |
582
+ * | `maxPages` | `TOO_MANY_PAGES` | 5,000 | 1,000 |
583
+ * | `maxSessionSize` | `SESSION_TOO_LARGE` | 300 MB | 150 MB |
584
+ * | `maxImagePixels` | `IMAGE_TOO_LARGE` | 100 megapixels | none |
585
+ *
586
+ * Sizes are decimal: 1 MB is 1,000,000 bytes.
587
+ *
588
+ * @public
589
+ */
590
+ export declare const pdfLimitDefinitions: {
591
+ readonly maxPages: {
592
+ readonly code: "TOO_MANY_PAGES";
593
+ readonly unit: "count";
594
+ readonly default: 5000;
595
+ readonly warning: 1000;
596
+ };
597
+ readonly maxSessionSize: {
598
+ readonly code: "SESSION_TOO_LARGE";
599
+ readonly unit: "bytes";
600
+ readonly default: 300000000;
601
+ readonly warning: 150000000;
602
+ };
603
+ readonly maxImagePixels: {
604
+ readonly code: "IMAGE_TOO_LARGE";
605
+ readonly unit: "pixels";
606
+ readonly default: 100000000;
607
+ };
608
+ readonly maxFileSize: {
609
+ readonly code: "FILE_TOO_LARGE";
610
+ readonly unit: "bytes";
611
+ readonly default: 100000000;
612
+ readonly warning: 50000000;
613
+ };
614
+ readonly maxFiles: {
615
+ readonly code: "TOO_MANY_FILES";
616
+ readonly unit: "count";
617
+ readonly default: 20;
618
+ };
619
+ readonly maxDecodedSize: {
620
+ readonly code: "DECODED_SIZE_TOO_LARGE";
621
+ readonly unit: "bytes";
622
+ readonly default: 500000000;
623
+ };
624
+ readonly maxProcessingTime: {
625
+ readonly code: "PROCESSING_TIME_EXCEEDED";
626
+ readonly unit: "milliseconds";
627
+ readonly default: 120000;
628
+ };
629
+ };
630
+
631
+ /**
632
+ * The names of the PDF SDK's limits.
633
+ *
634
+ * @public
635
+ */
636
+ export declare type PdfLimitName = keyof PdfLimitDefinitions;
637
+
638
+ /**
639
+ * The PDF SDK's limits, ready to resolve a host's `filePolicy`. Violations
640
+ * are thrown as {@link PdfError}, with `details` naming the limit.
641
+ *
642
+ * @example
643
+ * ```ts
644
+ * const policy = pdfLimits.resolve(props.filePolicy);
645
+ * policy.check("maxPages", pageCount); // throws PdfError("TOO_MANY_PAGES") above 5,000
646
+ * ```
647
+ *
648
+ * @public
649
+ */
650
+ export declare const pdfLimits: Limits<PdfLimitDefinitions>;
651
+
652
+ /**
653
+ * A link on a page to a web page or an email address. Only `http`, `https`
654
+ * and `mailto` links are reported (ADR 0012); links into the document and
655
+ * every other scheme, such as `javascript:`, are left out.
656
+ *
657
+ * @public
658
+ */
659
+ export declare interface PdfLink {
660
+ /** Where the link sits on the page, in fractions of the unrotated page. */
661
+ readonly rect: PdfRect;
662
+ /** The absolute URL, normalised. */
663
+ readonly url: string;
664
+ }
665
+
666
+ /**
667
+ * The type of {@link pdfMessages}, for typing a host's overrides with
668
+ * `MessageOverrides<PdfMessageCatalogue>`.
669
+ *
670
+ * @public
671
+ */
672
+ export declare type PdfMessageCatalogue = typeof pdfMessages;
673
+
674
+ /**
675
+ * The PDF SDK's English message catalogue: sdk-core's messages, and text for
676
+ * every {@link PdfErrorCode} and every limit's warning. Pass it to
677
+ * `createMessages` from `@hussmartinez/sdk-core`, with the host's locale and
678
+ * overrides.
679
+ *
680
+ * Error text is looked up by code, with the error's `details` as
681
+ * parameters, and never taken from `error.message` (ADR 0019).
682
+ *
683
+ * @example
684
+ * ```ts
685
+ * const messages = createMessages(pdfMessages, { locale: "en", overrides: props.messages });
686
+ * messages.error(error); // "This document has 6,200 pages, which is over the 5,000-page limit."
687
+ * messages.t("warnings.maxPages", { actual: 1_200 });
688
+ * ```
689
+ *
690
+ * @public
691
+ */
692
+ export declare const pdfMessages: {
693
+ readonly "errors.INVALID_PDF": "This file isn't a PDF, or it's too damaged to open.";
694
+ readonly "errors.PASSWORD_REQUIRED": "This PDF is protected with a password.";
695
+ readonly "errors.PROCESSING_FAILED": "Something went wrong while processing this PDF. Please try again.";
696
+ readonly "errors.TOO_MANY_PAGES": "This document has {actual, number} pages, which is over the {maximum, number}-page limit.";
697
+ 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.";
698
+ readonly "errors.IMAGE_TOO_LARGE": "Some images are too large to show. They're kept unchanged in the document.";
699
+ readonly "warnings.maxPages": {
700
+ readonly $plural: "actual";
701
+ } & {
702
+ readonly one: "This document has {actual} page. Large documents may be slow.";
703
+ readonly other: "This document has {actual} pages. Large documents may be slow.";
704
+ };
705
+ readonly "warnings.maxSessionSize": "The open documents use {actual, fileSize}. Clearing the undo history frees memory.";
706
+ readonly "warnings.maxImagePixels": "Some images are very large and may be slow to show.";
707
+ readonly "viewer.label": "Document";
708
+ readonly "viewer.empty": "No document is open.";
709
+ readonly "viewer.page": "Page {page} of {count}";
710
+ readonly "viewer.webLink": "Link to {destination}, opens in a new tab";
711
+ readonly "viewer.emailLink": "Email {destination}";
712
+ readonly "thumbnails.label": "Pages";
713
+ readonly "thumbnails.page": "Page {page} of {count}";
714
+ readonly "thumbnails.number": "{page}";
715
+ readonly "editor.label": "PDF editor";
716
+ readonly "editor.start.title": "Open a PDF to get started";
717
+ readonly "editor.start.retryTitle": "Try another PDF";
718
+ readonly "editor.start.choose": "Choose a PDF";
719
+ readonly "editor.start.retry": "Choose another PDF";
720
+ readonly "editor.start.hint": "Or drop one here. Your file stays on this device and is never uploaded.";
721
+ readonly "editor.opening": "Opening the PDF…";
722
+ readonly "editor.opened": {
723
+ readonly $plural: "count";
724
+ } & {
725
+ readonly one: "Opened a PDF with {count} page.";
726
+ readonly other: "Opened a PDF with {count} pages.";
727
+ };
728
+ readonly "editor.closed": "The PDF was closed.";
729
+ readonly "editor.undone": "Undone.";
730
+ readonly "editor.redone": "Redone.";
731
+ readonly "editor.rotated": {
732
+ readonly $plural: "count";
733
+ } & {
734
+ readonly one: "Rotated {count} page.";
735
+ readonly other: "Rotated {count} pages.";
736
+ };
737
+ readonly "toolbar.label": "PDF tools";
738
+ readonly "toolbar.groups.file": "File";
739
+ readonly "toolbar.groups.history": "History";
740
+ readonly "toolbar.groups.pages": "Pages";
741
+ readonly "toolbar.groups.other": "More tools";
742
+ readonly "tools.open": "Open a PDF";
743
+ readonly "tools.undo": "Undo";
744
+ readonly "tools.redo": "Redo";
745
+ readonly "tools.rotate-left": "Rotate left";
746
+ readonly "tools.rotate-right": "Rotate right";
747
+ readonly "errors.UNKNOWN": "Something went wrong. Please try again.";
748
+ readonly "errors.ABORTED": "The operation was cancelled.";
749
+ readonly "errors.TIMEOUT": "The operation took too long and was stopped.";
750
+ readonly "errors.WORKER_START_FAILED": "The file processor couldn't start. Reload the page and try again.";
751
+ readonly "errors.WORKER_PROTOCOL_MISMATCH": "The file processor is out of date. Reload the page to update it.";
752
+ readonly "errors.WORKER_CRASHED": "The file processor stopped unexpectedly. Please try again.";
753
+ readonly "errors.WORKER_TERMINATED": "The operation was stopped before it finished. Please try again.";
754
+ readonly "errors.WORKER_METHOD_NOT_FOUND": "This operation isn't available. Reload the page and try again.";
755
+ readonly "errors.WORKER_DATA_NOT_CLONEABLE": "Something went wrong while processing the file. Please try again.";
756
+ readonly "errors.UNSUPPORTED_ENVIRONMENT": "This browser doesn't support a feature this tool needs. Update your browser, or try another one.";
757
+ readonly "errors.FILE_TOO_LARGE": "This file is {actual, fileSize}, which is over the {maximum, fileSize} limit.";
758
+ readonly "errors.TOO_MANY_FILES": {
759
+ readonly $plural: "maximum";
760
+ } & {
761
+ readonly one: "You can add {maximum} file at a time.";
762
+ readonly other: "You can add up to {maximum} files at a time.";
763
+ };
764
+ readonly "errors.DECODED_SIZE_TOO_LARGE": "This file expands to more than {maximum, fileSize} when opened, which is over the limit.";
765
+ readonly "errors.PROCESSING_TIME_EXCEEDED": "Processing this file took too long and was stopped.";
766
+ readonly "warnings.maxFileSize": "This file is {actual, fileSize}. Large files may be slow to process.";
767
+ readonly "warnings.maxFiles": "Adding {actual} files at once may be slow.";
768
+ readonly "warnings.maxDecodedSize": "This file is very large once opened and may be slow to process.";
769
+ readonly "warnings.maxProcessingTime": "This is taking longer than usual.";
770
+ readonly "keys.control": "Ctrl";
771
+ readonly "keys.alt": "Alt";
772
+ readonly "keys.shift": "Shift";
773
+ readonly "keys.meta": "Meta";
774
+ readonly "keys.apple.control": "\u2303";
775
+ readonly "keys.apple.alt": "\u2325";
776
+ readonly "keys.apple.shift": "\u21E7";
777
+ readonly "keys.apple.meta": "\u2318";
778
+ readonly "keys.space": "Space";
779
+ readonly "keys.enter": "Enter";
780
+ readonly "keys.escape": "Esc";
781
+ readonly "keys.tab": "Tab";
782
+ readonly "keys.delete": "Delete";
783
+ readonly "keys.backspace": "Backspace";
784
+ readonly "keys.arrowUp": "\u2191";
785
+ readonly "keys.arrowDown": "\u2193";
786
+ readonly "keys.arrowLeft": "\u2190";
787
+ readonly "keys.arrowRight": "\u2192";
788
+ readonly "keys.home": "Home";
789
+ readonly "keys.end": "End";
790
+ readonly "keys.pageUp": "Page Up";
791
+ readonly "keys.pageDown": "Page Down";
792
+ };
793
+
794
+ /**
795
+ * Moves pages, keeping their relative order, so that the first of them ends
796
+ * up at position `to` of the resulting plan.
797
+ *
798
+ * @public
799
+ */
800
+ export declare interface PdfMovePagesCommand {
801
+ readonly type: "pdf.movePages";
802
+ readonly pages: readonly string[];
803
+ /** The zero-based position of the first moved page in the resulting plan. */
804
+ readonly to: number;
805
+ }
806
+
807
+ /**
808
+ * Facts about one page of a source document.
809
+ *
810
+ * @public
811
+ */
812
+ export declare interface PdfPageInfo {
813
+ /** Width of the unrotated media box, in PDF points (1/72 inch). */
814
+ readonly width: number;
815
+ /** Height of the unrotated media box, in PDF points. */
816
+ readonly height: number;
817
+ /** The page's own rotation, from its `/Rotate` entry. */
818
+ readonly rotation: PdfRotation;
819
+ }
820
+
821
+ /**
822
+ * The document being edited, as a plan over immutable sources
823
+ * (docs/adr/0003): the pages in order, and form values per source. Bytes
824
+ * are only built from it on export.
825
+ *
826
+ * @public
827
+ */
828
+ export declare interface PdfPlan {
829
+ readonly pages: readonly PdfPlanPage[];
830
+ /** Form values set in the session, by source ID, then field name. */
831
+ readonly formValues: Readonly<Record<string, Readonly<Record<string, PdfFieldValue>>>>;
832
+ }
833
+
834
+ /**
835
+ * One page of the page plan (docs/adr/0003): a page of a source document,
836
+ * with a rotation added to its own, and the annotations drawn on it. The key
837
+ * is stable while the page moves, so annotations, thumbnails and the
838
+ * selection follow it.
839
+ *
840
+ * @public
841
+ */
842
+ export declare interface PdfPlanPage {
843
+ /** Unique within the session, and never reused. */
844
+ readonly key: string;
845
+ /** The ID of the source document the page comes from. */
846
+ readonly source: string;
847
+ /** The page's zero-based index in its source. */
848
+ readonly pageIndex: number;
849
+ /** Rotation added to the page's own `/Rotate`. */
850
+ readonly rotation: PdfRotation;
851
+ /** Annotations drawn on the page, in drawing order. */
852
+ readonly annotations: readonly PdfAnnotation[];
853
+ }
854
+
855
+ /**
856
+ * A point on a page, as fractions of the page's unrotated media box: `x`
857
+ * from the left edge and `y` from the top edge, each from 0 to 1. Fractions
858
+ * keep positions independent of zoom and of the rotation the page is shown
859
+ * with (ADR 0003).
860
+ *
861
+ * @public
862
+ */
863
+ export declare interface PdfPoint {
864
+ readonly x: number;
865
+ readonly y: number;
866
+ }
867
+
868
+ /**
869
+ * The port for transforming PDFs: build an output document from sources,
870
+ * pages and export options (ADR 0003, ADR 0008). The SDK's qpdf adapter
871
+ * implements it in a worker; hosts can pass their own to the editor's
872
+ * `processor` prop, and every implementation must pass the processor's
873
+ * contract tests.
874
+ *
875
+ * One call runs the whole pipeline, so the bytes cross the worker boundary
876
+ * once in each direction. Failures reject with `PdfError`.
877
+ *
878
+ * @public
879
+ */
880
+ export declare interface PdfProcessor {
881
+ /**
882
+ * Builds a document. The sources' bytes are copied unless `transfer` is
883
+ * set. The result is a new buffer the caller owns.
884
+ *
885
+ * @throws `PdfError` with `INVALID_PDF` when a source can't be read,
886
+ * `PASSWORD_REQUIRED` when one is encrypted, and `TypeError` or
887
+ * `RangeError` for a job that refers to an unknown source or page.
888
+ */
889
+ build(job: PdfBuildJob, options?: PdfBuildOptions): Promise<Uint8Array>;
890
+ /** Releases the processor and its worker. Pending builds reject. */
891
+ destroy(): Promise<void>;
892
+ }
893
+
894
+ /**
895
+ * Options for {@link createPdfProcessor}.
896
+ *
897
+ * @public
898
+ */
899
+ export declare interface PdfProcessorOptions {
900
+ /**
901
+ * Where your application serves the package's `dist/assets/` directory,
902
+ * on its own origin, such as `"/pdf-sdk/"`, the same URL as the engine's.
903
+ * The worker then loads from `processing/processing.worker.js`, and
904
+ * fetches `processing/qpdf.wasm`, which it checks against this version's
905
+ * hash before using it. Use it for Content Security Policies without
906
+ * `worker-src blob:` (docs/adr/0007). By default the worker is inlined.
907
+ */
908
+ readonly assetsUrl?: string | URL;
909
+ }
910
+
911
+ /**
912
+ * A rectangle on a page, in the same fractions as {@link PdfPoint}: its
913
+ * top-left corner, width and height.
914
+ *
915
+ * @public
916
+ */
917
+ export declare interface PdfRect {
918
+ readonly x: number;
919
+ readonly y: number;
920
+ readonly width: number;
921
+ readonly height: number;
922
+ }
923
+
924
+ /**
925
+ * Removes an annotation from a page.
926
+ *
927
+ * @public
928
+ */
929
+ export declare interface PdfRemoveAnnotationCommand {
930
+ readonly type: "pdf.removeAnnotation";
931
+ readonly page: string;
932
+ /** The annotation's ID. */
933
+ readonly id: string;
934
+ }
935
+
936
+ /**
937
+ * How to render a page.
938
+ *
939
+ * @public
940
+ */
941
+ export declare interface PdfRenderOptions extends PdfCallOptions {
942
+ /** CSS pixels per PDF point. `1` renders a US Letter page 612 CSS pixels wide. */
943
+ readonly scale: number;
944
+ /**
945
+ * Device pixels per CSS pixel, usually `window.devicePixelRatio`. Defaults
946
+ * to 1. The engine lowers it as needed to stay within
947
+ * {@link PDF_MAX_CANVAS_PIXELS}.
948
+ */
949
+ readonly pixelRatio?: number;
950
+ /** Rotation added to the page's own, for the page plan (ADR 0003). Defaults to 0. */
951
+ readonly rotation?: PdfRotation;
952
+ }
953
+
954
+ /**
955
+ * Puts every page in a new order, given as every key exactly once. It's what
956
+ * undoing a move runs.
957
+ *
958
+ * @public
959
+ */
960
+ export declare interface PdfReorderPagesCommand {
961
+ readonly type: "pdf.reorderPages";
962
+ readonly order: readonly string[];
963
+ }
964
+
965
+ /**
966
+ * Puts deleted pages back at their positions. It's what undoing a delete
967
+ * runs, and it can be used directly.
968
+ *
969
+ * @public
970
+ */
971
+ export declare interface PdfRestorePagesCommand {
972
+ readonly type: "pdf.restorePages";
973
+ /** Each page, and the index it takes in the resulting plan, in increasing order. */
974
+ readonly entries: readonly {
975
+ readonly index: number;
976
+ readonly page: PdfPlanPage;
977
+ }[];
978
+ }
979
+
980
+ /**
981
+ * Rotates pages by an angle, added to their current rotation.
982
+ *
983
+ * @public
984
+ */
985
+ export declare interface PdfRotatePagesCommand {
986
+ readonly type: "pdf.rotatePages";
987
+ /** The keys of the pages to rotate. */
988
+ readonly pages: readonly string[];
989
+ /** Degrees, clockwise, in multiples of 90. Negative turns anticlockwise. */
990
+ readonly angle: number;
991
+ }
992
+
993
+ /**
994
+ * A rotation in degrees, clockwise.
995
+ *
996
+ * @public
997
+ */
998
+ export declare type PdfRotation = 0 | 90 | 180 | 270;
999
+
1000
+ /**
1001
+ * The document being edited, as a framework-agnostic store (ADR 0008): a
1002
+ * page plan over the documents opened and inserted, edited with commands,
1003
+ * with undo and redo (ADR 0010, docs/adr/0003). React binds to it with
1004
+ * `useSyncExternalStore`, and the element binds to the same store.
1005
+ *
1006
+ * @public
1007
+ */
1008
+ export declare interface PdfSession {
1009
+ /** The current snapshot, the same object until something changes. */
1010
+ getSnapshot(): PdfSessionSnapshot;
1011
+ /** Calls the listener after every change. Returns a function that unsubscribes. */
1012
+ subscribe(listener: () => void): () => void;
1013
+ /**
1014
+ * Opens a document, replacing the current one and its history once it has
1015
+ * opened. The file is checked against the file policy before it's read.
1016
+ * Rejects with a `PdfError`, which the snapshot also holds; the current
1017
+ * document, if any, stays open.
1018
+ */
1019
+ open(file: Blob | PdfBytes, options?: PdfCallOptions): Promise<void>;
1020
+ /**
1021
+ * Inserts the pages of another document, as one undoable step. If the
1022
+ * documents held would then exceed `maxSessionSize`, the session first
1023
+ * drops the redo steps, then the oldest undo steps, as far as needed to
1024
+ * release documents only they refer to, and sets `historyTrimmed`. If even
1025
+ * that isn't enough, it rejects with `SESSION_TOO_LARGE` and changes
1026
+ * nothing.
1027
+ */
1028
+ insert(file: Blob | PdfBytes, options?: PdfInsertOptions): Promise<void>;
1029
+ /**
1030
+ * Runs one command, or several as one undoable step. Throws `TypeError`
1031
+ * or `RangeError` for a command that doesn't fit the plan, and changes
1032
+ * nothing then.
1033
+ */
1034
+ execute(commands: PdfCommand | readonly PdfCommand[]): void;
1035
+ undo(): void;
1036
+ redo(): void;
1037
+ /** A plan page's size, and its rotation as shown: its own plus the plan's. */
1038
+ getPage(key: string, options?: PdfCallOptions): Promise<PdfPageInfo>;
1039
+ /** Renders a plan page with its rotation. */
1040
+ renderPage(key: string, canvas: HTMLCanvasElement, options: Omit<PdfRenderOptions, "rotation">): Promise<void>;
1041
+ /** A plan page's text, positioned on the unrotated page. */
1042
+ getTextContent(key: string, options?: PdfCallOptions): Promise<PdfTextContent>;
1043
+ /** A plan page's form fields, with the session's values applied. */
1044
+ getFormFields(key: string, options?: PdfCallOptions): Promise<readonly PdfFormField[]>;
1045
+ /** A plan page's web and email links, positioned on the unrotated page. */
1046
+ getLinks(key: string, options?: PdfCallOptions): Promise<readonly PdfLink[]>;
1047
+ /**
1048
+ * Builds the document as it is now: its pages in plan order, with their
1049
+ * rotations, form values and annotations, compressed or encrypted if asked.
1050
+ * An unchanged document with no options is returned as its original bytes,
1051
+ * without the processor. The result is a new buffer the caller owns.
1052
+ */
1053
+ export(options?: PdfExportOptions): Promise<Uint8Array>;
1054
+ /**
1055
+ * Selects pages, by key, replacing the selection. Keys the plan doesn't
1056
+ * have are ignored.
1057
+ */
1058
+ select(keys: readonly string[]): void;
1059
+ /** Records the page the user is looking at, as a viewer scrolls. */
1060
+ setCurrentPage(key: string): void;
1061
+ /** Makes a page current and asks viewers to bring it into view. */
1062
+ goToPage(key: string): void;
1063
+ /** Closes the document and releases its sources. */
1064
+ close(): Promise<void>;
1065
+ }
1066
+
1067
+ /**
1068
+ * Anonymous usage events, for a host's analytics (ADR 0010). They never
1069
+ * contain file names, contents, form values or annotation text.
1070
+ *
1071
+ * @public
1072
+ */
1073
+ export declare type PdfSessionEvent = {
1074
+ readonly type: "document_opened";
1075
+ readonly pageCount: number;
1076
+ } | {
1077
+ readonly type: "document_closed";
1078
+ } | {
1079
+ readonly type: "pages_inserted";
1080
+ readonly pageCount: number;
1081
+ } | {
1082
+ readonly type: "command";
1083
+ readonly commands: readonly PdfCommand["type"][];
1084
+ } | {
1085
+ readonly type: "undo";
1086
+ } | {
1087
+ readonly type: "redo";
1088
+ } | {
1089
+ readonly type: "document_exported";
1090
+ readonly pageCount: number;
1091
+ readonly compressed: boolean;
1092
+ readonly encrypted: boolean;
1093
+ } | {
1094
+ readonly type: "failed";
1095
+ readonly operation: "open" | "insert" | "export";
1096
+ readonly code: string;
1097
+ };
1098
+
1099
+ /**
1100
+ * Options for {@link createPdfSession}.
1101
+ *
1102
+ * @public
1103
+ */
1104
+ export declare interface PdfSessionOptions {
1105
+ /** Opens, reads and renders documents, such as `createPdfJsEngine()`. */
1106
+ readonly engine: PdfEngine;
1107
+ /** Builds exported documents, such as `createPdfProcessor()`. Needed for `export()`. */
1108
+ readonly processor?: PdfProcessor;
1109
+ /** Limits for untrusted files (docs/adr/0004). Unknown names throw. */
1110
+ readonly filePolicy?: PdfFilePolicyOverrides;
1111
+ /** Receives anonymous usage events. Errors it throws are ignored. */
1112
+ readonly onEvent?: (event: PdfSessionEvent) => void;
1113
+ }
1114
+
1115
+ /**
1116
+ * The session's state at one moment. Snapshots are immutable: every change
1117
+ * makes a new one, so `useSyncExternalStore` and other subscribers can
1118
+ * compare them by identity.
1119
+ *
1120
+ * @public
1121
+ */
1122
+ export declare interface PdfSessionSnapshot {
1123
+ readonly status: PdfSessionStatus;
1124
+ /** The document being edited: its pages, in order, and form values. */
1125
+ readonly plan: PdfPlan;
1126
+ /** The source documents the session holds. */
1127
+ readonly sources: readonly PdfSourceInfo[];
1128
+ readonly canUndo: boolean;
1129
+ readonly canRedo: boolean;
1130
+ /** Whether a document is being opened or inserted. */
1131
+ readonly busy: boolean;
1132
+ /** Why the last open or insert failed. Show its text by its code. */
1133
+ readonly error: PdfError | undefined;
1134
+ /** Limits the open documents are close to. */
1135
+ readonly warnings: readonly PdfWarning[];
1136
+ /**
1137
+ * The bytes of every document the session holds, which the
1138
+ * `maxSessionSize` limit counts: those the plan uses, and those the undo
1139
+ * and redo history can bring back (docs/adr/0004).
1140
+ */
1141
+ readonly sessionBytes: number;
1142
+ /**
1143
+ * Whether undo steps were dropped since the document opened, to make room
1144
+ * for an insert within `maxSessionSize`. Editors say so, because the
1145
+ * earliest edits can no longer be undone (ADR 0010).
1146
+ */
1147
+ readonly historyTrimmed: boolean;
1148
+ /**
1149
+ * The keys of the selected pages, in plan order. Tools act on them, such as
1150
+ * rotating the selection. View state: not undoable, and never in events.
1151
+ */
1152
+ readonly selection: readonly string[];
1153
+ /** The key of the page the user is looking at, if a document is open. */
1154
+ readonly currentPage: string | undefined;
1155
+ /**
1156
+ * The latest request to bring a page into view, from `goToPage`. Viewers
1157
+ * scroll to `page` each time `sequence` changes.
1158
+ */
1159
+ readonly navigation: {
1160
+ readonly page: string;
1161
+ readonly sequence: number;
1162
+ } | undefined;
1163
+ }
1164
+
1165
+ /**
1166
+ * What the session is doing.
1167
+ *
1168
+ * - `empty`: no document is open.
1169
+ * - `opening`: a document is being opened, replacing any other.
1170
+ * - `ready`: a document is open.
1171
+ * - `error`: no document is open, because the last open failed; `error`
1172
+ * says why. A failed open while a document is open keeps that document,
1173
+ * with the status `ready` and `error` set.
1174
+ *
1175
+ * @public
1176
+ */
1177
+ export declare type PdfSessionStatus = "empty" | "opening" | "ready" | "error";
1178
+
1179
+ /**
1180
+ * Sets a form field's value in one source, or clears the session's value with
1181
+ * `null`, so the document's own value applies again.
1182
+ *
1183
+ * @public
1184
+ */
1185
+ export declare interface PdfSetFieldValueCommand {
1186
+ readonly type: "pdf.setFieldValue";
1187
+ readonly source: string;
1188
+ readonly field: string;
1189
+ readonly value: PdfFieldValue | null;
1190
+ }
1191
+
1192
+ /**
1193
+ * A source document the session holds: opened or inserted, never changed.
1194
+ *
1195
+ * @public
1196
+ */
1197
+ export declare interface PdfSourceInfo {
1198
+ /** Unique within the session, and never reused. */
1199
+ readonly id: string;
1200
+ readonly pageCount: number;
1201
+ /** The size of its bytes. */
1202
+ readonly byteLength: number;
1203
+ }
1204
+
1205
+ /**
1206
+ * A freehand pen stroke, or a highlighter stroke, which is drawn translucent.
1207
+ *
1208
+ * @public
1209
+ */
1210
+ export declare interface PdfStrokeAnnotation {
1211
+ readonly id: string;
1212
+ readonly type: "pen" | "highlight";
1213
+ /** The stroke's points, in page fractions. */
1214
+ readonly points: readonly PdfPoint[];
1215
+ readonly color: PdfColor;
1216
+ /** Line width, as a fraction of the page's height. */
1217
+ readonly width: number;
1218
+ }
1219
+
1220
+ /**
1221
+ * A text note placed on the page.
1222
+ *
1223
+ * @public
1224
+ */
1225
+ export declare interface PdfTextAnnotation {
1226
+ readonly id: string;
1227
+ readonly type: "text";
1228
+ /** The top-left corner of the text, in page fractions. */
1229
+ readonly at: PdfPoint;
1230
+ /** The note's text. It's drawn as text, never interpreted as markup. */
1231
+ readonly text: string;
1232
+ /** Font size, as a fraction of the page's height. */
1233
+ readonly size: number;
1234
+ readonly color: PdfColor;
1235
+ }
1236
+
1237
+ /**
1238
+ * The text of one page, in reading order as the document stores it.
1239
+ *
1240
+ * @public
1241
+ */
1242
+ export declare interface PdfTextContent {
1243
+ readonly items: readonly PdfTextItem[];
1244
+ }
1245
+
1246
+ /**
1247
+ * A run of text on a page, for the text layer, selection, assistive
1248
+ * technology and search. Positions are fractions of the unrotated media box
1249
+ * ({@link PdfRect}).
1250
+ *
1251
+ * @public
1252
+ */
1253
+ export declare interface PdfTextItem {
1254
+ /** The text, as the document encodes it. Always rendered as text, never as markup. */
1255
+ readonly text: string;
1256
+ /** The box the text occupies. */
1257
+ readonly rect: PdfRect;
1258
+ /** Rotation of the text's baseline, in degrees, counter-clockwise. */
1259
+ readonly angle: number;
1260
+ /** Whether a line break follows this item. */
1261
+ readonly endOfLine: boolean;
1262
+ }
1263
+
1264
+ /**
1265
+ * Options for calls that take PDF bytes.
1266
+ *
1267
+ * @public
1268
+ */
1269
+ export declare interface PdfTransferOptions extends PdfCallOptions {
1270
+ /**
1271
+ * Hand the bytes' buffers to the worker instead of copying them. The
1272
+ * caller's buffers are detached and must not be used afterwards. Defaults
1273
+ * to `false`, so a caller's bytes are never detached by surprise.
1274
+ */
1275
+ readonly transfer?: boolean;
1276
+ }
1277
+
1278
+ /**
1279
+ * A file policy warning: a value at or above a limit's warning threshold,
1280
+ * but within its maximum (ADR 0020). Show its text from
1281
+ * `warnings.<limit>` in the message catalogue, with `actual` as a parameter.
1282
+ *
1283
+ * @public
1284
+ */
1285
+ export declare interface PdfWarning {
1286
+ readonly limit: PdfLimitName;
1287
+ readonly actual: number;
1288
+ }
1289
+
1290
+ /**
1291
+ * The URL, normalised, if it's an absolute `http`, `https` or `mailto` URL
1292
+ * without credentials (ADR 0012), and otherwise undefined. Every engine
1293
+ * adapter filters links with it, and the viewer checks again before
1294
+ * rendering one.
1295
+ *
1296
+ * URLs with a user name or password are refused: in
1297
+ * `https://bank.example@evil.example/`, the part a reader notices is a user
1298
+ * name, and the link goes to `evil.example`, a common phishing shape.
1299
+ *
1300
+ * @public
1301
+ */
1302
+ export declare function safeLinkUrl(url: string): string | undefined;
1303
+
1304
+ export { }