@kne/react-pdf-sign 1.0.2 → 1.0.4

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
@@ -73,24 +73,26 @@ const BaseExample = () => {
73
73
  }}
74
74
  />
75
75
  </Button>
76
- <Button
77
- onClick={() => {
78
- const { size } = ref.current.getLocation();
79
- signatureModal({
80
- mask: (
81
- <Flex justify="flex-end" align="flex-end" style={{ height: '100%', width: '100%', padding: '10px', boxSizing: 'border-box' }}>
82
- 签字日期: {new Date().toLocaleDateString()}
83
- </Flex>
84
- ),
85
- width: size.width,
86
- height: size.height,
87
- onSuccess: file => {
88
- setSign(URL.createObjectURL(file));
89
- }
90
- });
91
- }}>
92
- 添加签名
93
- </Button>
76
+ {pdfFile && (
77
+ <Button
78
+ onClick={() => {
79
+ const { size } = ref.current.getLocation();
80
+ signatureModal({
81
+ mask: (
82
+ <Flex justify="flex-end" align="flex-end" style={{ height: '100%', width: '100%', padding: '10px', boxSizing: 'border-box' }}>
83
+ 签字日期: {new Date().toLocaleDateString()}
84
+ </Flex>
85
+ ),
86
+ width: size.width,
87
+ height: size.height,
88
+ onSuccess: file => {
89
+ setSign(URL.createObjectURL(file));
90
+ }
91
+ });
92
+ }}>
93
+ 添加签名
94
+ </Button>
95
+ )}
94
96
  {pdfFile && sign && (
95
97
  <Button
96
98
  onClick={async () => {
@@ -187,19 +189,22 @@ const BaseExample = () => {
187
189
  onClick={() => {
188
190
  ref.current.setLocation({
189
191
  size: {
190
- width: 200,
191
- height: 50,
192
- x: 240,
193
- y: 47
192
+ width: 390,
193
+ height: 156,
194
+ x: 163,
195
+ y: 8
194
196
  },
195
- scaleX: 1,
196
- scaleY: 1,
197
- x: 240,
198
- y: 47
197
+ scaleX: 1.95,
198
+ scaleY: 1.95,
199
+ x: 163,
200
+ y: 8
199
201
  });
200
202
  }}>
201
203
  设置签名位置
202
204
  </Button>
205
+ <Button onClick={()=>{
206
+ ref.current.setLocation({});
207
+ }}>恢复到默认位置</Button>
203
208
  <Button
204
209
  onClick={() => {
205
210
  const pdfSignature = ref.current.getPdfSignature();