/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { ToolbarProps } from '@progress/kendo-react-buttons'; import { SaveOptions } from '@progress/kendo-file-saver'; import { TypedArray } from '@progress/kendo-pdfviewer-common'; import * as React from 'react'; export type PDFViewerTool = 'pager' | 'spacer' | 'zoomInOut' | 'zoom' | 'selection' | 'search' | 'open' | 'download' | 'print'; interface PDFViewerEvent { /** * The event target object. */ target: PDFViewerHandle; } /** * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) ErrorEvent object. */ export interface ErrorEvent extends PDFViewerEvent { /** * The raised error. */ error: Error | { message: string; }; } /** * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) DownloadEvent object. */ export interface DownloadEvent extends PDFViewerEvent { /** * The Blob object. */ blob: Blob; /** * Sets the name for saving the file. */ fileName: string; /** * Sets the options for saving the file. */ saveOptions: SaveOptions; } /** * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) LoadEvent object. */ export interface LoadEvent extends PDFViewerEvent { } /** * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) ZoomEvent object. */ export interface ZoomEvent extends PDFViewerEvent { /** * The zoom value. */ zoom: number; /** * A React `SyntheticEvent`. */ syntheticEvent: React.SyntheticEvent; } /** * The KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) PageEvent object. */ export interface PageEvent extends PDFViewerEvent { /** * The page number. */ page: number; /** * A React `SyntheticEvent`. */ syntheticEvent: React.SyntheticEvent; } /** * The props of the KendoReact [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) component. */ export interface PDFViewerProps { /** * Sets the URL of the PDF file. * * @example * ```jsx * * ``` */ url?: string; /** * Sets the data of the PDF file in Base64 format. * * @example * ```jsx * * ``` */ data?: string; /** * Sets the raw binary data buffer of the PDF file. * * @example * ```jsx * * ``` */ arrayBuffer?: ArrayBuffer; /** * Sets the data of the PDF file in typed array format. * * @example * ```jsx * * ``` */ typedArray?: TypedArray; /** * Sets the additional styles for the PDF Viewer component. * * @example * ```jsx * * ``` */ style?: React.CSSProperties; /** * Sets the file name used to save the file when you click the download tool. * * @example * ```jsx * * ``` */ saveFileName?: string; /** * Sets the options for saving the file when you click the download tool. * * @example * ```jsx * * ``` */ saveOptions?: SaveOptions; /** * Sets the tools collection that renders in the toolbar. * * @default - ['pager', 'spacer', 'zoomInOut', 'zoom', 'selection', 'spacer', 'search', 'open', 'download', 'print'] * * @example * ```jsx * * ``` */ tools?: PDFViewerTool[]; /** * Sets the zoom levels populated in the ComboBox component. * * @example * ```jsx * * ``` */ zoomLevels?: { id: number; priority: number; value: number; text: string; type: string; locationString?: string; }[]; /** * Sets the zoom value of the document. * * @example * ```jsx * * ``` */ zoom?: number; /** * Sets the default zoom value. * * @default 1 * * @example * ```jsx * * ``` */ defaultZoom?: number; /** * Sets the minimum zoom value. * * @default 0.5 * * @example * ```jsx * * ``` */ minZoom?: number; /** * Sets the maximum zoom value. * * @default 4 * * @example * ```jsx * * ``` */ maxZoom?: number; /** * Sets the zoom rate value. * * @default 0.25 * * @example * ```jsx * * ``` */ zoomRate?: number; /** * Fires when an error occurs. * * @example * ```jsx * console.log(event.error)} /> * ``` */ onError?: (event: ErrorEvent) => void; /** * Fires when a PDF document has been loaded. * * @example * ```jsx * console.log('Document loaded')} /> * ``` */ onLoad?: (event: LoadEvent) => void; /** * Fires when the download tool has been clicked. To prevent the download, return `false`. * * @example * ```jsx * console.log(event.fileName)} /> * ``` */ onDownload?: (event: DownloadEvent) => boolean | void; /** * Fires when the zoom has changed. * * @example * ```jsx * console.log(event.zoom)} /> * ``` */ onZoom?: (event: ZoomEvent) => void; /** * Fires when the page has changed. * * @example * ```jsx * console.log(event.page)} /> * ``` */ onPageChange?: (event: PageEvent) => void; /** * Fires when the toolbar component is about to be rendered. Use it to override the default appearance of the toolbar. * * @example * ```jsx * } /> * ``` */ onRenderToolbar?: (defaultRendering: React.ReactElement) => React.ReactNode; /** * Fires when the content component is about to be rendered. Use it to override the default appearance of the content. * * @example * ```jsx * } /> * ``` */ onRenderContent?: (defaultRendering: React.ReactElement) => React.ReactNode; /** * Fires when the loading indication component is about to be rendered. Use it to override the default appearance of the loading. * * @example * ```jsx * } /> * ``` */ onRenderLoader?: (defaultRendering: React.ReactElement | null) => React.ReactNode; } /** * Represents the object which is passed to the [`ref`](https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom) * callback of the [PDF Viewer](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewer) component. */ export interface PDFViewerHandle { /** * The root DOM element of the PDF Viewer component. */ element: HTMLDivElement | null; /** * The props of the PDF Viewer component. */ props: PDFViewerProps; /** * The `PDF.js` document loaded in the PDF Viewer component. */ document: any; /** * The `PDF.js` pages loaded in the PDF Viewer component. */ pages: any[]; } /** * Represents the [KendoReact PDF Viewer component](https://www.telerik.com/kendo-react-ui/components/pdf-viewer/api/pdfviewerprops). * * @example * ```jsx * function App() { * return ; * } * ``` */ export declare const PDFViewer: React.ForwardRefExoticComponent>; export {};