UNPKG

@vue-pdf-viewer/viewer

Version:

A vue-pdf-viewer component for Vue and Nuxt. Suitable for vue-pdf document.

27 lines (26 loc) 1.65 kB
import type { MaybeRef } from 'vue'; import type { PDFOptions, PDFSrc, PDFDocumentOptions } from '../utils/types'; import { type PDFDocumentProxy, type 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, documentOptions?: PDFDocumentOptions): { pdfDocLoadingTask: import("vue").ShallowRef<import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined, import("pdfjs-dist/types/src/display/api").PDFDocumentLoadingTask | undefined>; getPage: (doc: PDFDocumentProxy, pageIndex: number) => Promise<PDFPageProxy>; }; export default usePdf;