@progress/kendo-react-pdf-viewer 13.3.0 → 13.4.0-develop.2

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/index.d.mts CHANGED
@@ -5,370 +5,32 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { currentPage } from '@progress/kendo-pdfviewer-common';
9
- import * as React_2 from 'react';
10
- import { SaveOptions } from '@progress/kendo-file-saver';
11
- import { ToolbarProps } from '@progress/kendo-react-buttons';
12
- import { TypedArray } from '@progress/kendo-pdfviewer-common';
13
-
14
- export { currentPage }
15
-
16
- /**
17
- * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) DownloadEvent object.
18
- */
19
- export declare interface DownloadEvent extends PDFViewerEvent {
20
- /**
21
- * The Blob object.
22
- */
23
- blob: Blob;
24
- /**
25
- * Sets the name for saving the file.
26
- */
27
- fileName: string;
28
- /**
29
- * Sets the options for saving the file.
30
- */
31
- saveOptions: SaveOptions;
32
- }
33
-
34
- /**
35
- * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) ErrorEvent object.
36
- */
37
- declare interface ErrorEvent_2 extends PDFViewerEvent {
38
- /**
39
- * The raised error.
40
- */
41
- error: Error | {
42
- message: string;
43
- };
44
- }
45
- export { ErrorEvent_2 as ErrorEvent }
46
-
47
- /**
48
- * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) LoadEvent object.
49
- */
50
- export declare interface LoadEvent extends PDFViewerEvent {
51
- }
52
-
53
- /**
54
- * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) PageEvent object.
55
- */
56
- export declare interface PageEvent extends PDFViewerEvent {
57
- /**
58
- * The page number.
59
- */
60
- page: number;
61
- /**
62
- * A React `SyntheticEvent`.
63
- */
64
- syntheticEvent: React_2.SyntheticEvent<any>;
65
- }
66
-
67
- /**
68
- * Represents the [KendoReact PDF Viewer component](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewerprops).
69
- *
70
- * @example
71
- * ```jsx
72
- * function App() {
73
- * return <PDFViewer url="sample.pdf" />;
74
- * }
75
- * ```
76
- */
77
- export declare const PDFViewer: React_2.ForwardRefExoticComponent<PDFViewerProps & React_2.RefAttributes<PDFViewerHandle | null>>;
78
-
79
- declare interface PDFViewerEvent {
80
- /**
81
- * The event target object.
82
- */
83
- target: PDFViewerHandle;
84
- }
85
-
86
- /**
87
- * Represents the object which is passed to the [`ref`](https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom)
88
- * callback of the [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) component.
89
- */
90
- export declare interface PDFViewerHandle {
91
- /**
92
- * The root DOM element of the PDF Viewer component.
93
- */
94
- element: HTMLDivElement | null;
95
- /**
96
- * The props of the PDF Viewer component.
97
- */
98
- props: PDFViewerProps;
99
- /**
100
- * The `PDF.js` document loaded in the PDF Viewer component.
101
- */
102
- document: any;
103
- /**
104
- * The `PDF.js` pages loaded in the PDF Viewer component.
105
- */
106
- pages: any[];
107
- }
108
-
109
- /**
110
- * The props of the KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) component.
111
- */
112
- export declare interface PDFViewerProps {
113
- /**
114
- * Sets the URL of the PDF file.
115
- *
116
- * @example
117
- * ```jsx
118
- * <PDFViewer url="https://example.com/sample.pdf" />
119
- * ```
120
- */
121
- url?: string;
122
- /**
123
- * Sets the data of the PDF file in Base64 format.
124
- *
125
- * @example
126
- * ```jsx
127
- * <PDFViewer data="JVBERi0xLjQKJ..." />
128
- * ```
129
- */
130
- data?: string;
131
- /**
132
- * Sets the raw binary data buffer of the PDF file.
133
- *
134
- * @example
135
- * ```jsx
136
- * <PDFViewer arrayBuffer={new ArrayBuffer(1024)} />
137
- * ```
138
- */
139
- arrayBuffer?: ArrayBuffer;
140
- /**
141
- * Sets the data of the PDF file in typed array format.
142
- *
143
- * @example
144
- * ```jsx
145
- * <PDFViewer typedArray={new Uint8Array([0x25, 0x50, 0x44, 0x46])} />
146
- * ```
147
- */
148
- typedArray?: TypedArray;
149
- /**
150
- * Sets the additional styles for the PDF Viewer component.
151
- *
152
- * @example
153
- * ```jsx
154
- * <PDFViewer style={{ height: '500px' }} />
155
- * ```
156
- */
157
- style?: React_2.CSSProperties;
158
- /**
159
- * Sets the file name used to save the file when you click the download tool.
160
- *
161
- * @example
162
- * ```jsx
163
- * <PDFViewer saveFileName="document.pdf" />
164
- * ```
165
- */
166
- saveFileName?: string;
167
- /**
168
- * Sets the options for saving the file when you click the download tool.
169
- *
170
- * @example
171
- * ```jsx
172
- * <PDFViewer saveOptions={{ forceProxy: true }} />
173
- * ```
174
- */
175
- saveOptions?: SaveOptions;
176
- /**
177
- * Sets the tools collection that renders in the toolbar.
178
- *
179
- * @default - ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print']
180
- *
181
- * @example
182
- * ```jsx
183
- * <PDFViewer tools={['pager', 'zoom']} />
184
- * ```
185
- */
186
- tools?: PDFViewerTool[];
187
- /**
188
- * Sets the zoom levels populated in the ComboBox component.
189
- *
190
- * @example
191
- * ```jsx
192
- * <PDFViewer zoomLevels={[{ id: 1, value: 1, text: '100%' }]} />
193
- * ```
194
- */
195
- zoomLevels?: {
196
- id: number;
197
- priority: number;
198
- value: number;
199
- text: string;
200
- type: string;
201
- locationString?: string;
202
- }[];
203
- /**
204
- * Sets the zoom value of the document.
205
- *
206
- * @example
207
- * ```jsx
208
- * <PDFViewer zoom={1.5} />
209
- * ```
210
- */
211
- zoom?: number;
212
- /**
213
- * Sets the default zoom value.
214
- *
215
- * @default 1
216
- *
217
- * @example
218
- * ```jsx
219
- * <PDFViewer defaultZoom={1} />
220
- * ```
221
- */
222
- defaultZoom?: number;
223
- /**
224
- * Sets the minimum zoom value.
225
- *
226
- * @default 0.5
227
- *
228
- * @example
229
- * ```jsx
230
- * <PDFViewer minZoom={0.5} />
231
- * ```
232
- */
233
- minZoom?: number;
234
- /**
235
- * Sets the maximum zoom value.
236
- *
237
- * @default 4
238
- *
239
- * @example
240
- * ```jsx
241
- * <PDFViewer maxZoom={4} />
242
- * ```
243
- */
244
- maxZoom?: number;
245
- /**
246
- * Sets the zoom rate value.
247
- *
248
- * @default 0.25
249
- *
250
- * @example
251
- * ```jsx
252
- * <PDFViewer zoomRate={0.25} />
253
- * ```
254
- */
255
- zoomRate?: number;
256
- /**
257
- * Fires when an error occurs.
258
- *
259
- * @example
260
- * ```jsx
261
- * <PDFViewer onError={(event) => console.log(event.error)} />
262
- * ```
263
- */
264
- onError?: (event: ErrorEvent_2) => void;
265
- /**
266
- * Fires when a PDF document has been loaded.
267
- *
268
- * @example
269
- * ```jsx
270
- * <PDFViewer onLoad={() => console.log('Document loaded')} />
271
- * ```
272
- */
273
- onLoad?: (event: LoadEvent) => void;
274
- /**
275
- * Fires when the download tool has been clicked. To prevent the download, return `false`.
276
- *
277
- * @example
278
- * ```jsx
279
- * <PDFViewer onDownload={(event) => console.log(event.fileName)} />
280
- * ```
281
- */
282
- onDownload?: (event: DownloadEvent) => boolean | void;
283
- /**
284
- * Fires when the zoom has changed.
285
- *
286
- * @example
287
- * ```jsx
288
- * <PDFViewer onZoom={(event) => console.log(event.zoom)} />
289
- * ```
290
- */
291
- onZoom?: (event: ZoomEvent) => void;
292
- /**
293
- * Fires when the page has changed.
294
- *
295
- * @example
296
- * ```jsx
297
- * <PDFViewer onPageChange={(event) => console.log(event.page)} />
298
- * ```
299
- */
300
- onPageChange?: (event: PageEvent) => void;
301
- /**
302
- * Fires when the toolbar component is about to be rendered. Use it to override the default appearance of the toolbar.
303
- *
304
- * @example
305
- * ```jsx
306
- * <PDFViewer onRenderToolbar={(defaultRendering) => <CustomToolbar />} />
307
- * ```
308
- */
309
- onRenderToolbar?: (defaultRendering: React_2.ReactElement<ToolbarProps>) => React_2.ReactNode;
310
- /**
311
- * Fires when the content component is about to be rendered. Use it to override the default appearance of the content.
312
- *
313
- * @example
314
- * ```jsx
315
- * <PDFViewer onRenderContent={(defaultRendering) => <CustomContent />} />
316
- * ```
317
- */
318
- onRenderContent?: (defaultRendering: React_2.ReactElement<HTMLDivElement>) => React_2.ReactNode;
319
- /**
320
- * Fires when the loading indication component is about to be rendered. Use it to override the default appearance of the loading.
321
- *
322
- * @example
323
- * ```jsx
324
- * <PDFViewer onRenderLoader={(defaultRendering) => <CustomLoader />} />
325
- * ```
326
- */
327
- onRenderLoader?: (defaultRendering: React_2.ReactElement<HTMLDivElement> | null) => React_2.ReactNode;
328
- }
329
-
330
- export declare type PDFViewerTool = 'pager' | 'spacer' | 'zoomInOut' | 'zoom' | 'selection' | 'search' | 'open' | 'download' | 'print';
331
-
332
- /**
333
- * Scrolls the PDF Viewer document to the passed page number.
334
- *
335
- * @param rootElement The root HTML element of the PDF Viewer component.
336
- * @param pageNumber The page number.
337
- *
338
- * @example
339
- * ```jsx
340
- * function App() {
341
- * const pdfRef = React.useRef(null);
342
- * const handleClick = () => {
343
- * scrollToPage(pdfRef.current.element, 3);
344
- * };
345
- * return (
346
- * <div>
347
- * <Button onClick={handleClick} >
348
- * Scroll to Page 3
349
- * </Button>
350
- * <PDFViewer
351
- * ref={pdfRef}
352
- * />
353
- * </div>
354
- * )
355
- * }
356
- * ```
357
- */
358
- export declare const scrollToPage: (rootElement: HTMLElement, pageNumber: number) => void;
359
-
360
- /**
361
- * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) ZoomEvent object.
362
- */
363
- export declare interface ZoomEvent extends PDFViewerEvent {
364
- /**
365
- * The zoom value.
366
- */
367
- zoom: number;
368
- /**
369
- * A React `SyntheticEvent`.
370
- */
371
- syntheticEvent: React_2.SyntheticEvent<any>;
372
- }
373
-
374
- export { }
8
+ export { PDFViewer, type PDFViewerProps, type PDFViewerHandle, type PDFViewerTool, type LoadEvent, type ErrorEvent, type DownloadEvent, type ZoomEvent, type PageEvent } from './PDFViewer.js';
9
+ export { currentPage } from '@progress/kendo-pdfviewer-common';
10
+ /**
11
+ * Scrolls the PDF Viewer document to the passed page number.
12
+ *
13
+ * @param rootElement The root HTML element of the PDF Viewer component.
14
+ * @param pageNumber The page number.
15
+ *
16
+ * @example
17
+ * ```jsx
18
+ * function App() {
19
+ * const pdfRef = React.useRef(null);
20
+ * const handleClick = () => {
21
+ * scrollToPage(pdfRef.current.element, 3);
22
+ * };
23
+ * return (
24
+ * <div>
25
+ * <Button onClick={handleClick} >
26
+ * Scroll to Page 3
27
+ * </Button>
28
+ * <PDFViewer
29
+ * ref={pdfRef}
30
+ * />
31
+ * </div>
32
+ * )
33
+ * }
34
+ * ```
35
+ */
36
+ export declare const scrollToPage: (rootElement: HTMLElement, pageNumber: number) => void;