@kne/react-pdf-sign 1.1.1 → 1.1.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
@@ -133,7 +133,9 @@ const { Flex, Button, Switch, App } = antd;
133
133
  const BaseExample = () => {
134
134
  const [pdfFile, setPdfFile] = useState(null);
135
135
  const [isEdit, setIsEdit] = useState(true);
136
+ const [isFat, setIsFat] = useState(false);
136
137
  const ref = useRef(null);
138
+ const [signatureList, setSignatureList] = useState([]);
137
139
  const signatureModal = useSignature();
138
140
  const { message } = App.useApp();
139
141
  return (
@@ -149,44 +151,65 @@ const BaseExample = () => {
149
151
  }}
150
152
  />
151
153
  </Button>
152
- {pdfFile && (
153
- <Flex gap={8}>
154
- <div>编辑模式:</div>
155
- <Switch value={isEdit} onChange={setIsEdit} />
156
- </Flex>
157
- )}
158
- {pdfFile && isEdit && (
159
- <Button
160
- onClick={() => {
161
- ref.current.addSignLocation();
162
- }}>
163
- 添加签名位置
164
- </Button>
165
- )}
166
- {pdfFile && !isEdit && (
167
- <Button
168
- onClick={async () => {
169
- try {
170
- const blob = await ref.current.sign();
171
- const link = document.createElement('a');
172
- const url = URL.createObjectURL(blob);
173
- link.href = url;
174
- link.download = 'signed-document.pdf';
175
- link.click();
176
- URL.revokeObjectURL(url);
177
- } catch (e) {
178
- message.error(e.message);
179
- }
180
- }}>
181
- 生成签名PDF
182
- </Button>
183
- )}
154
+ </Flex>
155
+ <Flex gap={8} align="center" justify="space-between">
156
+ <Flex gap={8} align="center">
157
+ {pdfFile && (
158
+ <Flex gap={8}>
159
+ <div>编辑模式:</div>
160
+ <Switch value={isEdit} onChange={setIsEdit} />
161
+ </Flex>
162
+ )}
163
+ {pdfFile && !isEdit && (
164
+ <Flex gap={8}>
165
+ <div>页面是否平铺:</div>
166
+ <Switch value={isFat} onChange={setIsFat} />
167
+ </Flex>
168
+ )}
169
+ {pdfFile && isEdit && (
170
+ <Button
171
+ onClick={() => {
172
+ ref.current.addSignLocation();
173
+ }}>
174
+ 添加签名位置
175
+ </Button>
176
+ )}
177
+ </Flex>
178
+ <Flex gap={8} align="center">
179
+ {pdfFile && !isEdit && (
180
+ <Flex>
181
+ <div>已签名/签名区:</div>
182
+ <div>
183
+ {signatureList.filter(item => item.signature).length}/{signatureList.length}
184
+ </div>
185
+ </Flex>
186
+ )}
187
+ {pdfFile && !isEdit && (
188
+ <Button
189
+ onClick={async () => {
190
+ try {
191
+ const blob = await ref.current.sign();
192
+ const link = document.createElement('a');
193
+ const url = URL.createObjectURL(blob);
194
+ link.href = url;
195
+ link.download = 'signed-document.pdf';
196
+ link.click();
197
+ URL.revokeObjectURL(url);
198
+ } catch (e) {
199
+ message.error(e.message);
200
+ }
201
+ }}>
202
+ 生成签名PDF
203
+ </Button>
204
+ )}
205
+ </Flex>
184
206
  </Flex>
185
207
  {pdfFile ? (
186
208
  <PDFSignMulti
187
209
  url={pdfFile}
188
210
  ref={ref}
189
211
  isEdit={isEdit}
212
+ isFlat={!isEdit && isFat}
190
213
  onSign={({ size, callback }) => {
191
214
  signatureModal({
192
215
  mask: (
@@ -201,6 +224,7 @@ const BaseExample = () => {
201
224
  }
202
225
  });
203
226
  }}
227
+ onChange={setSignatureList}
204
228
  />
205
229
  ) : null}
206
230
  </Flex>
@@ -534,6 +558,7 @@ render(<BaseExample />);
534
558
  | filename | string | 'signed-document.pdf' | 生成签名PDF的文件名 |
535
559
  | defaultSignatureList | array | - | 默认签名位置列表 |
536
560
  | isEdit | boolean | - | 是否处于编辑模式 |
561
+ | isFlat | boolean | - | 是否平铺显示所有页面 |
537
562
  | onSign | function | - | 点击签名区域时的回调函数 |
538
563
  | onChange | function | - | 签名位置列表变化回调函数 |
539
564
 
@@ -551,14 +576,15 @@ render(<BaseExample />);
551
576
 
552
577
  PDF 文档查看器组件,提供 PDF 页面浏览功能。
553
578
 
554
- | 属性 | 类型 | 默认值 | 说明 |
555
- |-------------|--------|------|-------------------|
556
- | url | string | - | PDF 文件的 URL 地址 |
557
- | className | string | - | 自定义 CSS 类名 |
558
- | defaultPage | number | 1 | 默认显示的页码 |
559
- | maxWidth | number | 1200 | 最大显示宽度 |
560
- | pdfjsUrl | string | - | 自定义 pdf.js CDN 地址 |
561
- | apis | object | - | API 配置对象 |
579
+ | 属性 | 类型 | 默认值 | 说明 |
580
+ |-------------|---------|------|-------------------|
581
+ | url | string | - | PDF 文件的 URL 地址 |
582
+ | className | string | - | 自定义 CSS 类名 |
583
+ | defaultPage | number | 1 | 默认显示的页码 |
584
+ | maxWidth | number | 1200 | 最大显示宽度 |
585
+ | pdfjsUrl | string | - | 自定义 pdf.js CDN 地址 |
586
+ | apis | object | - | API 配置对象 |
587
+ | isFlat | boolean | - | 是否平铺显示所有页面 |
562
588
 
563
589
  #### children 渲染属性
564
590
 
package/dist/index.css CHANGED
@@ -9,6 +9,11 @@
9
9
  margin: 0 auto;
10
10
  }
11
11
 
12
+ ._RgZXN {
13
+ width: 100%;
14
+ position: relative;
15
+ }
16
+
12
17
  ._PAju1 {
13
18
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
14
19
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["style.module.scss"],"names":[],"mappings":"AAAA;EACE,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,WAAW;AACb;AACA;;EAEE,cAAc;AAChB;;AAEA;EACE,wEAAwE;AAC1E;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,WAAW;AACb;;AAEA;;EAEE,kBAAkB;EAClB,eAAe;EACf,qBAAqB;EACrB,WAAW;EACX,YAAY;EACZ,eAAe;EACf,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,SAAS;EACT,2BAA2B;EAC3B,cAAc;EACd,0CAA0C;EAC1C,yCAAyC;EACzC,kBAAkB;AACpB;;AAEA;EACE,QAAQ;AACV;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;EAClB,kBAAkB;AACpB;;AAEA;EACE,WAAW;EACX,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,oBAAoB;AACtB","file":"index.css","sourcesContent":[".pdf-view-container {\n margin: 0 auto;\n position: relative;\n max-width: 1200px;\n width: 100%;\n}\n.pdf-view-container :global(.react-pdf__Page__canvas),\n.pdf-view-container :global(.textLayer) {\n margin: 0 auto;\n}\n\n.pdf-view {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n}\n\n.pdf-view-children {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n}\n\n.pdf-view-page-control-left,\n.pdf-view-page-control-right {\n position: absolute;\n font-size: 30px;\n top: calc(50% - 19px);\n z-index: 10;\n padding: 8px;\n cursor: pointer;\n opacity: 0.3;\n}\n\n.pdf-view-page-control-current {\n position: absolute;\n bottom: 10px;\n left: 50%;\n transform: translateX(-50%);\n color: #666666;\n background-color: rgba(255, 255, 255, 0.5);\n text-shadow: 0 0 8px white, 0 0 8px white;\n border-radius: 4px;\n}\n\n.pdf-view-page-control-right {\n right: 0;\n}\n\n.signature-container {\n border: 1px solid #cccccc;\n border-radius: 4px;\n position: relative;\n}\n\n.signature-canvas {\n width: 100%;\n height: 100%;\n}\n\n.signature-modal :global .ant-modal-confirm-paragraph {\n max-width: unset;\n width: 100%;\n}\n\n.signature-mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}"]}
1
+ {"version":3,"sources":["style.module.scss"],"names":[],"mappings":"AAAA;EACE,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,WAAW;AACb;AACA;;EAEE,cAAc;AAChB;;AAEA;EACE,WAAW;EACX,kBAAkB;AACpB;;AAEA;EACE,wEAAwE;AAC1E;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,WAAW;AACb;;AAEA;;EAEE,kBAAkB;EAClB,eAAe;EACf,qBAAqB;EACrB,WAAW;EACX,YAAY;EACZ,eAAe;EACf,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,YAAY;EACZ,SAAS;EACT,2BAA2B;EAC3B,cAAc;EACd,0CAA0C;EAC1C,yCAAyC;EACzC,kBAAkB;AACpB;;AAEA;EACE,QAAQ;AACV;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;EAClB,kBAAkB;AACpB;;AAEA;EACE,WAAW;EACX,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,WAAW;AACb;;AAEA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,oBAAoB;AACtB","file":"index.css","sourcesContent":[".pdf-view-container {\n margin: 0 auto;\n position: relative;\n max-width: 1200px;\n width: 100%;\n}\n.pdf-view-container :global(.react-pdf__Page__canvas),\n.pdf-view-container :global(.textLayer) {\n margin: 0 auto;\n}\n\n.pdf-view-container {\n width: 100%;\n position: relative;\n}\n\n.pdf-view {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);\n}\n\n.pdf-view-children {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10;\n}\n\n.pdf-view-page-control-left,\n.pdf-view-page-control-right {\n position: absolute;\n font-size: 30px;\n top: calc(50% - 19px);\n z-index: 10;\n padding: 8px;\n cursor: pointer;\n opacity: 0.3;\n}\n\n.pdf-view-page-control-current {\n position: absolute;\n bottom: 10px;\n left: 50%;\n transform: translateX(-50%);\n color: #666666;\n background-color: rgba(255, 255, 255, 0.5);\n text-shadow: 0 0 8px white, 0 0 8px white;\n border-radius: 4px;\n}\n\n.pdf-view-page-control-right {\n right: 0;\n}\n\n.signature-container {\n border: 1px solid #cccccc;\n border-radius: 4px;\n position: relative;\n}\n\n.signature-canvas {\n width: 100%;\n height: 100%;\n}\n\n.signature-modal :global .ant-modal-confirm-paragraph {\n max-width: unset;\n width: 100%;\n}\n\n.signature-mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}"]}
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ const PDFViewer = _ref => {
57
57
  pdfjsUrl: pdfjsUrlProps,
58
58
  url,
59
59
  maxWidth = 1200,
60
+ isFlat,
60
61
  children
61
62
  } = _ref;
62
63
  const {
@@ -84,29 +85,14 @@ const PDFViewer = _ref => {
84
85
  setWidth(Math.min(ref.current.clientWidth, maxWidth));
85
86
  }
86
87
  });
