pdfcedar 0.0.0-stage → 0.1.1-beta.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 (236) hide show
  1. package/LICENSE +47 -0
  2. package/README.md +237 -2
  3. package/bin/pdfcedar-assets.mjs +25 -0
  4. package/dist/THIRD_PARTY_NOTICES.md +411 -0
  5. package/dist/chunks/errors-Cq5TPos_.js +185 -0
  6. package/dist/chunks/pdf-Bt7uz0Yc.js +18800 -0
  7. package/dist/chunks/src-CyL6Tva1.js +12023 -0
  8. package/dist/chunks/src-GGqFXcUj.js +3695 -0
  9. package/dist/index.d.cts +4 -0
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.js +4483 -0
  12. package/dist/index.umd.cjs +1026 -0
  13. package/dist/pdfcedar.umd.js +1026 -0
  14. package/dist/pdfjs/LICENSE +177 -0
  15. package/dist/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  16. package/dist/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  17. package/dist/pdfjs/cmaps/78-H.bcmap +0 -0
  18. package/dist/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  19. package/dist/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  20. package/dist/pdfjs/cmaps/78-V.bcmap +0 -0
  21. package/dist/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  22. package/dist/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  23. package/dist/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  24. package/dist/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  25. package/dist/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  26. package/dist/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  27. package/dist/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  28. package/dist/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  29. package/dist/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  30. package/dist/pdfjs/cmaps/Add-H.bcmap +0 -0
  31. package/dist/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  32. package/dist/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  33. package/dist/pdfjs/cmaps/Add-V.bcmap +0 -0
  34. package/dist/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  35. package/dist/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  36. package/dist/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  37. package/dist/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  38. package/dist/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  39. package/dist/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  40. package/dist/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  41. package/dist/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  42. package/dist/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  43. package/dist/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  44. package/dist/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  45. package/dist/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  46. package/dist/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  47. package/dist/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  48. package/dist/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  49. package/dist/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  50. package/dist/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  51. package/dist/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  52. package/dist/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  53. package/dist/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  54. package/dist/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  55. package/dist/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  56. package/dist/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  57. package/dist/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  58. package/dist/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  59. package/dist/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  60. package/dist/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  61. package/dist/pdfjs/cmaps/B5-H.bcmap +0 -0
  62. package/dist/pdfjs/cmaps/B5-V.bcmap +0 -0
  63. package/dist/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  64. package/dist/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  65. package/dist/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  66. package/dist/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  67. package/dist/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  68. package/dist/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  69. package/dist/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  70. package/dist/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  71. package/dist/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  72. package/dist/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  73. package/dist/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  74. package/dist/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  75. package/dist/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  76. package/dist/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  77. package/dist/pdfjs/cmaps/EUC-H.bcmap +0 -0
  78. package/dist/pdfjs/cmaps/EUC-V.bcmap +0 -0
  79. package/dist/pdfjs/cmaps/Ext-H.bcmap +0 -0
  80. package/dist/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  81. package/dist/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  82. package/dist/pdfjs/cmaps/Ext-V.bcmap +0 -0
  83. package/dist/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  84. package/dist/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  85. package/dist/pdfjs/cmaps/GB-H.bcmap +4 -0
  86. package/dist/pdfjs/cmaps/GB-V.bcmap +0 -0
  87. package/dist/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  88. package/dist/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  89. package/dist/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  90. package/dist/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  91. package/dist/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  92. package/dist/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  93. package/dist/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  94. package/dist/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  95. package/dist/pdfjs/cmaps/GBT-H.bcmap +0 -0
  96. package/dist/pdfjs/cmaps/GBT-V.bcmap +0 -0
  97. package/dist/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  98. package/dist/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  99. package/dist/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  100. package/dist/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  101. package/dist/pdfjs/cmaps/H.bcmap +0 -0
  102. package/dist/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  103. package/dist/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  104. package/dist/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  105. package/dist/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  106. package/dist/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  107. package/dist/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  108. package/dist/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  109. package/dist/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  110. package/dist/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  111. package/dist/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  112. package/dist/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  113. package/dist/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  114. package/dist/pdfjs/cmaps/Hankaku.bcmap +0 -0
  115. package/dist/pdfjs/cmaps/Hiragana.bcmap +0 -0
  116. package/dist/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  117. package/dist/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  118. package/dist/pdfjs/cmaps/KSC-H.bcmap +0 -0
  119. package/dist/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  120. package/dist/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  121. package/dist/pdfjs/cmaps/KSC-V.bcmap +0 -0
  122. package/dist/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  123. package/dist/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  124. package/dist/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  125. package/dist/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  126. package/dist/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  127. package/dist/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  128. package/dist/pdfjs/cmaps/Katakana.bcmap +0 -0
  129. package/dist/pdfjs/cmaps/LICENSE +36 -0
  130. package/dist/pdfjs/cmaps/NWP-H.bcmap +0 -0
  131. package/dist/pdfjs/cmaps/NWP-V.bcmap +0 -0
  132. package/dist/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  133. package/dist/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  134. package/dist/pdfjs/cmaps/Roman.bcmap +0 -0
  135. package/dist/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  136. package/dist/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  137. package/dist/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  138. package/dist/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  139. package/dist/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  140. package/dist/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  141. package/dist/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  142. package/dist/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  143. package/dist/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  144. package/dist/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  145. package/dist/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  146. package/dist/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  147. package/dist/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  148. package/dist/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  149. package/dist/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  150. package/dist/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  151. package/dist/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  152. package/dist/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  153. package/dist/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  154. package/dist/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  155. package/dist/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  156. package/dist/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  157. package/dist/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  158. package/dist/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  159. package/dist/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  160. package/dist/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  161. package/dist/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  162. package/dist/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  163. package/dist/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  164. package/dist/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  165. package/dist/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  166. package/dist/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  167. package/dist/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  168. package/dist/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  169. package/dist/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  170. package/dist/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  171. package/dist/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  172. package/dist/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  173. package/dist/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  174. package/dist/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  175. package/dist/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  176. package/dist/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  177. package/dist/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  178. package/dist/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  179. package/dist/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  180. package/dist/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  181. package/dist/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  182. package/dist/pdfjs/cmaps/V.bcmap +0 -0
  183. package/dist/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  184. package/dist/pdfjs/iccs/CGATS001Compat-v2-micro.icc +0 -0
  185. package/dist/pdfjs/iccs/LICENSE +116 -0
  186. package/dist/pdfjs/pdf.worker.min.mjs +27 -0
  187. package/dist/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  188. package/dist/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  189. package/dist/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  190. package/dist/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  191. package/dist/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  192. package/dist/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  193. package/dist/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  194. package/dist/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  195. package/dist/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  196. package/dist/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  197. package/dist/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  198. package/dist/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  199. package/dist/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  200. package/dist/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  201. package/dist/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  202. package/dist/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  203. package/dist/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  204. package/dist/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  205. package/dist/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  206. package/dist/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  207. package/dist/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  208. package/dist/pdfjs/wasm/LICENSE_QCMS +21 -0
  209. package/dist/pdfjs/wasm/jbig2.wasm +0 -0
  210. package/dist/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  211. package/dist/pdfjs/wasm/openjpeg.wasm +0 -0
  212. package/dist/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  213. package/dist/pdfjs/wasm/qcms_bg.wasm +0 -0
  214. package/dist/types/core/annotation-geometry.d.cts +36 -0
  215. package/dist/types/core/annotation-geometry.d.ts +36 -0
  216. package/dist/types/core/annotation-manager.d.cts +97 -0
  217. package/dist/types/core/annotation-manager.d.ts +97 -0
  218. package/dist/types/core/annotations.d.cts +106 -0
  219. package/dist/types/core/annotations.d.ts +106 -0
  220. package/dist/types/core/errors.d.cts +11 -0
  221. package/dist/types/core/errors.d.ts +11 -0
  222. package/dist/types/core/events.d.cts +10 -0
  223. package/dist/types/core/events.d.ts +10 -0
  224. package/dist/types/core/forms.d.cts +109 -0
  225. package/dist/types/core/forms.d.ts +109 -0
  226. package/dist/types/core/index.d.cts +9 -0
  227. package/dist/types/core/index.d.ts +9 -0
  228. package/dist/types/core/types.d.cts +103 -0
  229. package/dist/types/core/types.d.ts +103 -0
  230. package/dist/types/core/undo.d.cts +47 -0
  231. package/dist/types/core/undo.d.ts +47 -0
  232. package/dist/types/core/validate.d.cts +22 -0
  233. package/dist/types/core/validate.d.ts +22 -0
  234. package/dist/viewer.d.cts +96 -0
  235. package/dist/viewer.d.ts +96 -0
  236. package/package.json +55 -4
