react-pdf-editor-1 1.2.36

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 (133) hide show
  1. package/.babelrc +3 -0
  2. package/LICENSE +2 -0
  3. package/README.md +315 -0
  4. package/dist/index.js +526 -0
  5. package/package.json +33 -0
  6. package/public/01fd34b01abf8d0a1fdb3c10f95146cd.svg +7 -0
  7. package/public/025954f8cad47e40240e15487d1e396c.svg +17 -0
  8. package/public/105d10237b3dddb56304b2af06fab51c.svg +8 -0
  9. package/public/10879587954149cc5fd694c7785e9d3a.svg +8 -0
  10. package/public/15cba32d3c729060a92912d969d1cc2c.svg +17 -0
  11. package/public/1964539986cd6aea3baee0f32a61923e.svg +4 -0
  12. package/public/1c0b882b730b22fbd7d42b68bd0a970e.svg +2 -0
  13. package/public/1d66d40875fa58261ff4b850e8cba7cc.svg +5 -0
  14. package/public/22b31630cb8b4b2ad58da61bb133ab1f.svg +8 -0
  15. package/public/2d62d3d287fbc3c497dddab32168f325.svg +4 -0
  16. package/public/31f31a1074e7f19fde072c1158a8e6a0.svg +14 -0
  17. package/public/3659a716673b2dd214d961c5feb3caa6.svg +4 -0
  18. package/public/3bc689e0aff9db355266a7b3be92e9d0.svg +4 -0
  19. package/public/3eb1d80899f968c9398d1c08a5350b2d.svg +4 -0
  20. package/public/4c63cae958b5685dfd85cda1b06787fe.svg +17 -0
  21. package/public/50842dfca45fc95070e4fdd2259db45c.svg +4 -0
  22. package/public/536890911d2db783d87b77a39b74f396.svg +4 -0
  23. package/public/71edf29951e1e0d3b50d9562bc7a5049.svg +14 -0
  24. package/public/79ee5b45e590be841daeba9d60e7db6e.svg +5 -0
  25. package/public/839d642763fa2703bfa92fcdbaa0397c.svg +17 -0
  26. package/public/8639ab06d026e5d60849b007b6f432b6.svg +14 -0
  27. package/public/9209f692646c3a0d4fb372037a3d7237.svg +4 -0
  28. package/public/96ba4601cfdb560093692ac2d34260dd.svg +8 -0
  29. package/public/9c36754c195ca83d24a39e75ef3821c0.svg +4 -0
  30. package/public/9f41f6f39d1736d2782a934fea979c01.svg +4 -0
  31. package/public/a24af8321bcb23961c196b0b4fce89c7.svg +17 -0
  32. package/public/a3f2a45a2d94e515bc17ea9740631aa0.svg +6 -0
  33. package/public/a51521eadbd56edc63eb19bc5a41a598.svg +5 -0
  34. package/public/a7a14359ef6035eb03282f98500c02f3.svg +17 -0
  35. package/public/b4d7375b688647fc2e477f9d911f1e2e.svg +17 -0
  36. package/public/b947e1da1eac39e0ff7f9b7c1f944f52.svg +17 -0
  37. package/public/bundle.js +2 -0
  38. package/public/bundle.js.LICENSE.txt +32 -0
  39. package/public/c0ab9ce68d42392fb8fc13f7089c9518.svg +5 -0
  40. package/public/c69a80a1cc748b27d5ee83d3951bc956.svg +4 -0
  41. package/public/c6ac6e95ae6fe2f0391da8fa2e9c8554.svg +14 -0
  42. package/public/d538166f1033a89b5d2735aecea91c62.svg +5 -0
  43. package/public/d84737c082efeea55189a8196ac9236c.svg +17 -0
  44. package/public/e19e4765f223f61db42d28f92ddbcd4e.svg +5 -0
  45. package/public/e80893668bffe9e8e3c09306c073cf30.svg +2 -0
  46. package/public/eb7981a1b3a89b6cfce8722d72214fde.svg +17 -0
  47. package/public/eccb83ba375a1929a3f18ba30694c231.svg +5 -0
  48. package/public/ee12777ac448b2018f768c80fb248e9c.svg +4 -0
  49. package/public/f646afcaa121a7b8d388826e30f410c1.svg +4 -0
  50. package/public/ff2dfa442d903d9d5e30.gif +0 -0
  51. package/public/index.html +1 -0
  52. package/public/pdf-ui/033ea05cff39966fc00030593f62d81f.svg +5 -0
  53. package/public/pdf-ui/0353d3a6acc37ec6b16e6bf353926342.svg +15 -0
  54. package/public/pdf-ui/045352e9aa7d98994484ffb8ec3dbe38.svg +4 -0
  55. package/public/pdf-ui/067c6de2adec31f57b18.gif +1 -0
  56. package/public/pdf-ui/088c54c203716cb1be7190bb6075efb6.png +0 -0
  57. package/public/pdf-ui/0d18d81ca415c6007655b836f84e4219.svg +8 -0
  58. package/public/pdf-ui/15cba32d3c729060a92912d969d1cc2c.svg +17 -0
  59. package/public/pdf-ui/1c0b882b730b22fbd7d42b68bd0a970e.svg +2 -0
  60. package/public/pdf-ui/1c5917d73900d5039cd8.gif +1 -0
  61. package/public/pdf-ui/1d66d40875fa58261ff4b850e8cba7cc.svg +5 -0
  62. package/public/pdf-ui/1ec9099f99fb29fd2f6862878724a0a3.svg +5 -0
  63. package/public/pdf-ui/22b31630cb8b4b2ad58da61bb133ab1f.svg +8 -0
  64. package/public/pdf-ui/2a087ab7d6db0961c9a3.gif +1 -0
  65. package/public/pdf-ui/2c98033a3b632f65d3ec.wasm +0 -0
  66. package/public/pdf-ui/2d857cb345dc7c8dbece3d62a20f09bd.svg +5 -0
  67. package/public/pdf-ui/325f20a2786a21caee0f924078e07d71.svg +2 -0
  68. package/public/pdf-ui/35d6b608bc295d96f7fd45b93b27706c.svg +8 -0
  69. package/public/pdf-ui/3659a716673b2dd214d961c5feb3caa6.svg +4 -0
  70. package/public/pdf-ui/3bc689e0aff9db355266a7b3be92e9d0.svg +4 -0
  71. package/public/pdf-ui/3e8dbb8345f70b7b4c36bb1ad05dfe7e.svg +4 -0
  72. package/public/pdf-ui/3eb1d80899f968c9398d1c08a5350b2d.svg +4 -0
  73. package/public/pdf-ui/4ab3dd8677ef3699fc53c7328a3ae1c6.svg +2 -0
  74. package/public/pdf-ui/4c63cae958b5685dfd85cda1b06787fe.svg +17 -0
  75. package/public/pdf-ui/4dc3c7d029346b6ca3318f0e60ccfe87.svg +4 -0
  76. package/public/pdf-ui/4e9b9c2bcbd6c3737c340cd5bebefd8c.svg +6 -0
  77. package/public/pdf-ui/4ebd2633a2d5debf8a4e568b7985be7e.svg +4 -0
  78. package/public/pdf-ui/50842dfca45fc95070e4fdd2259db45c.svg +4 -0
  79. package/public/pdf-ui/5087ceef6868b5ab32a1.svg +1 -0
  80. package/public/pdf-ui/536890911d2db783d87b77a39b74f396.svg +4 -0
  81. package/public/pdf-ui/53f17281bc4dffa3a650442bfb07d321.svg +4 -0
  82. package/public/pdf-ui/586876b8baad663cfcb1.svg +1 -0
  83. package/public/pdf-ui/59fe962b3e6bd8bfdda7a104ebfba9e9.svg +3 -0
  84. package/public/pdf-ui/5a84e180ec596169981c831f0288374a.svg +19 -0
  85. package/public/pdf-ui/5e9941f27dabbef172bdaf2deccb70f6.svg +11 -0
  86. package/public/pdf-ui/5ea0869845becef03a065090fee2a9a5.svg +4 -0
  87. package/public/pdf-ui/6529e96a9906058150e3de021602f1d9.svg +4 -0
  88. package/public/pdf-ui/65c76ef6e36e34a13364a8127e57b18e.svg +4 -0
  89. package/public/pdf-ui/79edeed2414d6ac5ec44.svg +1 -0
  90. package/public/pdf-ui/79ee5b45e590be841daeba9d60e7db6e.svg +5 -0
  91. package/public/pdf-ui/80a30e134dde30c967de.svg +1 -0
  92. package/public/pdf-ui/854c025f76bbfdf1a6c3db5a8db6abb4.svg +11 -0
  93. package/public/pdf-ui/8be7b158d340ed4fd589.svg +1 -0
  94. package/public/pdf-ui/8d64a1271d5126b8cb78.svg +1 -0
  95. package/public/pdf-ui/9c36754c195ca83d24a39e75ef3821c0.svg +4 -0
  96. package/public/pdf-ui/9fb032a1799ca2a1c7518895c7533af2.svg +3 -0
  97. package/public/pdf-ui/a64081b14b23b34ed10bb1183be53747.png +0 -0
  98. package/public/pdf-ui/ac0f6afbea0be2b67f8b2dc2f40fdf4b.svg +4 -0
  99. package/public/pdf-ui/assets/blue-bg-5-2.png +0 -0
  100. package/public/pdf-ui/assets/blue-bg-500-150.png +0 -0
  101. package/public/pdf-ui/assets/color-wheel.png +0 -0
  102. package/public/pdf-ui/assets/signature-bg.png +0 -0
  103. package/public/pdf-ui/assets/signature-icon.png +0 -0
  104. package/public/pdf-ui/assets/yellow-bg-5-4.png +0 -0
  105. package/public/pdf-ui/assets/yellow-bg-500-150.png +0 -0
  106. package/public/pdf-ui/b1db19c0847c6c911193d6b9b48ae9df.svg +2 -0
  107. package/public/pdf-ui/b722fb1fa619a347bb3fe0e24b0c40cc.png +0 -0
  108. package/public/pdf-ui/bb72d81b39be40898db21e81272dbf39.svg +3 -0
  109. package/public/pdf-ui/bundle.js +3 -0
  110. package/public/pdf-ui/bundle.js.LICENSE.txt +74 -0
  111. package/public/pdf-ui/bundle.js.map +1 -0
  112. package/public/pdf-ui/c69a80a1cc748b27d5ee83d3951bc956.svg +4 -0
  113. package/public/pdf-ui/c6a3cd10a29122c87d0aff12229e1539.svg +4 -0
  114. package/public/pdf-ui/c6ac6e95ae6fe2f0391da8fa2e9c8554.svg +14 -0
  115. package/public/pdf-ui/c85c0ff9534eda6ec97b1f5c7c80d994.svg +4 -0
  116. package/public/pdf-ui/ccb5b2b4f2a6efbac0194acb7dd27875.svg +4 -0
  117. package/public/pdf-ui/d4a0946ca523e1a07119c30351cdc625.svg +8 -0
  118. package/public/pdf-ui/de62f36b83bb7ae79e7f4499387ee87e.svg +4 -0
  119. package/public/pdf-ui/e19e4765f223f61db42d28f92ddbcd4e.svg +5 -0
  120. package/public/pdf-ui/e80893668bffe9e8e3c09306c073cf30.svg +2 -0
  121. package/public/pdf-ui/f20333b6d7b1530454d1ea949f337c4d.svg +5 -0
  122. package/public/pdf-ui/f8f9feb56bfaf57527c21e854ad43533.svg +5 -0
  123. package/public/pdf-ui/ff2dfa442d903d9d5e30.gif +0 -0
  124. package/public/pdf-ui/ff2dfa442d903d9d5e303345b82e5415.gif +0 -0
  125. package/public/pdf-ui/index.html +1 -0
  126. package/public/pdf-ui/lib/pdf.worker.js +2 -0
  127. package/public/pdf-ui/lib/pdf.worker.js.LICENSE.txt +21 -0
  128. package/public/pdf-ui/lib/pdf_wasm_project.js +1 -0
  129. package/public/pdf-ui/lib/pdf_wasm_project_bg.wasm +0 -0
  130. package/public/pdf-ui/node_modules/alien35-pf/web/images/loading-icon.gif +0 -0
  131. package/public/pdf-ui/node_modules/pdfjs-dist/web/images/loading-icon.gif +0 -0
  132. package/src/index.d.ts +33 -0
  133. package/src/index.js +374 -0
