add typescript
This commit is contained in:
48
EnvelopeGenerator.Web/Scripts/app.ts
Normal file
48
EnvelopeGenerator.Web/Scripts/app.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
//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);
|
||||
// });
|
||||
//}
|
||||
|
||||
8599
EnvelopeGenerator.Web/Scripts/index.d.ts
vendored
Normal file
8599
EnvelopeGenerator.Web/Scripts/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user