@shznet/pdf-sign-react 0.2.0 → 0.2.1
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 +17 -9
- package/package.json +16 -3
package/README.md
CHANGED
|
@@ -5,15 +5,18 @@ React component wrapper for `@shznet/pdf-sign-control`.
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @shznet/pdf-sign-react
|
|
8
|
+
npm install @shznet/pdf-sign-react pdfjs-dist
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
import { PdfSignReact } from '@shznet/pdf-sign-react';
|
|
14
|
+
import { PdfSignReact, PdfSignReactRef } from '@shznet/pdf-sign-react';
|
|
15
|
+
import { useRef } from 'react';
|
|
15
16
|
|
|
16
17
|
export function App() {
|
|
18
|
+
const controlRef = useRef<PdfSignReactRef>(null);
|
|
19
|
+
|
|
17
20
|
const handlePdfLoaded = () => {
|
|
18
21
|
console.log('PDF Loaded!');
|
|
19
22
|
};
|
|
@@ -21,9 +24,11 @@ export function App() {
|
|
|
21
24
|
return (
|
|
22
25
|
<div style={{ height: '100vh' }}>
|
|
23
26
|
<PdfSignReact
|
|
24
|
-
|
|
27
|
+
ref={controlRef}
|
|
28
|
+
src="https://example.com/doc.pdf"
|
|
29
|
+
viewMode="scroll"
|
|
30
|
+
zoomable={true}
|
|
25
31
|
onLoad={handlePdfLoaded}
|
|
26
|
-
primaryColor="#ff0000"
|
|
27
32
|
/>
|
|
28
33
|
</div>
|
|
29
34
|
);
|
|
@@ -34,8 +39,11 @@ export function App() {
|
|
|
34
39
|
|
|
35
40
|
| Prop | Type | Description |
|
|
36
41
|
|------|------|-------------|
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `onLoad` | `() => void` | Callback when PDF is
|
|
42
|
+
| `src` | `string \| Uint8Array \| ArrayBuffer` | PDF source to load. |
|
|
43
|
+
| `viewMode` | `'single' \| 'scroll'` | Initial view mode. |
|
|
44
|
+
| `zoomable` | `boolean` | Enable/disable gesture zooming (default: true). |
|
|
45
|
+
| `fields` | `SignatureField[]` | Initial fields to render. |
|
|
46
|
+
| `onLoad` | `() => void` | Callback when PDF is loaded. |
|
|
47
|
+
| `onPageChange` | `(page: number, total: number) => void` | Callback when page changes. |
|
|
48
|
+
| `onScaleChange` | `(scale: number) => void` | Callback when zoom level changes. |
|
|
49
|
+
| `onFieldsChange` | `(fields: SignatureField[]) => void` | Callback when fields are added/removed/updated. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shznet/pdf-sign-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "React wrapper for @shznet/pdf-sign-control",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/ShzNet/pdf-signature-control.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Chien Tran <chientranit@gmail.com>",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/ShzNet/pdf-signature-control/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/ShzNet/pdf-signature-control#readme",
|
|
4
15
|
"type": "module",
|
|
5
16
|
"main": "./dist/index.js",
|
|
6
17
|
"module": "./dist/index.js",
|
|
@@ -21,9 +32,11 @@
|
|
|
21
32
|
"publishConfig": {
|
|
22
33
|
"access": "public"
|
|
23
34
|
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@shznet/pdf-sign-control": "*"
|
|
37
|
+
},
|
|
24
38
|
"peerDependencies": {
|
|
25
39
|
"react": ">=16.8.0",
|
|
26
|
-
"react-dom": ">=16.8.0"
|
|
27
|
-
"@shznet/pdf-sign-control": "*"
|
|
40
|
+
"react-dom": ">=16.8.0"
|
|
28
41
|
}
|
|
29
42
|
}
|