@kitsy/pdf 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +16 -0
  4. package/README.md +229 -2
  5. package/THIRD_PARTY_NOTICES.md +48 -0
  6. package/dist/chunk-2K5X7L5J.js +43 -0
  7. package/dist/chunk-2K5X7L5J.js.map +1 -0
  8. package/dist/chunk-4EAYBJ6G.js +362 -0
  9. package/dist/chunk-4EAYBJ6G.js.map +1 -0
  10. package/dist/chunk-4LBJTDV5.js +165 -0
  11. package/dist/chunk-4LBJTDV5.js.map +1 -0
  12. package/dist/chunk-4USCGC24.js +304 -0
  13. package/dist/chunk-4USCGC24.js.map +1 -0
  14. package/dist/chunk-5OIMR74G.js +273 -0
  15. package/dist/chunk-5OIMR74G.js.map +1 -0
  16. package/dist/chunk-6NFNAKWA.js +257 -0
  17. package/dist/chunk-6NFNAKWA.js.map +1 -0
  18. package/dist/chunk-7MTEMQLL.js +47 -0
  19. package/dist/chunk-7MTEMQLL.js.map +1 -0
  20. package/dist/chunk-7V4SWTUK.js +83 -0
  21. package/dist/chunk-7V4SWTUK.js.map +1 -0
  22. package/dist/chunk-7XH7MFZ4.js +295 -0
  23. package/dist/chunk-7XH7MFZ4.js.map +1 -0
  24. package/dist/chunk-BK3MYSUS.js +61 -0
  25. package/dist/chunk-BK3MYSUS.js.map +1 -0
  26. package/dist/chunk-BLHNKR3S.js +35 -0
  27. package/dist/chunk-BLHNKR3S.js.map +1 -0
  28. package/dist/chunk-CCJ43SIX.js +342 -0
  29. package/dist/chunk-CCJ43SIX.js.map +1 -0
  30. package/dist/chunk-CNEDWATL.js +210 -0
  31. package/dist/chunk-CNEDWATL.js.map +1 -0
  32. package/dist/chunk-CYTWDJE2.js +152 -0
  33. package/dist/chunk-CYTWDJE2.js.map +1 -0
  34. package/dist/chunk-DKVOICYZ.js +45 -0
  35. package/dist/chunk-DKVOICYZ.js.map +1 -0
  36. package/dist/chunk-DPEJU4P6.js +79 -0
  37. package/dist/chunk-DPEJU4P6.js.map +1 -0
  38. package/dist/chunk-DQPABZTU.js +22 -0
  39. package/dist/chunk-DQPABZTU.js.map +1 -0
  40. package/dist/chunk-EKHEY3LI.js +46 -0
  41. package/dist/chunk-EKHEY3LI.js.map +1 -0
  42. package/dist/chunk-G467LFKC.js +191 -0
  43. package/dist/chunk-G467LFKC.js.map +1 -0
  44. package/dist/chunk-GLYWSVSB.js +250 -0
  45. package/dist/chunk-GLYWSVSB.js.map +1 -0
  46. package/dist/chunk-GXBIMUO7.js +135 -0
  47. package/dist/chunk-GXBIMUO7.js.map +1 -0
  48. package/dist/chunk-H6EERRCR.js +180 -0
  49. package/dist/chunk-H6EERRCR.js.map +1 -0
  50. package/dist/chunk-HDTM3LXD.js +35 -0
  51. package/dist/chunk-HDTM3LXD.js.map +1 -0
  52. package/dist/chunk-IGMX56C3.js +180 -0
  53. package/dist/chunk-IGMX56C3.js.map +1 -0
  54. package/dist/chunk-J4IRICCJ.js +74 -0
  55. package/dist/chunk-J4IRICCJ.js.map +1 -0
  56. package/dist/chunk-JXKQ7S6W.js +331 -0
  57. package/dist/chunk-JXKQ7S6W.js.map +1 -0
  58. package/dist/chunk-KY6DXS6S.js +34 -0
  59. package/dist/chunk-KY6DXS6S.js.map +1 -0
  60. package/dist/chunk-NOFGCYGS.js +22 -0
  61. package/dist/chunk-NOFGCYGS.js.map +1 -0
  62. package/dist/chunk-OSHUJRKD.js +131 -0
  63. package/dist/chunk-OSHUJRKD.js.map +1 -0
  64. package/dist/chunk-PMH7OWPF.js +40 -0
  65. package/dist/chunk-PMH7OWPF.js.map +1 -0
  66. package/dist/chunk-PRBKSX3A.js +299 -0
  67. package/dist/chunk-PRBKSX3A.js.map +1 -0
  68. package/dist/chunk-SVPUX7AM.js +48 -0
  69. package/dist/chunk-SVPUX7AM.js.map +1 -0
  70. package/dist/chunk-TR6HJ4NO.js +659 -0
  71. package/dist/chunk-TR6HJ4NO.js.map +1 -0
  72. package/dist/chunk-TV3E4YUF.js +69 -0
  73. package/dist/chunk-TV3E4YUF.js.map +1 -0
  74. package/dist/chunk-U2ROTOPF.js +256 -0
  75. package/dist/chunk-U2ROTOPF.js.map +1 -0
  76. package/dist/chunk-VCTN77K2.js +112 -0
  77. package/dist/chunk-VCTN77K2.js.map +1 -0
  78. package/dist/chunk-WEOPDD3P.js +120 -0
  79. package/dist/chunk-WEOPDD3P.js.map +1 -0
  80. package/dist/chunk-ZBZ7OC6I.js +228 -0
  81. package/dist/chunk-ZBZ7OC6I.js.map +1 -0
  82. package/dist/config-CJYo46X9.d.ts +19 -0
  83. package/dist/index.d.ts +487 -0
  84. package/dist/index.js +23 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/react/certificate-sign.d.ts +5 -0
  87. package/dist/react/certificate-sign.js +14 -0
  88. package/dist/react/certificate-sign.js.map +1 -0
  89. package/dist/react/compress.d.ts +5 -0
  90. package/dist/react/compress.js +8 -0
  91. package/dist/react/compress.js.map +1 -0
  92. package/dist/react/fill-form.d.ts +5 -0
  93. package/dist/react/fill-form.js +8 -0
  94. package/dist/react/fill-form.js.map +1 -0
  95. package/dist/react/images-to-pdf.d.ts +5 -0
  96. package/dist/react/images-to-pdf.js +7 -0
  97. package/dist/react/images-to-pdf.js.map +1 -0
  98. package/dist/react/merge.d.ts +5 -0
  99. package/dist/react/merge.js +8 -0
  100. package/dist/react/merge.js.map +1 -0
  101. package/dist/react/metadata.d.ts +5 -0
  102. package/dist/react/metadata.js +8 -0
  103. package/dist/react/metadata.js.map +1 -0
  104. package/dist/react/organize.d.ts +5 -0
  105. package/dist/react/organize.js +12 -0
  106. package/dist/react/organize.js.map +1 -0
  107. package/dist/react/pdf-to-images.d.ts +5 -0
  108. package/dist/react/pdf-to-images.js +13 -0
  109. package/dist/react/pdf-to-images.js.map +1 -0
  110. package/dist/react/protect.d.ts +5 -0
  111. package/dist/react/protect.js +8 -0
  112. package/dist/react/protect.js.map +1 -0
  113. package/dist/react/sign.d.ts +5 -0
  114. package/dist/react/sign.js +13 -0
  115. package/dist/react/sign.js.map +1 -0
  116. package/dist/react/split.d.ts +5 -0
  117. package/dist/react/split.js +11 -0
  118. package/dist/react/split.js.map +1 -0
  119. package/dist/react/verify-signatures.d.ts +5 -0
  120. package/dist/react/verify-signatures.js +8 -0
  121. package/dist/react/verify-signatures.js.map +1 -0
  122. package/dist/react/watermark.d.ts +5 -0
  123. package/dist/react/watermark.js +10 -0
  124. package/dist/react/watermark.js.map +1 -0
  125. package/dist/react.d.ts +40 -0
  126. package/dist/react.js +40 -0
  127. package/dist/react.js.map +1 -0
  128. package/dist/styles.css +2 -0
  129. package/dist/vite.d.ts +5 -0
  130. package/dist/vite.js +9 -0
  131. package/dist/vite.js.map +1 -0
  132. package/package.json +163 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are listed here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the package uses
5
+ [Semantic Versioning](https://semver.org/). Before 1.0.0, minor versions may
6
+ include breaking changes.
7
+
8
+ ## [0.1.0] - 2026-11-02
9
+
10
+ First public release.
11
+
12
+ ### Added
13
+
14
+ - Framework-free core (`@kitsy/pdf`): merge, split, images to PDF, watermark
15
+ and page numbers, metadata, organize pages, visible signatures, PDF to
16
+ images, compress, fill forms, protect / unlock (AES-256), PAdES digital
17
+ signatures with `.pfx` / `.p12` certificates, and signature verification.
18
+ - React UIs (`@kitsy/pdf/react` and `@kitsy/pdf/react/<tool>`), with
19
+ `PdfToolsProvider` for navigation and page chrome.
20
+ - `configurePdf()` for asset URLs and the Producer name; `@kitsy/pdf/vite`
21
+ with ready-made asset URLs for Vite apps.
22
+ - Prebuilt `@kitsy/pdf/styles.css` for apps that do not use Tailwind CSS.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 HEYPKV INNOVATIONS PRIVATE LIMITED
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,16 @@
1
+ @kitsy/pdf
2
+ Copyright 2026 HEYPKV INNOVATIONS PRIVATE LIMITED
3
+
4
+ This product includes software developed by HEYPKV INNOVATIONS PRIVATE LIMITED
5
+ (https://kitsy.ai).
6
+
7
+ This product depends on third-party open-source software, which is installed
8
+ from npm as dependencies and is not modified or bundled into this package's
9
+ own files. See THIRD_PARTY_NOTICES.md for the list and their licenses.
10
+
11
+ pdf.js is Copyright Mozilla Foundation and is licensed under the Apache
12
+ License, Version 2.0.
13
+
14
+ qpdf is Copyright Jay Berkenbilt and contributors and is licensed under the
15
+ Apache License, Version 2.0. It reaches this package as WebAssembly through
16
+ @neslinesli93/qpdf-wasm.
package/README.md CHANGED
@@ -1,3 +1,230 @@
1
- # Temporary Holding Version
1
+ # @kitsy/pdf
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
+ PDF tools that run entirely in the browser. Files, certificates and passwords
4
+ never leave the user's device.
5
+
6
+ - **Core** (`@kitsy/pdf`): framework-free functions that take and return bytes.
7
+ - **React UIs** (`@kitsy/pdf/react`): a ready-made page for each tool.
8
+
9
+ | Tool | Core function | React component | Subpath |
10
+ | --- | --- | --- | --- |
11
+ | Merge | `mergePdfs` | `MergePdf` | `@kitsy/pdf/react/merge` |
12
+ | Split | `splitPdf` | `SplitPdf` | `@kitsy/pdf/react/split` |
13
+ | Images to PDF | `imagesToPdf` | `ImagesToPdf` | `@kitsy/pdf/react/images-to-pdf` |
14
+ | Watermark & page numbers | `stampPdf` | `WatermarkPdf` | `@kitsy/pdf/react/watermark` |
15
+ | Edit metadata | `readPdfMetadata`, `writePdfMetadata` | `PdfMetadata` | `@kitsy/pdf/react/metadata` |
16
+ | Organize pages | `organizePdf` | `OrganizePdf` | `@kitsy/pdf/react/organize` |
17
+ | Sign (visible) | `applySignatures` | `SignPdf` | `@kitsy/pdf/react/sign` |
18
+ | PDF to images | `renderPageToCanvas` + helpers | `PdfToImages` | `@kitsy/pdf/react/pdf-to-images` |
19
+ | Compress | `compressPdf` | `CompressPdf` | `@kitsy/pdf/react/compress` |
20
+ | Fill forms | `readFormFields`, `fillForm` | `FillPdfForm` | `@kitsy/pdf/react/fill-form` |
21
+ | Protect / unlock (AES-256) | `protectPdf`, `unlockPdf` | `ProtectPdf` | `@kitsy/pdf/react/protect` |
22
+ | Digital signature (`.pfx` / `.p12`, PAdES) | `readPkcs12`, `signPdfWithCertificate` | `CertSignPdf` | `@kitsy/pdf/react/certificate-sign` |
23
+ | Verify signatures | `verifyPdfSignatures` | `VerifyPdfSignatures` | `@kitsy/pdf/react/verify-signatures` |
24
+
25
+ ## Install
26
+
27
+ ```sh
28
+ npm install @kitsy/pdf
29
+ # React UIs also need React 18 or later
30
+ ```
31
+
32
+ The package is ESM only. It works with any modern bundler (Vite, webpack 5,
33
+ Rollup, esbuild) and in Node 20 or later for the operations that don't need a
34
+ browser.
35
+
36
+ ## Configure assets (once, at start-up)
37
+
38
+ Page previews use the pdf.js worker, and Protect / Unlock uses qpdf compiled
39
+ to WebAssembly. Your bundler has to serve these files, so tell the package where
40
+ they are.
41
+
42
+ **Vite:**
43
+
44
+ ```js
45
+ import { configurePdf } from "@kitsy/pdf";
46
+ import { viteAssets } from "@kitsy/pdf/vite";
47
+
48
+ configurePdf({ ...viteAssets, producer: "My App" });
49
+ ```
50
+
51
+ `viteAssets` resolves both files from `@kitsy/pdf`'s own dependencies, so the
52
+ worker always matches the pdf.js version in use.
53
+
54
+ **Other bundlers:** copy these files into your public folder, then pass their
55
+ URLs:
56
+
57
+ - `node_modules/pdfjs-dist/build/pdf.worker.min.mjs`
58
+ - `node_modules/@neslinesli93/qpdf-wasm/dist/qpdf.wasm`
59
+
60
+ Use the `pdfjs-dist` copy that `@kitsy/pdf` itself resolves (`npm ls pdfjs-dist`).
61
+ pdf.js requires the worker and the library to be the same version.
62
+
63
+ ```js
64
+ configurePdf({
65
+ pdfjsWorkerSrc: "/pdf.worker.min.mjs",
66
+ qpdfWasmUrl: "/qpdf.wasm",
67
+ });
68
+ ```
69
+
70
+ | Option | Needed for | Notes |
71
+ | --- | --- | --- |
72
+ | `pdfjsWorkerSrc` | Previews, Organize, PDF to images, visible-signature preview | Required for those tools |
73
+ | `qpdfWasmUrl` | Protect / unlock | Required for that tool |
74
+ | `pdfjsAssetsBase` | Rendering CJK text and unembedded standard fonts | Optional. A folder containing `cmaps/` and `standard_fonts/` copied from `pdfjs-dist` |
75
+ | `producer` | The Producer field of PDFs created from scratch | Default `"@kitsy/pdf"` |
76
+
77
+ Tools that need a missing URL throw an error naming the option.
78
+
79
+ ## Core usage
80
+
81
+ Every function takes `ArrayBuffer` or `Uint8Array` input and returns
82
+ `Uint8Array` output.
83
+
84
+ ```js
85
+ import { mergePdfs, splitPdf, stampPdf, protectPdf, browserQpdf } from "@kitsy/pdf";
86
+
87
+ const merged = await mergePdfs([
88
+ { name: "a.pdf", bytes: aBytes },
89
+ { name: "b.pdf", bytes: bBytes, pages: "1-3, 5" },
90
+ ]);
91
+
92
+ const parts = await splitPdf(merged, { mode: "every", every: 2 });
93
+ // parts: [{ name, pageIndices, bytes }, ...]
94
+
95
+ const stamped = await stampPdf(merged, {
96
+ watermark: { text: "CONFIDENTIAL", opacity: 0.15 },
97
+ pageNumbers: { format: "Page {n} of {total}", position: "bottom-center" },
98
+ });
99
+
100
+ const { bytes: locked } = await protectPdf(stamped, { userPassword: "s3cret", print: "low" }, browserQpdf);
101
+ ```
102
+
103
+ ### Digital signatures with a certificate
104
+
105
+ ```js
106
+ import { readPkcs12, webCryptoSigner, signPdfWithCertificate, verifyPdfSignatures } from "@kitsy/pdf";
107
+
108
+ const identity = readPkcs12(pfxBytes, password); // throws CertificatePasswordError on a wrong password
109
+ const signer = await webCryptoSigner(identity); // private key becomes a non-extractable CryptoKey
110
+ identity.privateKeyPkcs8.fill(0);
111
+
112
+ const signed = await signPdfWithCertificate(pdfBytes, signer, {
113
+ reason: "I approve this document",
114
+ location: "Bengaluru",
115
+ visible: { pageIndex: 0, x: 0.6, y: 0.88, width: 0.38, height: 0.09 }, // or null
116
+ });
117
+
118
+ const [check] = await verifyPdfSignatures(signed);
119
+ // { intact: true, coversWholeFile: true, signer: { commonName, ... }, signingTime, ... }
120
+ ```
121
+
122
+ Details:
123
+
124
+ - Signatures are PAdES baseline B (`ETSI.CAdES.detached`) using SHA-256 and
125
+ RSA. Adobe Reader, poppler (`pdfsig`) and OpenSSL validate them.
126
+ - `.pfx` / `.p12` files with modern (AES) or legacy (3DES / RC2) encryption are
127
+ supported. Only RSA keys are supported.
128
+ - `signer` is any object of the form `{ certificate, chain?, sign(bytes) }`
129
+ (`RawSigner`). You can plug in a hardware token or remote signer by
130
+ implementing `sign`.
131
+ - `verifyPdfSignatures` checks integrity, whether anything was added after
132
+ signing, and the certificate details. It does **not** check whether the
133
+ certificate is trusted or revoked.
134
+
135
+ ## React usage
136
+
137
+ Each component is a full page. Load them lazily through the per-tool subpaths:
138
+
139
+ ```jsx
140
+ import { lazy, Suspense } from "react";
141
+ import { PdfToolsProvider } from "@kitsy/pdf/react";
142
+
143
+ const MergePdf = lazy(() => import("@kitsy/pdf/react/merge"));
144
+
145
+ export function MergePage() {
146
+ return (
147
+ <PdfToolsProvider
148
+ backLink={{ href: "/tools", label: "All tools" }}
149
+ renderLink={({ href, className, children }) => (
150
+ <RouterLink to={href} className={className}>{children}</RouterLink>
151
+ )}
152
+ >
153
+ <Suspense fallback={null}>
154
+ <MergePdf />
155
+ </Suspense>
156
+ </PdfToolsProvider>
157
+ );
158
+ }
159
+ ```
160
+
161
+ `PdfToolsProvider` is optional. It accepts:
162
+
163
+ - `backLink`: `{ href, label? }`, shown under each tool. Omit it to hide the
164
+ link.
165
+ - `renderLink`: renders links with your router. The default is a plain `<a>`.
166
+ - `header`: a React node shown above the title card, such as your app's
167
+ navigation.
168
+ - `className`: classes for the outer wrapper. The default is `py-8 sm:py-12`.
169
+
170
+ ### Styling
171
+
172
+ The components use [Tailwind CSS](https://tailwindcss.com) utility classes.
173
+ Dark mode is driven by a `dark` class on `<html>` or any ancestor element.
174
+
175
+ - **Your app uses Tailwind v4:** add the package to your sources, and use a
176
+ class-based dark variant:
177
+
178
+ ```css
179
+ @import "tailwindcss";
180
+ @source "../node_modules/@kitsy/pdf/dist";
181
+ @custom-variant dark (&:where(.dark, .dark *));
182
+ ```
183
+
184
+ - **Your app doesn't use Tailwind:** import the prebuilt stylesheet. It is
185
+ about 32 KB, and its reset applies only inside the tools' root element.
186
+
187
+ ```js
188
+ import "@kitsy/pdf/styles.css";
189
+ ```
190
+
191
+ Icons use [Font Awesome 6 Free](https://fontawesome.com) class names
192
+ (`fa-solid ...`). Load Font Awesome in your app if you want them. Without it,
193
+ the tools still work but show no icons.
194
+
195
+ ## Browser support
196
+
197
+ Current Chrome, Edge, Firefox and Safari. These APIs are required:
198
+
199
+ - WebCrypto (`crypto.subtle`)
200
+ - WebAssembly
201
+ - `DecompressionStream`
202
+ - `createImageBitmap`
203
+
204
+ ## Development
205
+
206
+ ```sh
207
+ pnpm install
208
+ pnpm run typecheck
209
+ pnpm test
210
+ pnpm run build # dist/ with JS, type definitions and styles.css
211
+ pnpm pack # inspect exactly what would be published
212
+ ```
213
+
214
+ ## Publishing
215
+
216
+ 1. Update the version in `package.json` and `CHANGELOG.md`.
217
+ 2. `pnpm run check` (typecheck, tests, build). `prepublishOnly` runs it
218
+ again.
219
+ 3. `npm publish`. The repository's `.npmrc` maps the `@kitsy` scope to the
220
+ public registry (registry.npmjs.org), overriding a user-level mapping to a
221
+ private registry. A command-line `--registry` flag does **not** override a
222
+ scope mapping; `--@kitsy:registry=https://registry.npmjs.org/` does. Check
223
+ the "Publishing to" line of `npm publish --dry-run` first. Log in with
224
+ `npm login --registry=https://registry.npmjs.org/` as a member of the
225
+ `kitsy` npm organisation (with 2FA if the organisation requires it).
226
+
227
+ ## License
228
+
229
+ [Apache-2.0](LICENSE). Copyright 2026 HEYPKV INNOVATIONS PRIVATE LIMITED.
230
+ Third-party licenses are listed in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,48 @@
1
+ # Third-party notices
2
+
3
+ `@kitsy/pdf` is licensed under the [Apache License 2.0](LICENSE). It uses the
4
+ open-source packages below. They are installed from npm as dependencies; this
5
+ package does not copy or modify their code. When you bundle an app that uses
6
+ `@kitsy/pdf`, your bundle includes code from these packages, so their licenses
7
+ apply to that bundle too.
8
+
9
+ ## Runtime dependencies
10
+
11
+ | Package | License | Used for |
12
+ | --- | --- | --- |
13
+ | [pdf-lib](https://github.com/Hopding/pdf-lib) | MIT | Reading and writing PDFs |
14
+ | [@pdf-lib/standard-fonts](https://github.com/Hopding/standard-fonts), [@pdf-lib/upng](https://github.com/Hopding/upng) | MIT | pdf-lib internals |
15
+ | [pako](https://github.com/nodeca/pako) | MIT AND Zlib | Compression (via pdf-lib) |
16
+ | [pdfjs-dist](https://github.com/mozilla/pdf.js) (pdf.js) | Apache-2.0 | Page previews, PDF to images |
17
+ | [@neslinesli93/qpdf-wasm](https://github.com/neslinesli93/qpdf-wasm) | ISC | Encryption and decryption (Protect / Unlock) |
18
+ | [qpdf](https://github.com/qpdf/qpdf) (inside the WebAssembly above) | Apache-2.0 | Encryption and decryption |
19
+ | [pkijs](https://github.com/PeculiarVentures/PKI.js) | BSD-3-Clause | CMS signatures and X.509 certificates |
20
+ | [asn1js](https://github.com/PeculiarVentures/ASN1.js) | BSD-3-Clause | ASN.1 encoding (via pkijs) |
21
+ | [bytestreamjs](https://github.com/PeculiarVentures/ByteStream.js) | BSD-3-Clause | pkijs internals |
22
+ | [pvtsutils](https://github.com/PeculiarVentures/pvtsutils), [pvutils](https://github.com/PeculiarVentures/pvutils) | MIT | pkijs internals |
23
+ | [@noble/hashes](https://github.com/paulmillr/noble-hashes) | MIT | pkijs internals |
24
+ | [tslib](https://github.com/microsoft/tslib) | 0BSD | Helpers used by dependencies |
25
+ | [node-forge](https://github.com/digitalbazaar/forge) | BSD-3-Clause OR GPL-2.0 (used under BSD-3-Clause) | Decrypting `.pfx` / `.p12` certificate files only |
26
+ | [@fontsource/dancing-script](https://github.com/fontsource/font-files) | OFL-1.1 (font), MIT (packaging) | Typed signature style (React UI) |
27
+ | [@fontsource/great-vibes](https://github.com/fontsource/font-files) | OFL-1.1 (font), MIT (packaging) | Typed signature style (React UI) |
28
+
29
+ `pdfjs-dist` also lists `@napi-rs/canvas` (MIT) as an optional dependency for
30
+ Node. Browsers do not use it.
31
+
32
+ ## Optional peer dependency
33
+
34
+ | Package | License |
35
+ | --- | --- |
36
+ | [react](https://github.com/facebook/react) | MIT |
37
+
38
+ ## Not included
39
+
40
+ - Font Awesome: the React UI uses its class names (`fa-solid ...`) for icons
41
+ but does not ship it. If you load it, its own license applies (icons
42
+ CC BY 4.0, fonts SIL OFL 1.1, code MIT).
43
+ - pdf.js CMaps and standard fonts are not shipped. If you serve them (see
44
+ `pdfjsAssetsBase` in the README), they come from `pdfjs-dist` under its
45
+ licenses.
46
+
47
+ The full license text of each package is in its folder under `node_modules`
48
+ after install, and at the links above.
@@ -0,0 +1,43 @@
1
+ import { fieldLabelClass, inputClass } from './chunk-H6EERRCR.js';
2
+ import { useState } from 'react';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+
5
+ function PasswordInput({ id, label, value, onChange, disabled, autoComplete = "new-password", hint = "", inputRef = void 0 }) {
6
+ const [visible, setVisible] = useState(false);
7
+ const hintId = `${id}-hint`;
8
+ return /* @__PURE__ */ jsxs("div", { children: [
9
+ /* @__PURE__ */ jsx("label", { htmlFor: id, className: fieldLabelClass, children: label }),
10
+ /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
11
+ /* @__PURE__ */ jsx(
12
+ "input",
13
+ {
14
+ id,
15
+ ref: inputRef,
16
+ type: visible ? "text" : "password",
17
+ value,
18
+ onChange: (event) => onChange(event.target.value),
19
+ disabled,
20
+ autoComplete,
21
+ spellCheck: false,
22
+ "aria-describedby": hint ? hintId : void 0,
23
+ className: inputClass
24
+ }
25
+ ),
26
+ /* @__PURE__ */ jsx(
27
+ "button",
28
+ {
29
+ type: "button",
30
+ onClick: () => setVisible((current) => !current),
31
+ className: "shrink-0 text-xs font-semibold normal-case tracking-normal text-[#1F8CFF]",
32
+ "aria-label": visible ? `Hide ${label}` : `Show ${label}`,
33
+ children: visible ? "Hide" : "Show"
34
+ }
35
+ )
36
+ ] }),
37
+ hint ? /* @__PURE__ */ jsx("p", { id: hintId, className: "mt-1 text-[11px] text-slate-500 dark:text-slate-400", children: hint }) : null
38
+ ] });
39
+ }
40
+
41
+ export { PasswordInput };
42
+ //# sourceMappingURL=chunk-2K5X7L5J.js.map
43
+ //# sourceMappingURL=chunk-2K5X7L5J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/PasswordInput.tsx"],"names":[],"mappings":";;;;AAIO,SAAS,aAAA,CAAc,EAAE,EAAA,EAAI,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,YAAA,GAAe,cAAA,EAAgB,IAAA,GAAO,EAAA,EAAI,QAAA,GAAW,QAAU,EAAG;AACtI,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAC5C,EAAA,MAAM,MAAA,GAAS,GAAG,EAAE,CAAA,KAAA,CAAA;AACpB,EAAA,4BACG,KAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,OAAA,EAAA,EAAM,OAAA,EAAS,EAAA,EAAI,SAAA,EAAW,iBAC5B,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,oBACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,8BAAA,EACb,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,EAAA;AAAA,UACA,GAAA,EAAK,QAAA;AAAA,UACL,IAAA,EAAM,UAAU,MAAA,GAAS,UAAA;AAAA,UACzB,KAAA;AAAA,UACA,UAAU,CAAC,KAAA,KAAU,QAAA,CAAS,KAAA,CAAM,OAAO,KAAK,CAAA;AAAA,UAChD,QAAA;AAAA,UACA,YAAA;AAAA,UACA,UAAA,EAAY,KAAA;AAAA,UACZ,kBAAA,EAAkB,OAAO,MAAA,GAAS,MAAA;AAAA,UAClC,SAAA,EAAW;AAAA;AAAA,OACb;AAAA,sBACA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,SAAS,MAAM,UAAA,CAAW,CAAC,OAAA,KAAY,CAAC,OAAO,CAAA;AAAA,UAC/C,SAAA,EAAU,2EAAA;AAAA,UACV,cAAY,OAAA,GAAU,CAAA,KAAA,EAAQ,KAAK,CAAA,CAAA,GAAK,QAAQ,KAAK,CAAA,CAAA;AAAA,UAEpD,oBAAU,MAAA,GAAS;AAAA;AAAA;AACtB,KAAA,EACF,CAAA;AAAA,IACC,IAAA,uBACE,GAAA,EAAA,EAAE,EAAA,EAAI,QAAQ,SAAA,EAAU,qDAAA,EACtB,gBACH,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ","file":"chunk-2K5X7L5J.js","sourcesContent":["import React, { useState } from \"react\";\nimport { fieldLabelClass, inputClass } from \"./ToolLayout\";\n\n/** A password field with a show/hide toggle; the hint is linked via aria-describedby. */\nexport function PasswordInput({ id, label, value, onChange, disabled, autoComplete = \"new-password\", hint = \"\", inputRef = undefined }) {\n const [visible, setVisible] = useState(false);\n const hintId = `${id}-hint`;\n return (\n <div>\n <label htmlFor={id} className={fieldLabelClass}>\n {label}\n </label>\n <div className=\"mt-2 flex items-center gap-2\">\n <input\n id={id}\n ref={inputRef}\n type={visible ? \"text\" : \"password\"}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n disabled={disabled}\n autoComplete={autoComplete}\n spellCheck={false}\n aria-describedby={hint ? hintId : undefined}\n className={inputClass}\n />\n <button\n type=\"button\"\n onClick={() => setVisible((current) => !current)}\n className=\"shrink-0 text-xs font-semibold normal-case tracking-normal text-[#1F8CFF]\"\n aria-label={visible ? `Hide ${label}` : `Show ${label}`}\n >\n {visible ? \"Hide\" : \"Show\"}\n </button>\n </div>\n {hint ? (\n <p id={hintId} className=\"mt-1 text-[11px] text-slate-500 dark:text-slate-400\">\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n"]}