//import PSPDFKit, { Instance } from 'index.d.ts'; import PSPDFKitType from "./index"; import { Instance } from "./index"; declare const PSPDFKit: typeof PSPDFKitType export class App { public static loadPDFFromUrl (container: string, url: string): void { console.log("Loading PSPDFKit.."); fetch(url, { credentials: "include" }) .then(res => res.arrayBuffer()) .then(arrayBuffer => App.loadPSPDFKit(arrayBuffer, container)) .then(instance => { console.log("PSPDFKit loaded!") console.log(instance) }) .catch(error => { console.error(error.message); }); } private static loadPSPDFKit(arrayBuffer: ArrayBuffer, container: string) { PSPDFKit.load({ container: container, document: arrayBuffer }) } } // This function will be called in the ShowEnvelope.razor page // and will trigger loading of the Editor Interface //const loadPDFFromUrl = function (container: string, url: string): void { // console.log("Loading PSPDFKit.."); // fetch(url, { credentials: "include" }) // .then(res => res.arrayBuffer()) // .then(arrayBuffer => loadPSPDFKit(arrayBuffer, container)) // .then(configurePSPDFKit) // .then(instance => { // console.log("PSPDFKit loaded!") // }) // .catch(error => { // console.error(error.message); // }); //}