tomc
March 11, 2025, 5:39pm
1
Which product are you using?
PDF.js Express Plus
PDF.js Express Version
UI Version = 8.7.0
Core version = 8.7.5
Detailed description of issue
I’m receiving the following error when trying to import signatures after exporting them. I see these errors in the console.
Expected behaviour
I’d expect to see the signature in the dropdown
Does your issue happen with every document, or just one?
All documents
Link to document
N/A
Code snippet
const signatureTool = instance.Core.documentViewer.getTool('AnnotationCreateSignature');
let _signatures;
signatureTool.exportSignatures().then((exportedSignatures) => {
if (exportedSignatures === null || exportedSignatures === undefined) {
writeErrorMessage('Signatures JSON is null or undefined');
return;
}
_signatures = exportedSignatures;
});
function populateSignatures() {
signatureTool.importSignatures(_signatures).then(() => { });
}
kkim
March 11, 2025, 6:59pm
3
Hi there,
Can you share what you are passing to the importSignatures API? Are you using a JSON?
best regards,
Kevin
tomc
March 12, 2025, 8:39am
4
I’m passing the result from the signatureTool.exportSignatures
function that is being saved to a variable. I believe I’m getting an array.
kkim
March 12, 2025, 3:15pm
5
Hi there,
Can you try the suggested solution provided here as an example to use the importSignature API:
Hi there,
I have tested this issue with the following code. Could you try modifying it to match your signature, Ali?
const signatures = [
[
{ x: 10, y: 10 },
{ x: 50, y: 50 },
],
];
const latestAddedSignatureIndex = signatures.length - 1;
const canvas = document.createElement('canvas');
canvas.width = 500;
canvas.height = 500;
const ctx = canvas.getContext('2d');
ctx.lineWidth = 4;
ctx.strokeStyle = 'black';
ctx.beginPath();
const signatureArray = signatures[latestAddedSignat…
best regards,
Kevin