@shznet/pdf-sign-control 0.1.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.
Files changed (2) hide show
  1. package/README.md +58 -0
  2. package/package.json +27 -0
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @shznet/pdf-sign-control
2
+
3
+ The core engine for the `@shznet/pdf-sign` ecosystem. It provides a framework-agnostic class `PdfSignControl` to render PDFs and manage interactive signature fields.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @shznet/pdf-sign-control pdfjs-dist
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { PdfSignControl } from '@shznet/pdf-sign-control';
15
+
16
+ // 1. Initialize the control
17
+ const container = document.getElementById('pdf-wrapper');
18
+ const pdfControl = new PdfSignControl(container, {
19
+ allowEdit specific: true,
20
+ primaryColor: '#007bff'
21
+ });
22
+
23
+ // 2. Load a PDF
24
+ await pdfControl.init('https://example.com/sample.pdf');
25
+
26
+ // 3. Add a signature field
27
+ pdfControl.addField({
28
+ page: 1,
29
+ x: 100,
30
+ y: 100,
31
+ width: 150,
32
+ height: 50,
33
+ id: 'sign_1'
34
+ });
35
+
36
+ // 4. Listen to events
37
+ container.addEventListener('field:change', (e) => {
38
+ console.log('Field updated:', e.detail);
39
+ });
40
+ ```
41
+
42
+ ## API
43
+
44
+ ### `init(url: string): Promise<void>`
45
+ Loads and renders the PDF from the given URL.
46
+
47
+ ### `addField(field: SignatureField): void`
48
+ Adds a new signature field to the document.
49
+
50
+ ### `setMode(mode: 'single-page' | 'scroll'): void`
51
+ Switches between single page view and continuous scroll view.
52
+
53
+ ### `zoomIn() / zoomOut() / setScale(scale: number)`
54
+ Controls the zoom level of the document.
55
+
56
+ ## License
57
+
58
+ MIT
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@shznet/pdf-sign-control",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "@shznet/source": "./src/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "!**/*.tsbuildinfo"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "pdfjs-dist": "^5.4.530"
26
+ }
27
+ }