react-pdf-highlighter-extended

The props type for PdfLoader.

interface PdfLoaderProps {
    document: string | URL | TypedArray | DocumentInitParameters;
    workerSrc?: string;
    beforeLoad?(progress): ReactNode;
    children(pdfDocument): ReactNode;
    errorMessage?(error): ReactNode;
    onError?(error): void;
}

Properties

document: string | URL | TypedArray | DocumentInitParameters

The document to be loaded by PDF.js. If you need to pass HTTP headers, auth parameters, or other pdf settings, do it through here.

workerSrc?: string

NOTE: This will be applied to all PdfLoader instances. If you want to only apply a source to this instance, use the document parameters.

Methods

  • Callback to render content before the PDF document is loaded.

    Parameters

    • progress: OnProgressParameters

      PDF.js progress status.

    Returns ReactNode

    • Component to be rendered in space of the PDF document while loading.
  • Child components to use/render the loaded PDF document.

    Parameters

    • pdfDocument: PDFDocumentProxy

      The loaded PDF document.

    Returns ReactNode

    • Component to render once PDF document is loaded.
  • Component to render in the case of any PDF loading errors.

    Parameters

    • error: Error

      PDF loading error.

    Returns ReactNode

    • Component to be rendered in space of the PDF document.
  • Callback triggered whenever an error occurs.

    Parameters

    • error: Error

      PDF Loading error triggering the event.

    Returns void

    • Component to be rendered in space of the PDF document.