package/LICENSE ADDED
@@ -0,0 +1,47 @@
1
+ PDFCedar Commercial License
2
+
3
+ Copyright (c) 2026 Waseem Ahmad Dar. All rights reserved.
4
+
5
+ PDFCedar is commercial software. It is licensed, not sold. By installing or using it you accept these terms.
6
+ Pricing and the full terms of service are at https://pdfcedar.brimij.com.
7
+
8
+ 1. Evaluation (no licence key)
9
+ You may install and use PDFCedar free of charge to evaluate it and to develop and test your
10
+ applications. Without a valid licence key the software runs in trial mode: pages, saved files and
11
+ printed output carry a "PDFCedar trial" watermark. You may not use trial mode in production, and you
12
+ may not remove, hide or work around the watermark or the licence check.
13
+
14
+ 2. Production use (licence key required)
15
+ Using PDFCedar in an application available to end users requires a paid licence key. A key covers
16
+ one product, on the domains listed in it (a wildcard such as *.example.com covers its subdomains),
17
+ for the term of the plan you bought. Any valid key also works on localhost for development. There are
18
+ no limits on developers, end users or documents.
19
+
20
+ 3. Distribution
21
+ You may distribute PDFCedar only as part of your own application, bundled in that application's
22
+ build. You may not:
23
+ a. sell, sublicense, rent or redistribute it on its own;
24
+ b. offer it, or a product whose main purpose is PDF viewing or editing built on it, to other
25
+ developers as a software development kit, library or component;
26
+ c. modify, decompile or reverse engineer it, except where the law allows this despite this term;
27
+ d. share licence keys outside your organisation.
28
+
29
+ 4. Term and termination
30
+ A licence lasts for the term of the plan. When it expires, the software returns to trial mode until it
31
+ is renewed. Updates released during the term are included. If you breach these terms your licence ends
32
+ and you must stop using the software in production.
33
+
34
+ 5. Notices
35
+ This notice must be kept in all copies.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
38
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
39
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
41
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE TOTAL LIABILITY OF THE AUTHORS IS LIMITED TO THE FEES
42
+ YOU PAID FOR THE SOFTWARE IN THE TWELVE MONTHS BEFORE A CLAIM.
43
+
44
+ Contact: sales@brimij.com
45
+
46
+ Third-party components bundled in this package keep their own licences: pdf.js (Apache License 2.0,
47
+ see dist/pdfjs/LICENSE) and pdf-lib (MIT License, see dist/THIRD_PARTY_NOTICES.md).
package/README.md CHANGED
@@ -1,3 +1,238 @@
1
- # Temporary Holding Version
1
+ # PDFCedar
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An embeddable PDF viewer for web apps. View, search, annotate, rearrange pages and save standard PDFs, in
4
+ React, Vue, Angular or plain HTML. One function, no framework lock-in.
5
+
6
+ > **Free to try, licensed for production.** Every feature works without a key, with a "PDFCedar trial" watermark.
7
+ > Live demo, docs and pricing: [pdfcedar.brimij.com](https://pdfcedar.brimij.com). Terms: [LICENSE](./LICENSE).
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install pdfcedar
13
+ npx pdfcedar-assets public/pdfcedar
14
+ ```
15
+
16
+ The second command copies the PDF engine (a web worker plus font and character-map files, about 4.5 MB) into a
17
+ folder your app serves. Bundlers copy JavaScript, not these files, so they need this one step. Add it to your
18
+ `postinstall` script so upgrades stay in sync:
19
+
20
+ ```json
21
+ "scripts": { "postinstall": "pdfcedar-assets public/pdfcedar" }
22
+ ```
23
+
24
+ ## Quick start
25
+
26
+ ```html
27
+ <div id="viewer" style="height: 100vh"></div>
28
+ ```
29
+
30
+ ```js
31
+ import { createViewer } from 'pdfcedar';
32
+
33
+ const viewer = await createViewer({
34
+ container: document.getElementById('viewer'),
35
+ document: '/files/contract.pdf', // or a File, Blob or ArrayBuffer
36
+ assetBaseUrl: '/pdfcedar/', // where pdfcedar-assets copied the engine files
37
+ user: { id: 'u1', name: 'Asha' }, // author name on annotations
38
+ });
39
+
40
+ viewer.on('annotationAdded', ({ annotation }) => console.log('added', annotation));
41
+ const bytes = await viewer.save(); // a standard PDF with all annotations and page changes
42
+ ```
43
+
44
+ The container needs a height; the viewer fills it. (Without one, the viewer falls back to `80vh` and warns in the
45
+ console: otherwise it would grow to the whole document's length and draw every page.)
46
+
47
+ **Server-side rendering** (Next.js, Nuxt, Angular SSR): importing `pdfcedar` on the server is safe and does nothing;
48
+ the PDF engine loads only when `createViewer` runs in the browser. Call it from client-only code (`useEffect`,
49
+ `onMounted`, `afterNextRender`).
50
+
51
+ **Bundle size:** the entry is about 60 kB gzipped. The PDF engine (about 165 kB gzipped) and the save code load on
52
+ demand as separate chunks. Vite may still warn that those chunks are over 500 kB; that's expected, and
53
+ `build.chunkSizeWarningLimit: 1000` silences it.
54
+
55
+ ### Without a bundler
56
+
57
+ ```html
58
+ <div id="viewer" style="height: 100vh"></div>
59
+ <script src="https://cdn.jsdelivr.net/npm/pdfcedar@0.1.1-beta.0/dist/pdfcedar.umd.js"></script>
60
+ <script>
61
+ PDFCedar.createViewer({ container: document.getElementById('viewer'), document: 'file.pdf' });
62
+ </script>
63
+ ```
64
+
65
+ `dist/pdfcedar.umd.js` works from jsDelivr, unpkg or your own server. It finds the engine files (`dist/pdfjs/`) next
66
+ to itself, so `assetBaseUrl` isn't needed. Pin the exact version, as here: CDN ranges like `@0.1` skip beta releases.
67
+
68
+ ### Frameworks
69
+
70
+ | | Mount in | Destroy in |
71
+ |---|---|---|
72
+ | React | `useEffect` | the effect's cleanup |
73
+ | Vue | `onMounted` | `onBeforeUnmount` |
74
+ | Angular | `ngAfterViewInit` | `ngOnDestroy` |
75
+
76
+ Complete, runnable examples are in the repository's `examples/` folder. Always call `viewer.destroy()` when the
77
+ component goes away; it frees the worker, canvases and listeners.
78
+
79
+ ## Options
80
+
81
+ | Option | Type | |
82
+ |---|---|---|
83
+ | `container` | `HTMLElement` | Required. The viewer fills it. |
84
+ | `document` | `string \| File \| Blob \| ArrayBuffer` | Required. A URL (fetched with range requests) or the file itself. |
85
+ | `licenseKey` | `string` | Your licence key (see below). Without a valid one the viewer runs in trial mode. |
86
+ | `assetBaseUrl` | `string` | URL of the folder holding the engine files. |
87
+ | `theme` | `'light' \| 'dark' \| ThemeObject` | A `ThemeObject` maps `--pl-*` CSS variables to values. |
88
+ | `toolbar` | `ToolName[]` | Which tools to show. Omit for all. |
89
+ | `readOnly` | `boolean` | Viewing, search and print only. |
90
+ | `user` | `{ id, name }` | Author of new annotations and replies. |
91
+ | `collaboration` | `{ serverUrl, roomId }` | Real-time sharing with everyone in the room (see below). |
92
+ | `signatureStore` | `{ load(), save(list) }` | Where the user's saved signatures persist (e.g. your backend). Without it they last for the page session. |
93
+ | `password` | `string` | For password-protected PDFs. If it's missing or wrong, the viewer asks the user; `createViewer` rejects with `EncryptedDocumentError` if they cancel. |
94
+ | `httpHeaders` | `Record<string, string>` | Sent when `document` is a URL, e.g. `{ Authorization: 'Bearer …' }` for files behind a login. |
95
+ | `withCredentials` | `boolean` | Send cookies when `document` is a URL on another origin (the server must allow credentials). |
96
+
97
+ `ToolName` is any of `'zoom'`, `'search'`, `'download'`, `'print'`, `'pages'`, `'select'`, `'highlight'`, `'underline'`,
98
+ `'strikeout'`, `'note'`, `'ink'`, `'rectangle'`, `'ellipse'`, `'line'`, `'arrow'`, `'freeText'`, `'signature'`, `'redaction'`.
99
+
100
+ ## API
101
+
102
+ ```ts
103
+ // Events: documentLoaded, pageChanged, annotationAdded, annotationChanged, annotationRemoved,
104
+ // formFieldChanged, signatureAdded, saved. Payloads are typed (see ViewerEvents).
105
+ viewer.on(event, handler); viewer.off(event, handler);
106
+
107
+ // Navigation
108
+ viewer.goToPage(3); viewer.setZoom(1.5); viewer.fit('width'); // or 'page'
109
+ const hits = await viewer.search('total'); // highlights every match
110
+
111
+ // Annotations (coordinates in PDF points, origin bottom-left)
112
+ const note = viewer.annotations.add({ type: 'note', page: 1, rect: { x: 72, y: 700, width: 24, height: 24 }, contents: 'Check this' });
113
+ viewer.annotations.update(note.id, { color: '#2563eb' });
114
+ viewer.annotations.remove(note.id);
115
+ viewer.annotations.list(); // or list({ page: 1, type: 'highlight' })
116
+ const json = viewer.annotations.export(); // save to your backend…
117
+ viewer.annotations.import(json); // …and restore later
118
+ viewer.undo(); viewer.redo();
119
+
120
+ // Pages (1-based)
121
+ viewer.pages.rotate(1, 90); viewer.pages.delete(2); viewer.pages.move(3, 1);
122
+ await viewer.pages.merge(file);
123
+
124
+ // Forms: the file's own fields are drawn as fillable controls
125
+ viewer.forms.getValues(); // { fullName: '', subscribe: false, plan: 'pro', interests: ['A'] }
126
+ viewer.forms.setValues({ fullName: 'Asha Rao', subscribe: true }); // one undo step; FormValueError if invalid
127
+ viewer.forms.flatten(); // on save, fields become part of the page
128
+
129
+ // Signatures: the Signature tool lets users draw, type or upload one; from code:
130
+ const signature = await viewer.signatures.add({
131
+ page: 1,
132
+ rect: { x: 360, y: 90, width: 150, height: 50 },
133
+ image: blobOrDataUrlOrUrl, // PNG, JPEG, WebP, SVG…
134
+ });
135
+ // Movable, resizable and undoable until saved; saving draws it into the page.
136
+
137
+ // Redaction: mark areas (the Redact tool marks selected text or a dragged box), then apply
138
+ viewer.redaction.mark({ page: 1, rect: { x: 72, y: 640, width: 180, height: 14 } });
139
+ await viewer.redaction.apply(); // final: marks turn black, undo history is cleared
140
+ const redacted = await viewer.save(); // the content under the marks is removed from the file
141
+
142
+ // Output
143
+ const bytes = await viewer.save(); // Uint8Array
144
+ await viewer.download('reviewed.pdf');
145
+ await viewer.print();
146
+ viewer.destroy();
147
+ ```
148
+
149
+ Annotation types: `highlight`, `underline`, `strikeout`, `note`, `reply`, `ink`, `rectangle`, `ellipse`, `line`,
150
+ `arrow`, `freeText`, `signature`. Saved files use standard PDF annotations with appearance streams, so Acrobat Reader, Chrome,
151
+ Firefox and Safari show them and can edit them. Signatures are the exception: saving draws them into the page, so they
152
+ can no longer be moved or removed in any viewer.
153
+
154
+ ## Redaction
155
+
156
+ Applied redactions remove content from the saved file, not just cover it:
157
+
158
+ - **Text:** removed glyph by glyph. The rest of the line keeps its position.
159
+ - **Images, including scans:** the pixels under the mark are blacked out in the image itself.
160
+ - **Shapes:** vector shapes entirely inside a mark are removed.
161
+ - **Annotations and form fields:** any that overlap a mark are deleted.
162
+ - **Hidden copies:** `/ActualText` that repeats removed text is stripped, and no copy of the original content stays in the file.
163
+
164
+ Unapplied marks are saved as standard `/Redact` annotations, which Acrobat can apply.
165
+
166
+ ## Theming
167
+
168
+ ```css
169
+ .pdfcedar-viewer {
170
+ --pl-accent: #7c3aed;
171
+ --pl-bg: #f4f4f5;
172
+ --pl-surface: #ffffff;
173
+ --pl-text: #18181b;
174
+ --pl-font: 'Inter', system-ui, sans-serif;
175
+ }
176
+ ```
177
+
178
+ ## Collaboration
179
+
180
+ ```js
181
+ createViewer({
182
+ container,
183
+ document: '/files/contract.pdf',
184
+ user: { id: 'u1', name: 'Asha Rao' },
185
+ collaboration: { serverUrl: 'wss://collab.example.com', roomId: 'contract-123' },
186
+ });
187
+ ```
188
+
189
+ - **What's shared:** everyone in the room sees each other's annotations, replies, signatures, redaction marks and form
190
+ values within a second, and the toolbar shows who's online.
191
+ - **Events and undo:** changes from others fire the usual events with `source: 'remote'`, and never enter your undo
192
+ history.
193
+ - **Offline:** edits made offline sync when the connection is back.
194
+ - **Not shared:** page changes (rotate, delete, reorder) stay per person, so everyone in a room should have the same
195
+ pages.
196
+ - **Server:** run your own. The repository's `apps/collab-server` is a small ready-made one (`node src/server.mjs`);
197
+ any y-websocket-compatible server works too. Documents never pass through PDFCedar's servers.
198
+ - **Size:** the collaboration code loads only when this option is set.
199
+
200
+ ## Licence key
201
+
202
+ ```js
203
+ createViewer({ container, document, licenseKey: 'PL1.eyJ2Ijox…' });
204
+ ```
205
+
206
+ - **Offline check:** the key is checked in the browser, with no network call. It's a signed list of the domains
207
+ you bought it for, so nothing about your users or documents leaves the page.
208
+ - **Domains:** `example.com` covers only that host; `*.example.com` covers its subdomains. Any valid key also works
209
+ on `localhost` and `127.0.0.1`, for development.
210
+ - **Trial mode:** without a valid key (missing, mistyped, expired, or on another domain) everything still works,
211
+ but the pages carry a "PDFCedar trial" watermark and a Trial badge. Saved, downloaded and printed files are
212
+ watermarked too. The console says why, as does the
213
+ viewer element's `data-license-reason` attribute.
214
+
215
+ ## Phones and tablets
216
+
217
+ - **Pinch** zooms around your fingers; on desktop, Ctrl/⌘ + wheel and trackpad pinches do the same.
218
+ - **Drawing:** one finger draws with the drawing tools. A second finger turns a stroke into a pinch, so no stray line is left.
219
+ - **Select tool:** touching a selected annotation drags it; elsewhere, one finger scrolls. Handles are larger on touch screens.
220
+ - **Narrow viewers** (under 640 px wide, by the viewer's own width) get a compact toolbar:
221
+ - **Annotate** shows the tools in a row that scrolls sideways.
222
+ - **More** holds Search, Download and Print.
223
+ - The sidebar is a drawer that starts closed.
224
+
225
+ Give your page `<meta name="viewport" content="width=device-width, initial-scale=1">`, as every mobile page needs.
226
+
227
+ ## Browser support
228
+
229
+ Chrome and Edge 119+, Firefox 121+, Safari 17.4+ (desktop and iOS), Chrome on Android.
230
+
231
+ ## Errors
232
+
233
+ - `createViewer` rejects if the file can't be opened (bad URL, not a PDF).
234
+ - `annotations.add` / `update` / `import` throw `AnnotationValidationError` (with a `path` such as `rect.width`) for invalid input.
235
+ - `forms.setValues` throws `FormValueError` (with the `field` name) for an unknown field or a value it can't hold; nothing changes.
236
+ - `annotations.update` / `remove` throw `AnnotationValidationError` for an applied redaction (applying is final).
237
+ - `createViewer` rejects with `EncryptedDocumentError` when a password-protected PDF is opened and the user cancels the password prompt.
238
+ - `save` / `download` / `print` throw `EncryptedDocumentError` for password-protected PDFs (viewing, annotating and searching them work; writing encrypted files back out is not supported yet).
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ // Copies PDFCedar's PDF engine files (pdf.js worker, fonts, cMaps) into a folder your app serves.
3
+ // npx pdfcedar-assets public/pdfcedar → then pass assetBaseUrl: '/pdfcedar/' to createViewer.
4
+ // Bundlers (Vite, webpack, Angular CLI) copy JavaScript but not these runtime files, so this step makes them available.
5
+ import { cpSync, existsSync, readFileSync, rmSync } from 'node:fs';
6
+ import { dirname, join, resolve } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const args = process.argv.slice(2);
10
+ if (args.length !== 1 || args[0].startsWith('-')) {
11
+ console.log('Usage: pdfcedar-assets <folder>\n\nExample: pdfcedar-assets public/pdfcedar, then createViewer({ assetBaseUrl: "/pdfcedar/", ... })');
12
+ process.exit(args.includes('--help') || args.includes('-h') ? 0 : 1);
13
+ }
14
+
15
+ const source = join(dirname(fileURLToPath(import.meta.url)), '..', 'dist', 'pdfjs');
16
+ if (!existsSync(source)) {
17
+ console.error(`pdfcedar-assets: ${source} is missing. Reinstall the pdfcedar package.`);
18
+ process.exit(1);
19
+ }
20
+ const target = resolve(args[0]);
21
+ // Start clean so files from an older version don't linger next to the new worker.
22
+ rmSync(target, { recursive: true, force: true });
23
+ cpSync(source, target, { recursive: true });
24
+ const { version } = JSON.parse(readFileSync(join(source, '..', '..', 'package.json'), 'utf8'));
25
+ console.log(`pdfcedar-assets: copied PDFCedar ${version} engine files to ${target}`);