87
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
88
- ref: ref,
89
- className: classnames__default["default"](className, style['pdf-view-container'], 'pdf-view-container'),
90
- style: {
91
- maxWidth: maxWidth
92
- },
93
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
94
- className: classnames__default["default"](style['pdf-view'], 'pdf-view'),
95
- children: /*#__PURE__*/jsxRuntime.jsx(reactPdf.Document, _extends({}, Object.assign({}, documentProps), {
96
- loading: /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
97
- justify: "center",
98
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {})
99
- }),
100
- onLoadSuccess: _ref2 => {
101
- let {
102
- numPages
103
- } = _ref2;
104
- _objectWithoutPropertiesLoose(_ref2, _excluded$4);
105
- setPageSize(numPages);
106
- if (!Number.isInteger(defaultPage)) {
107
- setCurrentPage(numPages);
108
- }
109
- },
88
+ const renderPage = _ref2 => {
89
+ let {
90
+ currentPage
91
+ } = _ref2;
92
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
93
+ className: classnames__default["default"](style['pdf-view-container'], 'pdf-view-container'),
94
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
95
+ className: classnames__default["default"](style['pdf-view'], 'pdf-view'),
110
96
  children: /*#__PURE__*/jsxRuntime.jsx(reactPdf.Page, {
111
97
  width: width,
112
98
  pageNumber: currentPage,
@@ -120,31 +106,69 @@ const PDFViewer = _ref => {
120
106
  });
121
107
  }
122
108
  })
