@embedpdf/pdfium 1.0.0-alpha.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 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,82 @@
1
+ # @embedpdf/pdfium
2
+
3
+ PDFium WebAssembly for the web platform. This package provides a powerful JavaScript interface to PDFium, enabling high-quality PDF rendering and manipulation directly in web applications.
4
+
5
+ ## Documentation
6
+
7
+ For complete documentation, examples, and API reference, please visit:
8
+
9
+ **[Official Documentation](https://www.embedpdf.com/docs/pdfium/introduction)**
10
+
11
+ ## What is PDFium?
12
+
13
+ PDFium is an open-source PDF rendering engine originally developed by Foxit Software and later released as open source by Google. Written in C++, it's the same engine that powers PDF viewing in Chrome and numerous other applications. This package brings native-quality PDF capabilities to the browser through WebAssembly, without requiring any server-side processing.
14
+
15
+ ## Features
16
+
17
+ - High-fidelity rendering of PDF pages
18
+ - Text extraction and search
19
+ - Form filling and manipulation
20
+ - Annotation support
21
+ - Digital signature verification
22
+ - PDF modification and creation
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ # npm
28
+ npm install @embedpdf/pdfium
29
+
30
+ # pnpm
31
+ pnpm add @embedpdf/pdfium
32
+
33
+ # yarn
34
+ yarn add @embedpdf/pdfium
35
+
36
+ # bun
37
+ bun add @embedpdf/pdfium
38
+ ```
39
+
40
+ ## Basic Usage
41
+
42
+ ```javascript
43
+ import { init, WrappedPdfiumModule } from '@embedpdf/pdfium';
44
+
45
+ const pdfiumWasm = 'https://cdn.jsdelivr.net/npm/@embedpdf/pdfium/pdfium.wasm';
46
+
47
+ let pdfiumInstance = null;
48
+
49
+ async function initializePdfium() {
50
+ if (pdfiumInstance) return pdfiumInstance;
51
+
52
+ const response = await fetch(pdfiumWasm);
53
+ const wasmBinary = await response.arrayBuffer();
54
+ pdfiumInstance = await init({ wasmBinary });
55
+
56
+ // Initialize the PDFium extension library
57
+ // This is required before performing any PDF operations
58
+ pdfiumInstance.PDFiumExt_Init();
59
+
60
+ return pdfiumInstance;
61
+ }
62
+
63
+ // Usage
64
+ async function renderPdf() {
65
+ const pdfium = await initializePdfium();
66
+ // Use pdfium to load and render PDFs
67
+ // See documentation for detailed examples
68
+ }
69
+ ```
70
+
71
+ ## Learn More
72
+
73
+ Check out our comprehensive documentation at [embedpdf.com/docs/pdfium](https://www.embedpdf.com/docs/pdfium/introduction) for:
74
+
75
+ - Detailed API reference
76
+ - Code examples
77
+ - Best practices
78
+ - Advanced usage
79
+
80
+ ## License
81
+
82
+ This package is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.