Skip to content
Snippets Groups Projects
Commit 49c8f2ee authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

shutdown the lib only for node

parent 63357a8e
No related branches found
No related tags found
No related merge requests found
File added
...@@ -70,7 +70,7 @@ class PDFparser { ...@@ -70,7 +70,7 @@ class PDFparser {
}); });
this.insertQrCode = (imgBytes, url, coords, scaleFactor, licenseKey, certPath, certTSAUrl) => __awaiter(this, void 0, void 0, function* () { this.insertQrCode = (imgBytes, url, coords, scaleFactor, licenseKey, certPath, certTSAUrl) => __awaiter(this, void 0, void 0, function* () {
let lib, buf; let lib, buf;
if (typeof window !== `undefined`) { if (typeof window !== "undefined") {
lib = window.PDFNet; lib = window.PDFNet;
} }
else { else {
...@@ -85,7 +85,9 @@ class PDFparser { ...@@ -85,7 +85,9 @@ class PDFparser {
console.log(error); console.log(error);
throw new errors_1.GeneralError("Could Not sign pdf"); throw new errors_1.GeneralError("Could Not sign pdf");
} }
yield lib.shutdown(); if (typeof window === "undefined") {
yield lib.shutdown();
}
return buf; return buf;
}); });
this.document = document; this.document = document;
......
...@@ -67,7 +67,7 @@ class PDFparser { ...@@ -67,7 +67,7 @@ class PDFparser {
certTSAUrl: string certTSAUrl: string
): Promise<ArrayBuffer> => { ): Promise<ArrayBuffer> => {
let lib, buf; let lib, buf;
if (typeof window !== `undefined`) { if (typeof window !== "undefined") {
lib = window.PDFNet; lib = window.PDFNet;
} else { } else {
const pdflib = await import("@pdftron/pdfnet-node"); const pdflib = await import("@pdftron/pdfnet-node");
...@@ -89,7 +89,10 @@ class PDFparser { ...@@ -89,7 +89,10 @@ class PDFparser {
throw new GeneralError("Could Not sign pdf"); throw new GeneralError("Could Not sign pdf");
} }
await lib.shutdown(); if (typeof window === "undefined") {
await lib.shutdown();
}
return buf; return buf;
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment