@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 CHANGED
@@ -1,6 +1,11 @@
1
1
  # pdf-engine — Rust/WASM PDF Processing Library
2
2
 
3
- 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.
3
+ [![npm version](https://img.shields.io/npm/v/@jackgreen2018/pdf-engine)](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
4
+ [![npm downloads](https://img.shields.io/npm/dt/@jackgreen2018/pdf-engine)](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
5
+ [![License: MIT](https://img.shields.io/github/license/jackgreen/pdf-engine)](LICENSE)
6
+ [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=GitHub%20Sponsors&color=ea4aaa&logo=github-sponsors)](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.64 | 1.41 |
111
- | Text Extraction | 0.20 | — |
112
- | Merge (2 files) | 0.86 | 3.63 |
113
- | Split (pages [0,1]) | 0.20 | 1.76 |
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.9; full stdout at evidence/bench_full.txt.*
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.9",
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
- 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.
3
+ [![npm version](https://img.shields.io/npm/v/@jackgreen2018/pdf-engine)](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
4
+ [![npm downloads](https://img.shields.io/npm/dt/@jackgreen2018/pdf-engine)](https://www.npmjs.com/package/@jackgreen2018/pdf-engine)
5
+ [![License: MIT](https://img.shields.io/github/license/jackgreen/pdf-engine)](LICENSE)
6
+ [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=GitHub%20Sponsors&color=ea4aaa&logo=github-sponsors)](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.64 | 1.41 |
111
- | Text Extraction | 0.20 | — |
112
- | Merge (2 files) | 0.86 | 3.63 |
113
- | Split (pages [0,1]) | 0.20 | 1.76 |
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.9; full stdout at evidence/bench_full.txt.*
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pdf_engine",
3
3
  "type": "module",
4
- "version": "1.0.9",
4
+ "version": "1.0.10",
5
5
  "files": [
6
6
  "pdf_engine_bg.wasm",
7
7
  "pdf_engine.js",
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 by iterating ALL objects and processing content streams.
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
- // ponytail: only process streams that look like page content (have BT/ET text blocks)
60
- if content.contains("BT") && content.contains("ET") {
61
- text.push_str(&decode_hex_strings(&content));
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