diff --git a/src/taskpane/taskpane.html b/src/taskpane/taskpane.html index c599b63..7d339c8 100644 --- a/src/taskpane/taskpane.html +++ b/src/taskpane/taskpane.html @@ -53,11 +53,12 @@ - (loadingSection.style.display = "none")); + let filearray = new Uint8Array(fileData); + let reader = new FileReader(); + let filestring: string | ArrayBuffer; + reader.onload = () => { + filestring = reader.result; + console.log("filestring in taskpane:"); + console.log(filestring); + ezpPrinting.setAttribute("filedata", filestring); + ezpPrinting.setAttribute("filename", "test.pdf"); + if (authorized) ezpPrinting.open().then(() => (loadingSection.style.display = "none")); + // delete filestring from memory + fileData = null; + filearray = null; + filestring = null; + }; + + // read filedata as binary string + reader.readAsBinaryString(new Blob([filearray])); + // write to file + // const blob = new Blob([filearray], { type: "application/pdf" }); + // const url = URL.createObjectURL(blob); + // const a = document.createElement("a"); + // a.href = url; + // a.download = "test.pdf"; + // a.click(); } async function openAuthDialog() {