package/.babelrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-react"]
3
+ }
package/LICENSE ADDED
@@ -0,0 +1,2 @@
1
+ Copyright 2023 Digital Mountain Group LLC. All rights reserved.
2
+ react-pdf-editor project/codebase or any derived works is only permitted in solutions with an active commercial ProdFox WebViewer license. For exact licensing terms please refer to your commercial WebViewer license. For use in other scenario, please contact alex@prodfox.com
package/README.md ADDED
@@ -0,0 +1,315 @@
1
+ # React PDF Editor
2
+
3
+ View, edit, and Chat-with-your-PDF with AI.
4
+
5
+ Add View to your app for free. Learn pricing for all features [here](https://www.signeasynow.com/upgrade)
6
+
7
+ ![Visual of app](https://media.discordapp.net/attachments/1065627273618800732/1161792368152956938/Feature_rich_React_component_for_viewing_editing_and_more.png?ex=65399675&is=65272175&hm=3ccb739e31aa1b1604b9e566a9556d8431c5ed3944df3bdb065f83317aec768d&=&width=1884&height=942)
8
+
9
+ # Demo
10
+
11
+ https://www.signeasynow.com/edit-your-pdf
12
+
13
+ Want to see the source code for the above demo? Find it [here](https://github.com/signeasynow/react-pdf-demo).
14
+
15
+ # Quick start
16
+
17
+ 1. Copy-paste the `pdf-ui` folder [here](https://github.com/signeasynow/react-pdf-demo/tree/main/public/pdf-ui) into your own `public` folder.
18
+
19
+ 1. Install
20
+
21
+ `npm install --save @prodfox/react-pdf-editor`
22
+
23
+ or
24
+
25
+ `yarn add @prodfox/react-pdf-editor`
26
+
27
+ 3. Create a component
28
+ ```
29
+ import { useRef } from 'react';
30
+ import { useCreateIframeAndLoadViewer } from "@prodfox/react-pdf-editor";
31
+
32
+ function App() {
33
+ const containerRef = useRef(null);
34
+
35
+ const { download } = useCreateIframeAndLoadViewer({
36
+ container: containerRef,
37
+ licenseKey: "sandbox",
38
+ locale: "en",
39
+ tools: {
40
+ editing: [
41
+ "extract",
42
+ "remove",
43
+ "move"
44
+ ],
45
+ thumbnails: [
46
+ "zoom",
47
+ "expand"
48
+ ],
49
+ general: [
50
+ "thumbnails",
51
+ "download",
52
+ "search",
53
+ "panel-toggle",
54
+ "zoom"
55
+ ],
56
+ },
57
+ files: [
58
+ {
59
+ url: "https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf",
60
+ name: "my-file1.pdf"
61
+ },
62
+ {
63
+ url: "https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf",
64
+ name: "my-file2.pdf"
65
+ }
66
+ ],
67
+ });
68
+
69
+
70
+ return (
71
+ <div>
72
+ <button onClick={download}>Download</button>
73
+ <div className="container" id="pdf" ref={containerRef}>
74
+ </div>
75
+ </div>
76
+ );
77
+ }
78
+
79
+ export default App;
80
+ ```
81
+
82
+ ## Core
83
+
84
+ ## Parameters
85
+
86
+ ### container `Required`
87
+
88
+ The HTML element to attach the PDF viewer to.
89
+
90
+ ### tools `Object` `{}`
91
+
92
+ Control what tools are available in the UI. Available keys are `thumbnails`, `general`, `editing`, ...
93
+
94
+ ```
95
+ useCreateIframeAndLoadViewer({
96
+ tools: {
97
+ thumbnails: ...,
98
+ general: ...,
99
+ editing: ...,
100
+ },
101
+ ...other parameters
102
+ });
103
+ ```
104
+
105
+ #### general `Object` `[]`
106
+
107
+ | Field | Description |
108
+ | ------- | ---------------- |
109
+ | zoom | Enable zoom in/out of the document in view |
110
+ | search | Enable search functions |
111
+ | download | Enable downloading the document |
112
+ | thumbnails | Enable a thumbnails panel |
113
+ | panel-toggle | Enable the left-side panel to be togglable |
114
+ | chat | Enable AI conversations with your PDF (user ID is required after 10 questions) |
115
+
116
+ ```
117
+ useCreateIframeAndLoadViewer({
118
+ tools: {
119
+ general: [
120
+ "zoom",
121
+ "search",
122
+ "download",
123
+ "thumbnails",
124
+ "panel-toggle"
125
+ ],
126
+ },
127
+ ...other parameters
128
+ });
129
+ ```
130
+
131
+ #### thumbnails `Object` `[]`
132
+
133
+ | Field | Description |
134
+ | ------- | ---------------- |
135
+ | zoom | Enable a slider above thumbnails to increase/decrease the size of the thumbnails |
136
+ | expand | Enable the thumbnails bar to be expandable to the full screen |
137
+
138
+
139
+ ```
140
+ useCreateIframeAndLoadViewer({
141
+ tools: {
142
+ thumbnails: [
143
+ "zoom",
144
+ "expand"
145
+ ],
146
+ },
147
+ ...other parameters
148
+ });
149
+ ```
150
+
151
+ #### editing `Object` `[]`
152
+
153
+ | Field | Description |
154
+ | ------- | ---------------- |
155
+ | remove | Enable the ability to remove pages |
156
+ | rotation | Enable the rotation of individual pages |
157
+ | extraction | Enabling extracting out a set of pages into one document |
158
+ | move | Re-arrange pages in a document |
159
+
160
+ ```
161
+ useCreateIframeAndLoadViewer({
162
+ tools: {
163
+ editing: [
164
+ "remove",
165
+ "rotation",
166
+ "extraction",
167
+ "move"
168
+ ],
169
+ },
170
+ ...other parameters
171
+ });
172
+ ```
173
+
174
+ #### locale `string` `en` `Optional`
175
+
176
+ Options:
177
+
178
+ `en` - English
179
+
180
+ `es` - Spanish
181
+
182
+ `ru` - Russian
183
+
184
+ (Reach out if you need a particular language added)
185
+
186
+ #### onFileFailed `Function` `optional`
187
+
188
+ Callback when a file fails to upload
189
+
190
+ ```
191
+ useCreateIframeAndLoadViewer({
192
+ onFileFailed: (errorMessage) => {
193
+ // handle the failure as you need
194
+ }
195
+ });
196
+ ```
197
+
198
+ #### mode `string` `optional`
199
+
200
+ Defaults to `regular`. Set it to `split` to enable being able to select split markers to be then used for splitting a document into several documents.
201
+
202
+ # Functions
203
+
204
+ Combine several files into one
205
+
206
+ ```
207
+ const { combineFiles } = useCreateIframeAndLoadViewer({
208
+ ...
209
+ });
210
+
211
+ combineFiles();
212
+
213
+ ```
214
+
215
+ Listen for when the pages are loaded for the active document
216
+
217
+ ```
218
+ const { pagesLoaded } = useCreateIframeAndLoadViewer({
219
+ ...
220
+ });
221
+
222
+ if (pagesLoaded) {
223
+ // logic here
224
+ }
225
+ ```
226
+
227
+ Download
228
+
229
+ ```
230
+ const { download } = useCreateIframeAndLoadViewer({
231
+ ...
232
+ });
233
+
234
+ download();
235
+ ```
236
+
237
+ Listen for when the PDF editor is ready to accept commands
238
+
239
+ ```
240
+ const { isReady } = useCreateIframeAndLoadViewer({
241
+ ...
242
+ });
243
+
244
+ if (isReady) {
245
+ // logic here
246
+ }
247
+ ```
248
+
249
+ Toggle displaying the full screen thumbnail view
250
+
251
+ ```
252
+ const { toggleFullScreenThumbnails } = useCreateIframeAndLoadViewer({
253
+ ...
254
+ });
255
+
256
+ toggleFullScreenThumbnails(true) // set this to true or false to open/close it.
257
+ ```
258
+
259
+ Control the thumbnail zoom level. Ranges from 0 to 1.
260
+
261
+ ```
262
+ const { setThumbnailZoom } = useCreateIframeAndLoadViewer({
263
+ ...
264
+ });
265
+
266
+ setThumbnailZoom(0.5)
267
+ ```
268
+
269
+ Toggle displaying the search bar on the right
270
+
271
+ ```
272
+ const { toggleSearchbar } = useCreateIframeAndLoadViewer({
273
+ ...
274
+ });
275
+
276
+ toggleSearchbar(true) // set this to true or false to open/close it.
277
+ ```
278
+
279
+ Delete the AI conversation chat history
280
+
281
+ ```
282
+ const { removeChatHistory } = useCreateIframeAndLoadViewer({
283
+ ...
284
+ });
285
+
286
+ removeChatHistory()
287
+ ```
288
+
289
+ Get the 0-indexed array of selected pages
290
+
291
+ ```
292
+ const { selectedPages } = useCreateIframeAndLoadViewer({
293
+ ...
294
+ });
295
+ ```
296
+
297
+ Extract the selected pages
298
+
299
+ ```
300
+ const { extractPages } = useCreateIframeAndLoadViewer({
301
+ ...
302
+ });
303
+
304
+ extractPages()
305
+ ```
306
+
307
+ Split the document into several documents based on the split markers the user selected.
308
+
309
+ ```
310
+ const { splitPages } = useCreateIframeAndLoadViewer({
311
+ ...
312
+ });
313
+
314
+ splitPages()
315
+ ```