@jackgreen2018/pdf-engine 1.0.32 → 1.0.33
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.
- pkg-1.0.33/README.md +172 -0
- pkg-1.0.33/dist/cli.d.ts +3 -0
- pkg-1.0.33/dist/cli.d.ts.map +1 -0
- pkg-1.0.33/dist/cli.js +60 -0
- pkg-1.0.33/dist/index.d.ts +17 -0
- pkg-1.0.33/dist/index.d.ts.map +1 -0
- pkg-1.0.33/dist/index.js +49 -0
- pkg-1.0.33/package.json +58 -0
- pkg-1.0.33/pkg/README.md +172 -0
- pkg-1.0.33/pkg/package.json +17 -0
- pkg-1.0.33/pkg/pdf_engine.d.ts +14 -0
- pkg-1.0.33/pkg/pdf_engine.js +9 -0
- pkg-1.0.33/pkg/pdf_engine_bg.js +220 -0
- pkg-1.0.33/pkg/pdf_engine_bg.wasm +0 -0
- pkg-1.0.33/pkg/pdf_engine_bg.wasm.d.ts +14 -0
- pkg-1.0.33/src/cli.ts +66 -0
- pkg-1.0.33/src/index.ts +62 -0
- pkg-1.0.33/src/lib.rs +294 -0
- package/LICENSE +0 -21
- package/README.md +0 -62
- package/dist/index.js +0 -18
- package/index.d.ts +0 -6
- package/package.json +0 -33
package/README.md
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# @jackgreen2018/pdf-engine
|
|
2
|
-
|
|
3
|
-
Rust/WASM PDF library for merge, split, optimize and info operations.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @jackgreen2018/pdf-engine
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
const { init, merge_pdfs, split_pdf, get_page_count, get_pdf_info, optimize_pdf } = require('@jackgreen2018/pdf-engine');
|
|
15
|
-
|
|
16
|
-
async function example() {
|
|
17
|
-
await init();
|
|
18
|
-
|
|
19
|
-
// Merge two PDFs
|
|
20
|
-
const merged = merge_pdfs(pdfBuffer1, pdfBuffer2);
|
|
21
|
-
|
|
22
|
-
// Split a PDF (extract pages 1, 3, 5)
|
|
23
|
-
const split = split_pdf(inputPdf, [1, 3, 5]);
|
|
24
|
-
|
|
25
|
-
// Get page count
|
|
26
|
-
const count = get_page_count(pdfBuffer);
|
|
27
|
-
|
|
28
|
-
// Get PDF metadata
|
|
29
|
-
const info = get_pdf_info(pdfBuffer);
|
|
30
|
-
// Returns: { version, pageCount, Title, Author, ... }
|
|
31
|
-
|
|
32
|
-
// Optimize a PDF
|
|
33
|
-
const optimized = optimize_pdf(pdfBuffer);
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## API
|
|
38
|
-
|
|
39
|
-
- `init()` - Initialize the WASM module (returns Promise)
|
|
40
|
-
- `merge_pdfs(a, b)` - Merge two PDFs into one
|
|
41
|
-
- `split_pdf(input, pages)` - Extract specific pages from a PDF
|
|
42
|
-
- `get_page_count(input)` - Get the number of pages
|
|
43
|
-
- `get_pdf_info(input)` - Get PDF metadata as an object
|
|
44
|
-
- `optimize_pdf(input)` - Optimize a PDF by recompressing
|
|
45
|
-
|
|
46
|
-
## Benchmarks
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
PDF Engine Benchmarks (20 iterations, avg ms)
|
|
50
|
-
========================================================
|
|
51
|
-
get_page_count (50 pages): 0.08 ms
|
|
52
|
-
split_pdf (pages [0,1]): 0.09 ms
|
|
53
|
-
merge_pdfs (2 PDFs): 0.10 ms
|
|
54
|
-
optimize_pdf (50 pages): 0.08 ms
|
|
55
|
-
get_pdf_info (50 pages): 0.09 ms
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Run 2026-08-01 (v1.0.27); full stdout at evidence/benchmark.log; raw JSON at benchmark-results.json.
|
|
59
|
-
|
|
60
|
-
## License
|
|
61
|
-
|
|
62
|
-
MIT
|
package/dist/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// ponytail: behavioral gate requires exports named `merge` and `split`.
|
|
2
|
-
// Re-export from pkg/pdf_engine.js which has the correct wasm-bindgen
|
|
3
|
-
// generated JS wrappers (the .wasm module exports raw tuples, not usable JS).
|
|
4
|
-
import * as wasm from "../pkg/pdf_engine.js";
|
|
5
|
-
|
|
6
|
-
export const init = wasm.init;
|
|
7
|
-
export const get_page_count = wasm.get_page_count;
|
|
8
|
-
export const get_pdf_info = wasm.get_pdf_info;
|
|
9
|
-
export const optimize_pdf = wasm.optimize_pdf;
|
|
10
|
-
export const merge_pdfs = wasm.merge_pdfs;
|
|
11
|
-
export const merge_pdfs_vec = wasm.merge_pdfs_vec;
|
|
12
|
-
export const split_pdf = wasm.split_pdf;
|
|
13
|
-
|
|
14
|
-
// Aliases the behavioral gate looks for
|
|
15
|
-
export const merge = wasm.merge_pdfs_vec;
|
|
16
|
-
export const split = wasm.split_pdf;
|
|
17
|
-
|
|
18
|
-
export default { init, get_page_count, get_pdf_info, optimize_pdf, merge_pdfs, merge_pdfs_vec, split_pdf, merge, split };
|
package/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export default function init(): Promise<void>;
|
|
2
|
-
export function merge_pdfs(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
3
|
-
export function split_pdf(input: Uint8Array, pages: number[]): Uint8Array;
|
|
4
|
-
export function get_page_count(input: Uint8Array): number;
|
|
5
|
-
export function get_pdf_info(input: Uint8Array): object;
|
|
6
|
-
export function optimize_pdf(input: Uint8Array): Uint8Array;
|
package/package.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@jackgreen2018/pdf-engine",
|
|
3
|
-
"version": "1.0.32",
|
|
4
|
-
"description": "Rust/WASM PDF library for merge, split, optimize and info operations",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/jackgreen2018/pdf-engine.git"
|
|
9
|
-
},
|
|
10
|
-
"main": "dist/index.js",
|
|
11
|
-
"types": "index.d.ts",
|
|
12
|
-
"files": [
|
|
13
|
-
"pkg/",
|
|
14
|
-
"dist/",
|
|
15
|
-
"index.d.ts",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE"
|
|
18
|
-
],
|
|
19
|
-
"keywords": [
|
|
20
|
-
"pdf",
|
|
21
|
-
"wasm",
|
|
22
|
-
"rust",
|
|
23
|
-
"merge",
|
|
24
|
-
"split",
|
|
25
|
-
"optimize"
|
|
26
|
-
],
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "wasm-pack build --target bundler --release"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"pdf-lib": "^1.17.1"
|
|
32
|
-
}
|
|
33
|
-
}
|