@embedpdf/engines 1.0.0
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 +21 -0
- package/README.md +81 -0
- package/dist/chunk-NDTYBBMQ.js +4615 -0
- package/dist/chunk-NDTYBBMQ.js.map +1 -0
- package/dist/chunk-YZLT3A2D.js +1101 -0
- package/dist/chunk-YZLT3A2D.js.map +1 -0
- package/dist/converters.cjs +124 -0
- package/dist/converters.cjs.map +1 -0
- package/dist/converters.d.cts +69 -0
- package/dist/converters.d.ts +69 -0
- package/dist/converters.js +94 -0
- package/dist/converters.js.map +1 -0
- package/dist/index.cjs +6054 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +367 -0
- package/dist/index.js.map +1 -0
- package/dist/pdfium.cjs +5715 -0
- package/dist/pdfium.cjs.map +1 -0
- package/dist/pdfium.d.cts +1083 -0
- package/dist/pdfium.d.ts +1083 -0
- package/dist/pdfium.js +22 -0
- package/dist/pdfium.js.map +1 -0
- package/dist/runner-BvRtPCKL.d.cts +131 -0
- package/dist/runner-BvRtPCKL.d.ts +131 -0
- package/dist/worker.cjs +1122 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +274 -0
- package/dist/worker.d.ts +274 -0
- package/dist/worker.js +11 -0
- package/dist/worker.js.map +1 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 CloudPDF, Ji Chang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://www.embedpdf.com">
|
|
3
|
+
<img alt="EmbedPDF logo" src="https://www.embedpdf.com/logo-192.png" height="96">
|
|
4
|
+
</a>
|
|
5
|
+
<h1>EmbedPDF</h1>
|
|
6
|
+
|
|
7
|
+
<a href="https://www.npmjs.com/package/@embedpdf/engines"><img alt="NPM version" src="https://img.shields.io/npm/v/@embedpdf/engines.svg?style=for-the-badge&labelColor=000000"></a> <a href="https://github.com/embedpdf/embed-pdf-viewer/blob/main/packages/engines/LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@embedpdf/engines.svg?style=for-the-badge&labelColor=000000"></a> <a href="https://github.com/embedpdf/embed-pdf-viewer/discussions"><img alt="Join the community on GitHub" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&labelColor=000000"></a>
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
# @embedpdf/engines
|
|
12
|
+
|
|
13
|
+
Pluggable rendering engines for EmbedPDF. Ships with **`PdfiumEngine`** – a high‑level, promise‑first wrapper built on top of `@embedpdf/pdfium`.
|
|
14
|
+
|
|
15
|
+
## Documentation
|
|
16
|
+
|
|
17
|
+
For complete guides, examples, and full API reference, visit:
|
|
18
|
+
|
|
19
|
+
**[Official Documentation](https://www.embedpdf.com/docs/engines/introduction)**
|
|
20
|
+
|
|
21
|
+
## Why `@embedpdf/engines`?
|
|
22
|
+
|
|
23
|
+
- **High‑level abstraction** – handles tasks, DPR scaling, annotation colour resolution, range/linearised loading.
|
|
24
|
+
- **Universal runtimes** – works in browsers, Node, and serverless environments.
|
|
25
|
+
- **Typed & composable** – 100 % TypeScript with generics for custom image pipelines.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- Open PDFs from `ArrayBuffer` or URL
|
|
30
|
+
- Render full pages, arbitrary rectangles, thumbnails – all DPI‑aware
|
|
31
|
+
- Text extraction, glyph geometry, word‑break‑aware search with context windows
|
|
32
|
+
- Read / create / transform / delete **annotations** and **form fields**
|
|
33
|
+
- Page ops: merge, extract, flatten, partial import
|
|
34
|
+
- Attachments & digital‑signature introspection
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @embedpdf/engines @embedpdf/pdfium
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Basic Usage
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { init } from '@embedpdf/pdfium';
|
|
46
|
+
import { PdfiumEngine } from '@embedpdf/engines/pdfium';
|
|
47
|
+
|
|
48
|
+
const pdfiumWasm =
|
|
49
|
+
'https://cdn.jsdelivr.net/npm/@embedpdf/pdfium/dist/pdfium.wasm';
|
|
50
|
+
|
|
51
|
+
(async () => {
|
|
52
|
+
const response = await fetch(pdfiumWasm);
|
|
53
|
+
const wasmBinary = await response.arrayBuffer();
|
|
54
|
+
// 1 – boot the low‑level WASM module
|
|
55
|
+
const pdfium = await init({ wasmBinary });
|
|
56
|
+
|
|
57
|
+
// 2 – create the high‑level engine
|
|
58
|
+
const engine = new PdfiumEngine(pdfium);
|
|
59
|
+
engine.initialize();
|
|
60
|
+
|
|
61
|
+
// 3 – open & render
|
|
62
|
+
const document = await engine
|
|
63
|
+
.openDocumentUrl({ id: 'demo', url: '/demo.pdf' })
|
|
64
|
+
.toPromise();
|
|
65
|
+
const page0 = doc.pages[0];
|
|
66
|
+
|
|
67
|
+
const blob = await engine.renderPage(doc, page0).toPromise();
|
|
68
|
+
})();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Learn More
|
|
72
|
+
|
|
73
|
+
Head over to our docs for:
|
|
74
|
+
|
|
75
|
+
- **Getting Started** – initialise, render, destroy
|
|
76
|
+
- **Engine Interface** – implement your own back‑end
|
|
77
|
+
- **Advanced Topics** – workers, Node pipelines, Sharp image adapters
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT – see the [LICENSE](https://github.com/embedpdf/embed-pdf-viewer/blob/main/packages/engines/LICENSE) file.
|