UNPKG

ngx-extended-pdf-viewer

Version:

Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.

54 lines (53 loc) 2.69 kB
import { OnDestroy } from '@angular/core'; import { IPDFViewerApplication } from './options/pdf-viewer-application'; import { IPDFViewerApplicationOptions } from './options/pdf-viewer-application-options'; import { PdfCspPolicyService } from './pdf-csp-policy.service'; import * as i0 from "@angular/core"; export declare class PDFScriptLoaderService implements OnDestroy { private readonly pdfCspPolicyService; private readonly csp_nonce; private _forceUsingLegacyES5; get forceUsingLegacyES5(): boolean; set forceUsingLegacyES5(value: boolean); onPDFJSInitSignal: import("@angular/core").WritableSignal<IPDFViewerApplication | undefined>; pdfjsVersion: string; private _needsES5; PDFViewerApplication: IPDFViewerApplication; PDFViewerApplicationOptions: IPDFViewerApplicationOptions; webViewerLoad: (cspPolicyService: PdfCspPolicyService) => void; ngxExtendedPdfViewerIncompletelyInitialized: boolean; constructor(pdfCspPolicyService: PdfCspPolicyService, csp_nonce: string); private addScriptOpChainingSupport; /** * Loads the browser-capability probe as a file (`assets/op-chaining-support.js`). * Same code as the inline probe, but it needs no `'unsafe-inline'` in the CSP. */ private loadProbeFromFile; private createInlineScript; private isCSPAppliedViaMetaTag; private isCSPApplied; private createScriptElement; private getPdfJsPath; private loadViewer; ensurePdfJsHasBeenLoaded(useInlineScripts: boolean, forceUsingLegacyES5: boolean, forceReload: boolean): Promise<boolean>; ngOnDestroy(): void; private iOSVersionRequiresES5; private needsES5; /** * zone.js replaces the global Promise with its own ZoneAwarePromise, which only * implements the static methods that existed when that zone.js was written. Every * newer static silently disappears - even in browsers that support it natively. * * Angular 19 and 20 still use zone.js by default (21 and 22 are zoneless), so this * is not a "very old browser" workaround: it is what keeps pdf.js working on the * current Angular LTS versions. * * - `Promise.withResolvers`: zone.js 0.13.3 (Angular 16) overwrites it with undefined. * - `Promise.try`: pdf.js 6.2 calls it in `src/shared/message_handler.js` for every * worker round-trip, so without this polyfill nothing renders at all (#3259). */ private polyfillPromiseStaticsDroppedByZoneJS; private ngxExtendedPdfViewerCanRunModernJSCode; static ɵfac: i0.ɵɵFactoryDeclaration<PDFScriptLoaderService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<PDFScriptLoaderService>; }