@shznet/pdf-sign-react 0.2.3 → 1.0.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 CHANGED
@@ -57,6 +57,7 @@ export function App() {
57
57
  | `onPageChange` | `(page: number, total: number) => void` | Callback when page changes (enables two-way binding). |
58
58
  | `onScaleChange` | `(scale: number) => void` | Callback when zoom level changes. |
59
59
  | `onFieldsChange` | `(fields: SignatureField[]) => void` | Callback when fields are modified. |
60
+ | `onSelectionChange` | `(data: { field: SignatureField | null }) => void` | Callback when field selection changes. |
60
61
  | `onError` | `(error: Error) => void` | Callback on errors. |
61
62
 
62
63
  ## Two-Way Binding Example
@@ -124,13 +125,13 @@ await pdfRef.current?.setViewMode('single');
124
125
  const mode = pdfRef.current?.getViewMode();
125
126
 
126
127
  // Page Dimensions
127
- const dims = await pdfRef.current?.getPageDimensions(0); // Page 1 (0-based index)
128
+ const dims = await pdfRef.current?.getPageDimensions(1); // Page 1 (1-based index)
128
129
  console.log(`Page size: ${dims?.width} x ${dims?.height} points`);
129
130
 
130
131
  // Field Management
131
132
  await pdfRef.current?.addField({
132
133
  id: 'sig1',
133
- pageIndex: 0,
134
+ pageNumber: 1,
134
135
  rect: { x: 100, y: 100, width: 200, height: 80 },
135
136
  type: 'signature',
136
137
  content: '<svg>...</svg>',
@@ -141,6 +142,7 @@ await pdfRef.current?.addField({
141
142
  pdfRef.current?.removeField('sig1');
142
143
  pdfRef.current?.updateField('sig1', { rect: { x: 150, y: 150, width: 200, height: 80 } });
143
144
  const fields = pdfRef.current?.getFields();
145
+ pdfRef.current?.clearFields();
144
146
 
145
147
  // Printing
146
148
  await pdfRef.current?.print({ withSignatures: false });