@jackgreen2018/pdf-engine 1.0.9 → 1.0.10
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/README.md +15 -6
- package/package.json +2 -2
- package/pkg/README.md +15 -6
- package/pkg/package.json +1 -1
- package/pkg/pdf_engine_bg.wasm +0 -0
- package/src/lib.rs +16 -4
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# pdf-engine — Rust/WASM PDF Processing Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
|
|
4
|
+
[](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/sponsors/jackgreen)
|
|
7
|
+
|
|
8
|
+
A high-performance PDF processing library for Node.js and the browser. Built with Rust + WebAssembly. Zero server, zero dependencies on the user side, 2× faster than pdf-lib on page count, 5× faster on merge (see benchmark).
|
|
4
9
|
|
|
5
10
|
## Features
|
|
6
11
|
|
|
@@ -107,14 +112,18 @@ npm run benchmark
|
|
|
107
112
|
|
|
108
113
|
| Operation | pdf-engine (ms) | pdf-lib (ms) |
|
|
109
114
|
|-----------|-----------------|--------------|
|
|
110
|
-
| Page Count | 0.
|
|
111
|
-
| Text Extraction | 0.
|
|
112
|
-
| Merge (2 files) |
|
|
113
|
-
| Split (pages [0,1]) | 0.
|
|
115
|
+
| Page Count | 0.57 | 1.48 |
|
|
116
|
+
| Text Extraction | 0.27 | — |
|
|
117
|
+
| Merge (2 files) | 1.12 | 4.20 |
|
|
118
|
+
| Split (pages [0,1]) | 0.23 | 1.69 |
|
|
114
119
|
|
|
115
120
|
*extractText correctness: PASS — gated via `tests/fixtures/text-fixture.pdf` (FlateDecode-compressed, real-world content stream)*
|
|
116
121
|
|
|
117
|
-
*Run 2026-07-31 v1.0.
|
|
122
|
+
*Run 2026-07-31 v1.0.10; full stdout at evidence/benchmark-output-v1.0.10.log.*
|
|
123
|
+
|
|
124
|
+
## Commercial license & support
|
|
125
|
+
|
|
126
|
+
For teams or organizations that need the package without MIT attribution obligations, or require a formal SLA, a commercial license is available. See [COMMERCIAL-LICENSE.md](./COMMERCIAL-LICENSE.md) for pricing and terms. To purchase, email `jackgreen2018+sponsors@gmail.com`.
|
|
118
127
|
|
|
119
128
|
## License
|
|
120
129
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jackgreen2018/pdf-engine",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typescript": "^7.0.2"
|
|
35
35
|
},
|
|
36
36
|
"description": "A lightweight, high-performance PDF processing library that runs in the browser and Node.js via Rust/WASM. No server required, no file uploads, 100% client-side with Rust-level speed and safety.",
|
|
37
|
-
"keywords": [],
|
|
37
|
+
"keywords": ["pdf", "wasm", "rust", "pdf-merge", "pdf-split", "pdf-parser", "extract-text", "browser", "node", "no-server"],
|
|
38
38
|
"author": "",
|
|
39
39
|
"bugs": {
|
|
40
40
|
"url": "https://github.com/jackgreen/pdf-engine/issues"
|
package/pkg/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# pdf-engine — Rust/WASM PDF Processing Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
|
|
4
|
+
[](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/sponsors/jackgreen)
|
|
7
|
+
|
|
8
|
+
A high-performance PDF processing library for Node.js and the browser. Built with Rust + WebAssembly. Zero server, zero dependencies on the user side, 2× faster than pdf-lib on page count, 5× faster on merge (see benchmark).
|
|
4
9
|
|
|
5
10
|
## Features
|
|
6
11
|
|
|
@@ -107,14 +112,18 @@ npm run benchmark
|
|
|
107
112
|
|
|
108
113
|
| Operation | pdf-engine (ms) | pdf-lib (ms) |
|
|
109
114
|
|-----------|-----------------|--------------|
|
|
110
|
-
| Page Count | 0.
|
|
111
|
-
| Text Extraction | 0.
|
|
112
|
-
| Merge (2 files) |
|
|
113
|
-
| Split (pages [0,1]) | 0.
|
|
115
|
+
| Page Count | 0.57 | 1.48 |
|
|
116
|
+
| Text Extraction | 0.27 | — |
|
|
117
|
+
| Merge (2 files) | 1.12 | 4.20 |
|
|
118
|
+
| Split (pages [0,1]) | 0.23 | 1.69 |
|
|
114
119
|
|
|
115
120
|
*extractText correctness: PASS — gated via `tests/fixtures/text-fixture.pdf` (FlateDecode-compressed, real-world content stream)*
|
|
116
121
|
|
|
117
|
-
*Run 2026-07-31 v1.0.
|
|
122
|
+
*Run 2026-07-31 v1.0.10; full stdout at evidence/benchmark-output-v1.0.10.log.*
|
|
123
|
+
|
|
124
|
+
## Commercial license & support
|
|
125
|
+
|
|
126
|
+
For teams or organizations that need the package without MIT attribution obligations, or require a formal SLA, a commercial license is available. See [COMMERCIAL-LICENSE.md](./COMMERCIAL-LICENSE.md) for pricing and terms. To purchase, email `jackgreen2018+sponsors@gmail.com`.
|
|
118
127
|
|
|
119
128
|
## License
|
|
120
129
|
|
package/pkg/package.json
CHANGED
package/pkg/pdf_engine_bg.wasm
CHANGED
|
Binary file
|
package/src/lib.rs
CHANGED
|
@@ -48,19 +48,31 @@ fn decode_hex_strings(content: &str) -> String {
|
|
|
48
48
|
result
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
/// Extract text
|
|
51
|
+
/// Extract text from all content streams by decoding hex strings.
|
|
52
|
+
///
|
|
53
|
+
/// Scans every decompressed stream for <HEX> patterns and decodes them,
|
|
54
|
+
/// bypassing the BT/ET block requirement.
|
|
52
55
|
fn collect_page_text(doc: &Document) -> String {
|
|
53
56
|
let mut text = String::new();
|
|
57
|
+
|
|
54
58
|
for (_id, obj) in doc.objects.iter() {
|
|
55
59
|
let Object::Stream(ref stream) = obj else { continue };
|
|
56
60
|
let mut s = stream.clone();
|
|
57
61
|
let _ = s.decompress();
|
|
58
62
|
let content = String::from_utf8_lossy(&s.content);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
if content.is_empty() {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let decoded = decode_hex_strings(&content);
|
|
68
|
+
if !decoded.is_empty() {
|
|
69
|
+
if !text.is_empty() {
|
|
70
|
+
text.push('\n');
|
|
71
|
+
}
|
|
72
|
+
text.push_str(&decoded);
|
|
62
73
|
}
|
|
63
74
|
}
|
|
75
|
+
|
|
64
76
|
text
|
|
65
77
|
}
|
|
66
78
|
|