123
- }))
124
- }), size && children && /*#__PURE__*/jsxRuntime.jsx("div", {
125
- className: classnames__default["default"](style['pdf-view-children'], 'pdf-view-children'),
126
- children: typeof children === 'function' ? children({
127
- size,
128
- currentPage,
129
- pageSize
130
- }) : children
131
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
132
- className: classnames__default["default"](style['pdf-view-page-control'], 'pdf-view-page-control'),
133
- children: [currentPage > 1 && /*#__PURE__*/jsxRuntime.jsx(icons.LeftOutlined, {
134
- className: classnames__default["default"](style['pdf-view-page-control-left'], 'pdf-view-page-control-left'),
135
- onClick: () => {
136
- setCurrentPage(currentPage - 1);
137
- }
138
- }), currentPage < pageSize && /*#__PURE__*/jsxRuntime.jsx(icons.RightOutlined, {
139
- className: classnames__default["default"](style['pdf-view-page-control-right'], 'pdf-view-page-control-right'),
140
- onClick: () => {
141
- setCurrentPage(currentPage + 1);
109
+ }), size && children && /*#__PURE__*/jsxRuntime.jsx("div", {
110
+ className: classnames__default["default"](style['pdf-view-children'], 'pdf-view-children'),
111
+ children: typeof children === 'function' ? children({
112
+ size,
113
+ currentPage,
114
+ pageSize
115
+ }) : children
116
+ })]
117
+ });
118
+ };
119
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
120
+ ref: ref,
121
+ className: classnames__default["default"](className, style['pdf-view-container'], 'pdf-view-container'),
122
+ style: {
123
+ maxWidth: maxWidth
124
+ },
125
+ children: /*#__PURE__*/jsxRuntime.jsxs(reactPdf.Document, _extends({}, Object.assign({}, documentProps), {
126
+ loading: /*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
127
+ justify: "center",
128
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {})
129
+ }),
130
+ onLoadSuccess: _ref3 => {
131
+ let {
132
+ numPages
133
+ } = _ref3;
134
+ _objectWithoutPropertiesLoose(_ref3, _excluded$4);
135
+ setPageSize(numPages);
136
+ if (!Number.isInteger(defaultPage)) {
137
+ setCurrentPage(numPages);
142
138
  }
143
- }), pageSize ? /*#__PURE__*/jsxRuntime.jsxs("div", {
144
- className: classnames__default["default"](style['pdf-view-page-control-current'], 'pdf-view-page-control-current'),
145
- children: [currentPage, "/", pageSize]
146
- }) : null]
147
- })]
139
+ },
140
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Flex, {
141
+ vertical: true,
142
+ gap: 8,
143
+ children: isFlat ? Array.from({
144
+ length: pageSize
145
+ }).map((item, index) => {
146
+ return /*#__PURE__*/jsxRuntime.jsx(react.Fragment, {
147
+ children: renderPage({
148
+ currentPage: index + 1
149
+ })
150
+ }, index);
151
+ }) : renderPage({
152
+ currentPage
153
+ })
154
+ }), isFlat ? null : /*#__PURE__*/jsxRuntime.jsxs("div", {
155
+ className: classnames__default["default"](style['pdf-view-page-control'], 'pdf-view-page-control'),
156
+ children: [currentPage > 1 && /*#__PURE__*/jsxRuntime.jsx(icons.LeftOutlined, {
157
+ className: classnames__default["default"](style['pdf-view-page-control-left'], 'pdf-view-page-control-left'),
158
+ onClick: () => {
159
+ setCurrentPage(currentPage - 1);
160
+ }
161
+ }), currentPage < pageSize && /*#__PURE__*/jsxRuntime.jsx(icons.RightOutlined, {
162
+ className: classnames__default["default"](style['pdf-view-page-control-right'], 'pdf-view-page-control-right'),
163
+ onClick: () => {
164
+ setCurrentPage(currentPage + 1);
165
+ }
166
+ }), pageSize ? /*#__PURE__*/jsxRuntime.jsxs("div", {
167
+ className: classnames__default["default"](style['pdf-view-page-control-current'], 'pdf-view-page-control-current'),
168
+ children: [currentPage, "/", pageSize]
169
+ }) : null]
170
+ })]
171
+ }))
148
172
  });
