Web SDKv1.0.0

PDFViewer.showLoadingIndicator()

Show a loading spinner before a viewer exists. Involves no document. A loader put in the container stays over the viewer until you remove it: show the loader, open, construct, await viewer.whenReady(), hide.
static methodStaticsince 1.0.0

Signature

static showLoadingIndicator(container: HTMLElement, options?: { loader?: LoaderConfig; locale?: LocaleConfig }): () => void

Parameters

ParameterTypeDescription
containerHTMLElementThe element the viewer will be rendered into.
options?{ loader?: LoaderConfig; locale?: LocaleConfig }options.loader is a LoaderConfig and options.locale a LocaleConfig — pass the ones you give the viewer.

Returns

() => void A cleanup function.

Example

TypeScript
const hide = PDFViewer.showLoadingIndicator(container, { locale: { lang: 'de' } });
const doc = await PDFDocument.fromUrl('/report.pdf');
const viewer = new PDFViewer(container, doc, { locale: { lang: 'de' } });
await viewer.whenReady();
hide();

More in PDFViewer