@pdfluent/node-win32-x64-msvc 1.0.0-beta.10 → 1.0.0-beta.17.4
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 +7 -0
- package/README.md +260 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +47 -6
package/LICENSE
CHANGED
|
@@ -19,6 +19,13 @@ those crates are NOT governed by this License and may be used under their
|
|
|
19
19
|
respective open-source terms. See the NOTICE file for the list of crates
|
|
20
20
|
covered by each license.
|
|
21
21
|
|
|
22
|
+
Note: this License is separate from the license for the PDFluent desktop
|
|
23
|
+
editor application. A license to use the PDFluent editor, including a free
|
|
24
|
+
one, does not grant any rights under this License. If you are embedding,
|
|
25
|
+
linking against, or programmatically calling the Software described below,
|
|
26
|
+
this License applies regardless of whether you also use the editor. See
|
|
27
|
+
https://pdfluent.com/sdk/pricing for SDK licensing options.
|
|
28
|
+
|
|
22
29
|
----------------------------------------------------------------------------
|
|
23
30
|
|
|
24
31
|
1. DEFINITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# @pdfluent/node
|
|
2
|
+
|
|
3
|
+
Enterprise PDF SDK for Node.js, powered by a native Rust engine via [napi-rs](https://napi.rs).
|
|
4
|
+
Supports rendering, text extraction, forms, annotations, redaction, encryption, digital signatures,
|
|
5
|
+
and PDF/A compliance validation.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @pdfluent/node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Pre-built binaries are provided for:
|
|
14
|
+
|
|
15
|
+
| Platform | Architecture |
|
|
16
|
+
|---|---|
|
|
17
|
+
| macOS | x64, arm64 |
|
|
18
|
+
| Linux (glibc) | x64, arm64 |
|
|
19
|
+
| Linux (musl) | x64 |
|
|
20
|
+
| Windows | x64 |
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
const { PdfDocument } = require('@pdfluent/node');
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
|
|
28
|
+
const data = fs.readFileSync('document.pdf');
|
|
29
|
+
const doc = PdfDocument.open(data);
|
|
30
|
+
|
|
31
|
+
console.log(`Pages: ${doc.pageCount}`);
|
|
32
|
+
console.log(`Title: ${doc.info().title}`);
|
|
33
|
+
|
|
34
|
+
// Extract text from page 0
|
|
35
|
+
const text = doc.extractText(0);
|
|
36
|
+
console.log(text);
|
|
37
|
+
|
|
38
|
+
// Save after mutations
|
|
39
|
+
doc.save('output.pdf');
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Async (recommended for servers)
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const data = await fs.promises.readFile('document.pdf');
|
|
46
|
+
const doc = await PdfDocument.openAsync(data);
|
|
47
|
+
|
|
48
|
+
const text = await doc.extractTextAsync(0);
|
|
49
|
+
const render = await doc.renderPageAsync(0, { dpi: 150 });
|
|
50
|
+
// render.data — Buffer with RGBA pixels; render.width / render.height
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Open from file path
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
const { openPdf } = require('@pdfluent/node');
|
|
57
|
+
const doc = openPdf('/path/to/document.pdf');
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- **Rendering** — rasterise pages to RGBA pixels at any DPI, generate thumbnails
|
|
63
|
+
- **Text extraction** — plain text per page or structured `TextBlockInfo[]` with coordinates
|
|
64
|
+
- **Text search** — returns page indices containing the query string
|
|
65
|
+
- **Forms (AcroForm)** — enumerate, read, and fill fields (text/checkbox/radio/choice); hierarchical names; appearance-stream regeneration
|
|
66
|
+
- **Annotations** — read existing annotations, add highlight / freetext
|
|
67
|
+
- **Redaction** — permanently remove text by search term
|
|
68
|
+
- **Encryption** — encrypt with AES-256, decrypt password-protected PDFs
|
|
69
|
+
- **Digital signatures** — validate existing signatures
|
|
70
|
+
- **Bookmarks** — read the document outline
|
|
71
|
+
- **PDF/A compliance** — validate against levels 1a/1b through 3a/3b/3u
|
|
72
|
+
- **Async API** — Promise-based worker-thread execution; no event-loop blocking
|
|
73
|
+
- **TypeScript** — full `.d.ts` declarations with JSDoc included
|
|
74
|
+
|
|
75
|
+
## API reference
|
|
76
|
+
|
|
77
|
+
### `PdfDocument`
|
|
78
|
+
|
|
79
|
+
#### Factory methods
|
|
80
|
+
|
|
81
|
+
| Method | Description |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `PdfDocument.open(data: Buffer)` | Open synchronously from a Buffer |
|
|
84
|
+
| `PdfDocument.openAsync(data: Buffer)` | Open on a worker thread |
|
|
85
|
+
| `PdfDocument.openWithPassword(data, password)` | Open a password-protected PDF |
|
|
86
|
+
| `openPdf(path: string)` | Convenience wrapper — open from file path |
|
|
87
|
+
|
|
88
|
+
#### Metadata & structure
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
const info = doc.info(); // { title, author, subject, keywords, creator, producer }
|
|
92
|
+
const outline = doc.bookmarks(); // BookmarkItem[]
|
|
93
|
+
const geo = doc.pageGeometry(0); // { width, height, rotation }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Rendering
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
// Synchronous
|
|
100
|
+
const result = doc.renderPage(0, { dpi: 150 });
|
|
101
|
+
// result.data — Buffer (RGBA), result.width, result.height
|
|
102
|
+
|
|
103
|
+
// Async (worker thread)
|
|
104
|
+
const result = await doc.renderPageAsync(0, { dpi: 300 });
|
|
105
|
+
|
|
106
|
+
// All pages in parallel
|
|
107
|
+
const pages = await doc.renderAll({ dpi: 72 });
|
|
108
|
+
|
|
109
|
+
// Thumbnail
|
|
110
|
+
const thumb = await doc.thumbnail(0, 256); // max 256 px on longest side
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`RenderOpts`: `{ dpi?, background?, width?, height? }`
|
|
114
|
+
|
|
115
|
+
#### Text extraction
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
const text = doc.extractText(0); // plain string
|
|
119
|
+
const blocks = doc.extractTextBlocks(0); // TextBlockInfo[] with x/y/fontSize
|
|
120
|
+
const hits = doc.searchText('invoice'); // number[] of page indices
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Forms (AcroForm)
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
const fields = doc.getFormFields(); // FormFieldInfo[]
|
|
127
|
+
// fields[0] → { name, fieldType, value, readOnly }
|
|
128
|
+
|
|
129
|
+
const value = doc.getFieldValue('Address.Street');
|
|
130
|
+
|
|
131
|
+
// setFormField supports text, checkbox, radio, and choice fields.
|
|
132
|
+
// Hierarchical names ("parent.child") are resolved through /Kids recursion.
|
|
133
|
+
// The call updates /V (UTF-16BE+BOM for non-ASCII), per-widget /AS, and
|
|
134
|
+
// regenerates the /AP appearance stream so the fill is visible in all viewers
|
|
135
|
+
// without /NeedAppearances processing.
|
|
136
|
+
// Read-only fields are rejected (throws).
|
|
137
|
+
doc.setFormField('Address.Street', '123 Main St');
|
|
138
|
+
doc.setFormField('Agree', 'On'); // checkbox — pass the on-state name
|
|
139
|
+
doc.setFormField('Country', 'NL'); // radio group — pass the export value
|
|
140
|
+
doc.setFormField('Category', 'Option2'); // combo/list — pass the option value
|
|
141
|
+
|
|
142
|
+
// Multi-select list box: pass an array of option values. Writes /V as an
|
|
143
|
+
// array and rebuilds the sorted /I index cache (Acrobat-faithful).
|
|
144
|
+
doc.setMultiSelect('Languages', ['EN', 'NL']);
|
|
145
|
+
doc.save('filled.pdf');
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> The pre-`1.0.0-beta.14` names `formFields()` and `setFieldValue()` still work as
|
|
149
|
+
> deprecated aliases for `getFormFields()` and `setFormField()`, but will be
|
|
150
|
+
> removed in `1.0.0`. Use the canonical names above.
|
|
151
|
+
|
|
152
|
+
#### Annotations
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
const annots = doc.annotations(0); // AnnotationInfo[]
|
|
156
|
+
|
|
157
|
+
doc.addAnnotation(
|
|
158
|
+
0, // page index
|
|
159
|
+
'highlight', // type: highlight | freetext | note | underline | strikeout | squiggly
|
|
160
|
+
[100, 200, 300, 220], // rect [x0, y0, x1, y1] in PDF user-space points
|
|
161
|
+
'Important' // optional content
|
|
162
|
+
);
|
|
163
|
+
doc.save('annotated.pdf');
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Redaction
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
const report = doc.redactText('John Doe'); // all pages
|
|
170
|
+
// report → { matchesFound, areasRedacted, pagesAffected }
|
|
171
|
+
doc.save('redacted.pdf');
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Encryption
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
// Encrypt — saved copy is AES-256 protected; in-memory doc is unchanged
|
|
178
|
+
doc.encrypt('protected.pdf', 'secret');
|
|
179
|
+
|
|
180
|
+
// Decrypt — works on a doc opened with openWithPassword
|
|
181
|
+
doc.decrypt('plain.pdf');
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Digital signatures
|
|
185
|
+
|
|
186
|
+
```js
|
|
187
|
+
const sigs = doc.validateSignatures();
|
|
188
|
+
// sigs[0] → { status, fieldName, signer, timestamp, reason }
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### PDF/A compliance
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
// Per-document
|
|
195
|
+
const report = doc.validatePdfa('2b');
|
|
196
|
+
// report → { compliant, errorCount, warningCount, issues[] }
|
|
197
|
+
|
|
198
|
+
// Or as a module-level function (opens the file internally)
|
|
199
|
+
const { validatePdfa } = require('@pdfluent/node');
|
|
200
|
+
const report = validatePdfa('document.pdf', '2b');
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Valid levels: `"1a"`, `"1b"`, `"2a"`, `"2b"`, `"2u"`, `"3a"`, `"3b"`, `"3u"`.
|
|
204
|
+
|
|
205
|
+
### `PdfPage`
|
|
206
|
+
|
|
207
|
+
Obtain a page handle with `doc.page(index)`. Provides the same render/text methods scoped to a single page.
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
const page = doc.page(0);
|
|
211
|
+
console.log(`${page.width} x ${page.height} pts`);
|
|
212
|
+
|
|
213
|
+
const pixels = await page.renderAsync({ dpi: 150 });
|
|
214
|
+
const text = page.text();
|
|
215
|
+
const blocks = page.textBlocks();
|
|
216
|
+
const annots = page.annotations();
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Module-level functions
|
|
220
|
+
|
|
221
|
+
```js
|
|
222
|
+
const { openPdf, mergePdfs, validatePdfa } = require('@pdfluent/node');
|
|
223
|
+
|
|
224
|
+
// Open from path
|
|
225
|
+
const doc = openPdf('/path/to/file.pdf');
|
|
226
|
+
|
|
227
|
+
// Merge multiple PDFs
|
|
228
|
+
mergePdfs(['a.pdf', 'b.pdf', 'c.pdf'], 'merged.pdf');
|
|
229
|
+
|
|
230
|
+
// Validate compliance
|
|
231
|
+
const report = validatePdfa('document.pdf', '2b');
|
|
232
|
+
console.log(report.compliant, report.errorCount);
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Integration with Sharp
|
|
236
|
+
|
|
237
|
+
```js
|
|
238
|
+
const sharp = require('sharp');
|
|
239
|
+
const result = doc.renderPage(0, { dpi: 150 });
|
|
240
|
+
await sharp(result.data, {
|
|
241
|
+
raw: { width: result.width, height: result.height, channels: 4 }
|
|
242
|
+
}).png().toFile('page.png');
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
**PDFluent Commercial License** — free for evaluation; a valid license is required for production use.
|
|
248
|
+
|
|
249
|
+
- **30-day evaluation key** (full features, no output watermark): <https://pdfluent.com/trial>
|
|
250
|
+
- **Pricing:** <https://pdfluent.com/pricing>
|
|
251
|
+
- **Commercial terms:** <https://pdfluent.com/terms>
|
|
252
|
+
|
|
253
|
+
Without a license key the SDK is fully functional; output PDFs carry an evaluation marker in `/Producer` metadata.
|
|
254
|
+
|
|
255
|
+
## Links
|
|
256
|
+
|
|
257
|
+
- **Documentation:** <https://pdfluent.com/docs>
|
|
258
|
+
- **Issues:** <https://pdfluent.com/support>
|
|
259
|
+
- **PDFluent editor** (source-available): <https://github.com/pdfluent/pdfluent>. The free desktop app this SDK powers.
|
|
260
|
+
- Built by [Innovation Trigger BV](https://pdfluent.com)
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,11 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfluent/node-win32-x64-msvc",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"os": [
|
|
5
|
-
|
|
3
|
+
"version": "1.0.0-beta.17.4",
|
|
4
|
+
"os": [
|
|
5
|
+
"win32"
|
|
6
|
+
],
|
|
7
|
+
"cpu": [
|
|
8
|
+
"x64"
|
|
9
|
+
],
|
|
6
10
|
"main": "index.win32-x64-msvc.node",
|
|
7
|
-
"files": [
|
|
11
|
+
"files": [
|
|
12
|
+
"index.win32-x64-msvc.node",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"description": "Enterprise PDF SDK for Node.js — find and replace PDF text while preserving fonts and layout, plus rendering, text extraction, forms, annotations, redaction, encryption, and PDF/A compliance.",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"pdf",
|
|
19
|
+
"pdf-text-replace",
|
|
20
|
+
"find-and-replace",
|
|
21
|
+
"edit-pdf-text",
|
|
22
|
+
"render",
|
|
23
|
+
"forms",
|
|
24
|
+
"xfa",
|
|
25
|
+
"acroform",
|
|
26
|
+
"text-extraction",
|
|
27
|
+
"pdf-a",
|
|
28
|
+
"compliance",
|
|
29
|
+
"annotations",
|
|
30
|
+
"redaction",
|
|
31
|
+
"encryption",
|
|
32
|
+
"signature",
|
|
33
|
+
"rust",
|
|
34
|
+
"napi",
|
|
35
|
+
"pdfluent"
|
|
36
|
+
],
|
|
37
|
+
"homepage": "https://pdfluent.com",
|
|
8
38
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
|
-
"engines": {
|
|
10
|
-
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">= 18"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/pdfluent/pdfluent-sdk"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://pdfluent.com/support"
|
|
51
|
+
}
|
|
11
52
|
}
|