149
173
  };
150
174
 
@@ -658,13 +682,15 @@ const computedPDFSignLocation = ({
658
682
  }) => {
659
683
  const scaleX = size.width / size.originalWidth;
660
684
  const scaleY = size.height / size.originalHeight;
661
- const pdfX = Math.round(location.size.x / scaleX);
662
- const pdfY = Math.round(size.originalHeight - location.size.y / scaleY);
663
- const signWidth = Math.round(location.size.width / scaleX);
664
- const signHeight = Math.round(location.size.height / scaleY);
685
+ const pdfX = Math.round(location.size.x);
686
+ const pdfY = Math.round(size.originalHeight - location.size.y);
687
+ const signWidth = Math.round(location.size.width);
688
+ const signHeight = Math.round(location.size.height);
665
689
  return {
666
690
  scaleX,
667
691
  scaleY,
692
+ pageWidth: size.originalWidth,
693
+ pageHeight: size.originalHeight,
668
694
  pdfX,
669
695
  pdfY,
670
696
  width: signWidth,
@@ -686,24 +712,25 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
686
712
  height = 80,
687
713
  padding,
688
714
  filename = 'signed-document.pdf',
689
- defaultLocation,
715
+ location,
716
+ setLocation,
690
717
  onChange
691
718
  } = _ref;
692
719
  const initLocation = react.useMemo(() => {
693
720
  return getInitLocation({
694
- stageWidth: size.width,
695
- stageHeight: size.height,
721
+ stageWidth: size.originalWidth,
722
+ stageHeight: size.originalHeight,
696
723
  width,
697
724
  height
698
725
  });
699
726
  }, [size, width, height]);
700
- const [location, setLocationOrigin] = react.useState(Object.assign({}, initLocation, defaultLocation));
701
- const setLocation = useRefCallback__default["default"](value => {
702
- setLocationOrigin(Object.assign({}, initLocation, value));
703
- });
727
+ const targetLocation = react.useMemo(() => {
728
+ return Object.assign({}, initLocation, location);
729
+ }, [initLocation, location]);
730
+ const setTargetLocation = value => setLocation(Object.assign({}, initLocation, value));
704
731
  const pdfSignature = react.useMemo(() => {
705
732
  return Object.assign({}, computedPDFSignLocation({
706
- location,
733
+ location: targetLocation,
707
734
  size
708
735
  }), {
709
736
  signature,
@@ -713,7 +740,7 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
713
740
  pageWidth: Math.round(size.originalWidth),
714
741
  pageHeight: Math.round(size.originalHeight)
715
742
  });
716
- }, [location, signature, url, filename, size, currentPage]);
743
+ }, [targetLocation, signature, url, filename, size, currentPage]);
717
744
  const signPdf = react.useCallback(function () {
718
745
  try {
719
746
  return Promise.resolve(signPdfFile(pdfSignature));
@@ -723,7 +750,7 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
723
750
  }, [pdfSignature]);
724
751
  react.useImperativeHandle(ref, () => ({
725
752
  getLocation: () => location,
726
- setLocation: value => setLocation(value),
753
+ setLocation: value => setTargetLocation(value),
727
754
  getPdfSignature: () => pdfSignature,
728
755
  sign: () => signPdf()
729
756
  }));
@@ -734,16 +761,22 @@ const PDFSignInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
734
761
  location
735
762
  });
