'angular - ERROR TypeError: Cannot read properties of undefined (reading 'initialize')
so when I'm testing with PDFNet library of PDFTRON, when I run only the file with PDFnet.initialize() function it works fine , but once I run it on angular it says :
core.mjs:6461 ERROR TypeError: Cannot read properties of undefined (reading 'initialize')
even tho I imported the namespace, here is my code:
const CryptoJS = require('crypto-js');
import { PDFNet } from '@pdftron/pdfnet-node';
import { exit } from 'process';
import * as qr from 'qr-image';
class DocumentSV {
public statu: number;
// ---------------- Preparation --------------------
// Récuperer le document dont on veut signer
constructor() {
this.statu = 0;
}
async Sign(docpath : string, pfxpath : string) {
try {
await PDFNet.initialize(/*license*/);
const doc = await PDFNet.PDFDoc.createFromFilePath(docpath);
.
.
.
await doc.save('src/app/Document/Signed.pdf', PDFNet.SDFDoc.SaveOptions.e_remove_unused);
exit(1);
} catch (err) {
console.log('error', err)
}
}
}
const _DocumentSV = DocumentSV;
export { _DocumentSV as DocumentSV };```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
