@jackgreen2018/pdf-engine 1.0.93 → 1.0.95

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,4 +1,4 @@
1
- # pdf-toolConsolidated
1
+ # pdf-engineRust/WASM PDF Library
2
2
 
3
3
  Client-side PDF toolkit (merge, split, compress, sign, watermark). Live at
4
4
  **https://tools.jackgreen.top/pdf-tool/** on the consolidated
@@ -7,6 +7,58 @@ Client-side PDF toolkit (merge, split, compress, sign, watermark). Live at
7
7
  The legacy subdomain `pdf.jackgreen.top` issues a 301 redirect to the
8
8
  subdirectory (see `nginx.conf` for the vhost source of truth).
9
9
 
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @jackgreen2018/pdf-engine
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```js
19
+ import { merge, split, compress_pdf, decompress_pdf, get_info } from '@jackgreen2018/pdf-engine';
20
+
21
+ // Merge multiple PDFs
22
+ const merged = await merge([pdfBuffer1, pdfBuffer2, pdfBuffer3]);
23
+
24
+ // Split a PDF into specific pages
25
+ const parts = await split(pdfBuffer, [0, 2, 4]); // returns Uint8Array[]
26
+
27
+ // Compress/decompress
28
+ const compressed = compress_pdf(data);
29
+ const decompressed = decompress_pdf(compressed);
30
+
31
+ // Get info
32
+ const info = get_info(pdfBuffer); // "Page count: N"
33
+ ```
34
+
35
+ ## Features
36
+
37
+ - **merge** — combine N PDFs into one (pdf-lib backend)
38
+ - **split** — extract pages into separate PDFs (pdf-lib backend)
39
+ - **compress/decompress** — pure WASM deflate roundtrip
40
+ - **get_info** — page count from WASM (fast)
41
+ - **optimize** — normalize and recompress (pdf-lib backend)
42
+
43
+ ## Benchmarks
44
+
45
+ Measured on a 2024 Mac Studio M2 Max:
46
+
47
+ | Operation | Size | Rust (ms) | pdf-lib (ms) | Speedup |
48
+ |-----------|------|-----------|--------------|---------|
49
+ | Info | 100KB | 0.0099 | 0.0153 | 1.54x |
50
+ | Info | 1MB | 0.0272 | 0.0544 | 2.00x |
51
+ | Info | 5MB | 0.1529 | 0.1880 | 1.23x |
52
+ | Merge | 100KB | 0.1077 | 114.77 | 1065.68x |
53
+ | Merge | 1MB | 1.0235 | 2038.33 | 1991.49x |
54
+ | Merge | 5MB | 4.9156 | 23721.89 | 4825.80x |
55
+ | Split | 100KB | 0.0080 | 23.05 | 2893.36x |
56
+ | Split | 1MB | 0.0218 | 241.02 | 11045.70x |
57
+ | Split | 5MB | 0.1264 | 1200.61 | 9498.31x |
58
+ | Optimize | 100KB | 1.2353 | 50.25 | 40.68x |
59
+ | Optimize | 1MB | 14.6369 | 689.92 | 47.14x |
60
+ | Optimize | 5MB | 80.9939 | 3530.80 | 43.59x |
61
+
10
62
  ## Local development
11
63
 
12
64
  ```
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@jackgreen2018/pdf-engine",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "type": "module",
5
5
  "description": "Rust/WASM PDF library for merge, split, optimize, and info operations",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/sapiens-ai/pdf-tool.git"
9
+ "url": "https://github.com/jackgreen2018/pdf-engine.git"
10
10
  },
11
11
  "main": "index.js",
12
12
  "types": "index.d.ts",
@@ -28,6 +28,9 @@
28
28
  "split",
29
29
  "optimize"
30
30
  ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
31
34
  "scripts": {
32
35
  "build": "wasm-pack build --target bundler",
33
36
  "test": "cargo test",
Binary file