736
763
  }, [pdfSignature, location, handlerChange]);
737
- return /*#__PURE__*/jsxRuntime.jsx(LocationLayer, {
738
- stageWidth: size.width,
739
- stageHeight: size.height,
740
- width: width,
741
- height: height,
742
- padding: padding,
743
- placeholder: placeholder,
744
- signature: signature,
745
- value: location,
746
- onChange: setLocation
764
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
765
+ style: {
766
+ transform: "scale(" + size.width / size.originalWidth + ")",
767
+ transformOrigin: '0 0'
768
+ },
769
+ children: /*#__PURE__*/jsxRuntime.jsx(LocationLayer, {
770
+ stageWidth: size.originalWidth,
771
+ stageHeight: size.originalHeight,
772
+ width: width,
773
+ height: height,
774
+ padding: padding,
775
+ placeholder: placeholder,
776
+ signature: signature,
777
+ value: targetLocation,
778
+ onChange: setTargetLocation
779
+ })
747
780
  });
748
781
  });
749
782
  const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref2, ref) => {
@@ -759,6 +792,7 @@ const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref2, ref) => {
759
792
  onChange
760
793
  } = _ref2,
761
794
  props = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
795
+ const [location, setLocation] = react.useState(Object.assign({}, defaultLocation));
762
796
  return /*#__PURE__*/jsxRuntime.jsx(PDFViewer, _extends({}, props, {
763
797
  url: url,
764
798
  children: _ref3 => {
@@ -772,7 +806,8 @@ const PDFSign = withLocale(/*#__PURE__*/react.forwardRef((_ref2, ref) => {
772
806
  currentPage: currentPage,
773
807
  url: url,
774
808
  filename: filename,
775
- defaultLocation: defaultLocation,
809
+ location: location,
810
+ setLocation: setLocation,
776
811
  width: width,
777
812
  height: height,
778
813
  padding: padding,
@@ -4043,12 +4078,12 @@ const PDFSignMultiInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
4043
4078
  height = 80,
4044
4079
  padding,
4045
4080
  filename = 'signed-document.pdf',
4046
- defaultSignatureList,
4081
+ signatureList,
4082
+ setSignatureList,
4047
4083
  isEdit,
4048
4084
  onSign,
4049
4085
  onChange
4050
4086
  } = _ref;
4051
- const [signatureList, setSignatureList] = react.useState(defaultSignatureList || []);
4052
4087
  const {
4053
4088
  formatMessage
4054
4089
  } = reactIntl.useIntl();
@@ -4088,48 +4123,55 @@ const PDFSignMultiInner = /*#__PURE__*/react.forwardRef((_ref, ref) => {
4088
4123
  signatureList: pdfSignatureList
4089
4124
  });
4090
4125
  },
4091
- addSignLocation: () => {
4126
+ addSignLocation: page => {
4092
4127
  setSignatureList(signatureList => {
4093
4128
  return [...signatureList, Object.assign({}, getInitLocation({
4094
4129
  width,
4095
4130
  height,
4096
- stageWidth: size.width,
4097
- stageHeight: size.height
4131
+ stageWidth: size.originalWidth,
4132
+ stageHeight: size.originalHeight
4098
4133
  }), {
4099
- page: currentPage
4134
+ page: page || currentPage
4100
4135
  })];
4101
4136
  });
4102
4137
  }
4103
4138
  }));
4104
- return /*#__PURE__*/jsxRuntime.jsx(LocationGroup, {
4105
- isEdit: isEdit,
4106
- currentPage: currentPage,
4107
- stageWidth: size.width,
4108
- stageHeight: size.height,
4109
- width: width,
4110
- height: height,
4111
- padding: padding,
4112
- placeholder: placeholder,
4113
- value: signatureList,
4114
- onChange: setSignatureList,
4115
- onClick: _ref2 => {
4116
- let {
4117
- index,
4118
- value
4119
- } = _ref2;
4120
- onSign && onSign({
4121
- size: value.size,
4122
- callback: signature => {
4123
- setSignatureList(value => {
4124
- const newValue = value.slice(0);
4125
- newValue[index] = Object.assign({}, newValue[index], {
4126
- signature
4139
+ const scale = size.width / size.originalWidth;
4140
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
4141
+ style: {
4142
+ transform: "scale(" + scale + ")",
4143
+ transformOrigin: '0 0'
4144
+ },
4145
+ children: /*#__PURE__*/jsxRuntime.jsx(LocationGroup, {
4146
+ isEdit: isEdit,
4147
+ currentPage: currentPage,
4148
+ stageWidth: size.originalWidth,
4149
+ stageHeight: size.originalHeight,
4150
+ width: width,
4151
+ height: height,
4152
+ padding: padding,
4153
+ placeholder: placeholder,
4154
+ value: signatureList,
4155
+ onChange: setSignatureList,
4156
+ onClick: _ref2 => {
4157
+ let {
4158
+ index,
4159
+ value
4160
+ } = _ref2;
4161
+ onSign && onSign({
4162
+ size: value.size,
4163
+ callback: signature => {
4164
+ setSignatureList(value => {
4165
+ const newValue = value.slice(0);
4166
+ newValue[index] = Object.assign({}, newValue[index], {
4167
+ signature
4168
+ });
4169
+ return newValue;
4127
4170
  });
4128
- return newValue;
4129
- });
4130
- }
4131
- });
4132
- }
4171
+ }
4172
+ });
4173
+ }
4174
+ })
4133
4175
  });
4134
4176
  });
4135
4177
  const PDFSignMulti = withLocale(/*#__PURE__*/react.forwardRef((_ref3, ref) => {
@@ -4146,6 +4188,7 @@ const PDFSignMulti = withLocale(/*#__PURE__*/react.forwardRef((_ref3, ref) => {
4146
4188
  isEdit
4147
4189
  } = _ref3,
4148
4190
  props = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
4191
+ const [signatureList, setSignatureList] = react.useState(defaultSignatureList || []);
4149
4192
  return /*#__PURE__*/jsxRuntime.jsx(PDFViewer, _extends({}, props, {
4150
4193
  url: url,
4151
4194
  children: _ref4 => {
@@ -4159,7 +4202,8 @@ const PDFSignMulti = withLocale(/*#__PURE__*/react.forwardRef((_ref3, ref) => {
4159
4202
  currentPage: currentPage,
4160
4203
  url: url,
4161
4204
  filename: filename,
4162
- defaultSignatureList: defaultSignatureList,
4205
+ signatureList: signatureList,
4206
+ setSignatureList: setSignatureList,
4163
4207
  width: width,
4164
4208
  height: height,
4165
4209
  padding: padding,
@@ -4367,6 +4411,7 @@ exports.PDFSign = PDFSign;
4367
4411
  exports.PDFSignMulti = PDFSignMulti;
4368
4412
  exports.PDFViewer = PDFViewer;
4369
4413
  exports["default"] = PDFSign;
4414
+ exports.signMultiPdfFile = signMultiPdfFile;
4370
4415
  exports.signPdfFile = signPdfFile;
4371
4416
  exports.useSignature = useSignature;
4372
4417
  //# sourceMappingURL=index.js.map