UNPKG

pdfjs-viewer-element

Version:

Standalone, isolated, drop-in [PDF.js default viewer](https://mozilla.github.io/pdf.js/web/viewer.html).

66 lines (65 loc) 2.21 kB
export declare const ViewerCssTheme: { readonly AUTOMATIC: 0; readonly LIGHT: 1; readonly DARK: 2; }; export declare class PdfjsViewerElement extends HTMLElement { constructor(); iframe: PdfjsViewerElementIframe; initPromise: Promise<InitializationData>; private localeResourceUrl?; private localeResourceLink?; private viewerStyles; private optionsToSet; static get observedAttributes(): string[]; private formatTemplate; private getFullPath; private getCssThemeOption; private applyIframeHash; private applyViewerTheme; private appendRuntimeStyle; private applyQueuedRuntimeStyles; private injectScript; private injectLocaleData; private cleanupLocaleResource; private onViewerAppCreated; private applyViewerOptions; private getIframeLocationHash; private buildViewerEntry; private setupViewerApp; private buildViewerApp; connectedCallback(): Promise<void>; disconnectedCallback(): void; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): Promise<void>; injectViewerStyles(styles: string): Promise<void>; setViewerOptions(options?: Record<string, string | number>): Promise<{ viewerOptions: { set: (name: string, value: string | boolean | number | Record<string, any>) => void; getAll: () => Record<string, any>; }; }>; } export interface IframeWindow extends Window { PDFViewerApplication?: { initializedPromise: Promise<void>; initialized: boolean; eventBus: Record<string, any>; open: (params: { url: string; originalUrl?: string; } | { data: Uint8Array; } | Uint8Array) => void; }; PDFViewerApplicationOptions: { set: (name: string, value: string | boolean | number | Record<string, any>) => void; getAll: () => Record<string, any>; }; } export interface PdfjsViewerElementIframe extends HTMLIFrameElement { contentWindow: IframeWindow; } export interface InitializationData { viewerApp?: IframeWindow['PDFViewerApplication']; } export default PdfjsViewerElement;