UNPKG

@vue-pdf-viewer/viewer

Version:

The PDF Viewer component for Vue 3 and Nuxt

29 lines (28 loc) 1.74 kB
import type { MaybeRef } from 'vue'; import type { PDFDestination, PDFOptions, PDFSrc } from '../utils/types'; import type { PDFDocumentProxy, PDFPageProxy } from 'pdfjs-dist/types/src/display/api'; /** * @typedef {Object} UsePDFParameters * @property {string} password * Document password to unlock content * @property {function} onProgress * Callback to request a password if a wrong or no password was provided. The callback receives two parameters: a function that should be called with the new password, and a reason (see PasswordResponses). * @property {function} onPassword * Callback to be able to monitor the loading progress of the PDF file (necessary to implement e.g. a loading bar). The callback receives an OnProgressParameters argument. if this function is used option.password is ignored * @property {function} onError * Callback to be able to handle errors during loading * */ /** * * @param {string | URL | TypedArray | PDFDataRangeTransport | DocumentInitParameters} src * Can be a URL where a PDF file is located, a typed array (Uint8Array) already populated with data, or a parameter object. * @param {UsePDFParameters} options * UsePDF object parameters */ declare function usePdf(src: MaybeRef<PDFSrc>, options?: PDFOptions, workerUrl?: string): { pdf: import("vue").ShallowRef<import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined, import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined>; totalPages: import("vue").ShallowRef<number, number>; getPage: (doc: PDFDocumentProxy, pageIndex: number) => Promise<PDFPageProxy>; getPDFDestination: (destination: string | any[] | null) => Promise<PDFDestination | null>; }; export default usePdf;