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