@dvvebond/core 0.2.12

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.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lucas Smith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # LibPDF
2
+
3
+ [![npm](https://img.shields.io/npm/v/@libpdf/core)](https://www.npmjs.com/package/@libpdf/core)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@libpdf/core)](https://www.npmjs.com/package/@libpdf/core)
5
+ [![CI](https://github.com/LibPDF-js/core/actions/workflows/ci.yml/badge.svg)](https://github.com/LibPDF-js/core/actions/workflows/ci.yml)
6
+ [![GitHub stars](https://img.shields.io/github/stars/libpdf-js/core?style=flat)](https://github.com/LibPDF-js/core)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
9
+
10
+ A modern PDF library for TypeScript. Parse, modify, and generate PDFs with a clean, intuitive API.
11
+
12
+ > **Beta Software**: LibPDF is under active development and APIs may change between minor versions, but we use it in production at [Documenso](https://documenso.com) and consider it ready for real-world use.
13
+
14
+ ## Why LibPDF?
15
+
16
+ LibPDF was born from frustration. At [Documenso](https://documenso.com), we found ourselves wrestling with the JavaScript PDF ecosystem:
17
+
18
+ - **PDF.js** is excellent for rendering and even has annotation editing — but it requires a browser
19
+ - **pdf-lib** has a great API, but chokes on slightly malformed documents
20
+ - **pdfkit** only generates, no parsing at all
21
+
22
+ We kept adding workarounds. A patch here for a malformed xref table. A hack there for an encrypted document. Eventually, we decided to build what we actually needed:
23
+
24
+ - **Lenient like PDFBox and PDF.js**: opens documents other libraries reject
25
+ - **Intuitive like pdf-lib**: clean, TypeScript-first API
26
+ - **Complete**: encryption, digital signatures, incremental saves, form filling
27
+
28
+ ## Features
29
+
30
+ | Feature | Status | Notes |
31
+ | ------------------ | ------ | ------------------------------------------ |
32
+ | Parse any PDF | Yes | Graceful fallback for malformed documents |
33
+ | Create PDFs | Yes | From scratch or modify existing |
34
+ | Encryption | Yes | RC4, AES-128, AES-256 (R2-R6) |
35
+ | Digital Signatures | Yes | PAdES B-B, B-T, B-LT, B-LTA |
36
+ | Form Filling | Yes | Text, checkbox, radio, dropdown, signature |
37
+ | Form Flattening | Yes | Bake fields into page content |
38
+ | Merge & Split | Yes | Combine or extract pages |
39
+ | Attachments | Yes | Embed and extract files |
40
+ | Text Extraction | Yes | With position information |
41
+ | Font Embedding | Yes | TTF/OpenType with subsetting |
42
+ | Images | Yes | JPEG, PNG (with alpha) |
43
+ | Incremental Saves | Yes | Append changes, preserve signatures |
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ npm install @libpdf/core
49
+ # or
50
+ bun add @libpdf/core
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ### Parse an existing PDF
56
+
57
+ ```typescript
58
+ import { PDF } from "@libpdf/core";
59
+
60
+ const pdf = await PDF.load(bytes);
61
+ const pages = pdf.getPages();
62
+
63
+ console.log(`${pages.length} pages`);
64
+ ```
65
+
66
+ ### Open an encrypted PDF
67
+
68
+ ```typescript
69
+ const pdf = await PDF.load(bytes, { credentials: "password" });
70
+ ```
71
+
72
+ ### Fill a form
73
+
74
+ ```typescript
75
+ const pdf = await PDF.load(bytes);
76
+ const form = pdf.getForm();
77
+
78
+ form.fill({
79
+ name: "Jane Doe",
80
+ email: "jane@example.com",
81
+ agreed: true,
82
+ });
83
+
84
+ const filled = await pdf.save();
85
+ ```
86
+
87
+ ### Sign a document
88
+
89
+ ```typescript
90
+ import { PDF, P12Signer } from "@libpdf/core";
91
+
92
+ const pdf = await PDF.load(bytes);
93
+ const signer = await P12Signer.create(p12Bytes, "password");
94
+
95
+ const signed = await pdf.sign({
96
+ signer,
97
+ reason: "I approve this document",
98
+ });
99
+ ```
100
+
101
+ ### Merge PDFs
102
+
103
+ ```typescript
104
+ const merged = await PDF.merge([pdf1Bytes, pdf2Bytes, pdf3Bytes]);
105
+ ```
106
+
107
+ ### Draw on a page
108
+
109
+ ```typescript
110
+ import { PDF, rgb } from "@libpdf/core";
111
+
112
+ const pdf = PDF.create();
113
+ const page = pdf.addPage({ size: "letter" });
114
+
115
+ page.drawText("Hello, World!", {
116
+ x: 50,
117
+ y: 700,
118
+ fontSize: 24,
119
+ color: rgb(0, 0, 0),
120
+ });
121
+
122
+ page.drawRectangle({
123
+ x: 50,
124
+ y: 600,
125
+ width: 200,
126
+ height: 100,
127
+ color: rgb(0.9, 0.9, 0.9),
128
+ borderColor: rgb(0, 0, 0),
129
+ borderWidth: 1,
130
+ });
131
+
132
+ const output = await pdf.save();
133
+ ```
134
+
135
+ ## Runtime Support
136
+
137
+ LibPDF runs everywhere:
138
+
139
+ - **Node.js** 20+
140
+ - **Bun**
141
+ - **Browsers** (modern, with Web Crypto)
142
+
143
+ ## Known Limitations
144
+
145
+ Some features are not yet implemented:
146
+
147
+ | Feature | Status | Notes |
148
+ | --------------------------- | ---------------- | -------------------------------------- |
149
+ | Signature verification | Not implemented | Signing works; verification is planned |
150
+ | TrueType Collections (.ttc) | Not supported | Extract individual fonts first |
151
+ | JBIG2 image decoding | Passthrough only | Images preserved but not decoded |
152
+ | JPEG2000 (JPX) decoding | Passthrough only | Images preserved but not decoded |
153
+ | Certificate encryption | Not supported | Password encryption works |
154
+ | JavaScript actions | Ignored | Form calculations not executed |
155
+
156
+ These limitations are documented to set expectations. Most don't affect typical use cases like form filling, signing, or document manipulation.
157
+
158
+ ## Philosophy
159
+
160
+ ### Be lenient
161
+
162
+ Real-world PDFs are messy. Export a document through three different tools and you'll get three slightly different interpretations of the spec. LibPDF prioritizes _opening your document_ over strict compliance. When standard parsing fails, we fall back to brute-force recovery, scanning the entire file to rebuild the structure.
163
+
164
+ ### Two API layers
165
+
166
+ - **High-level**: `PDF`, `PDFPage`, `PDFForm` for common tasks
167
+ - **Low-level**: `PdfDict`, `PdfArray`, `PdfStream` for full control
168
+
169
+ ## Demo
170
+
171
+ Run the interactive PDF viewer demo to explore LibPDF's viewing capabilities:
172
+
173
+ ```bash
174
+ bun run demo
175
+ ```
176
+
177
+ See [demo/README.md](demo/README.md) for features and keyboard shortcuts.
178
+
179
+ ## Documentation
180
+
181
+ Full documentation at [libpdf.dev](https://libpdf.dev)
182
+
183
+ ## Sponsors
184
+
185
+ LibPDF is developed by [Documenso](https://documenso.com), the open-source DocuSign alternative.
186
+
187
+ <a href="https://documenso.com">
188
+ <img src="apps/docs/public/sponsors/documenso.png" alt="Documenso" height="24">
189
+ </a>
190
+
191
+ ## Contributing
192
+
193
+ We welcome contributions! See our [contributing guide](CONTRIBUTING.md) for details.
194
+
195
+ ```bash
196
+ # Clone the repo
197
+ git clone https://github.com/libpdf/core.git
198
+ cd libpdf
199
+
200
+ # Install dependencies
201
+ bun install
202
+
203
+ # Run tests
204
+ bun run test
205
+
206
+ # Type check
207
+ bun run typecheck
208
+ ```
209
+
210
+ ## License
211
+
212
+ [MIT](LICENSE)
213
+
214
+ The `src/fontbox/` directory is licensed under [Apache-2.0](src/fontbox/LICENSE) as it is derived from [Apache PDFBox](https://pdfbox.apache.org/).
@@ -0,0 +1,18 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll as t };