feat(annotation): enhance mapSignature to support drawn signatures

- Added support for mapping drawn (non-image) signatures by including `lines` and `strokeColor` data.
- Added error handling for incompatible or missing signature data structures.
- Ensures compatibility with third-party annotation libraries that return vector-based signatures.
This commit is contained in:
tekh 2025-10-20 16:35:53 +02:00
parent 04ae14c660
commit 7919f02ffd
3 changed files with 15 additions and 850 deletions

View File

@ -335,6 +335,13 @@ function mapSignature(iJSON) {
signatures: iJSON.annotations.filter(annot => annot.isSignature).map(annot => { signatures: iJSON.annotations.filter(annot => annot.isSignature).map(annot => {
if (annot.imageAttachmentId) if (annot.imageAttachmentId)
annot.value = iJSON.attachments[annot.imageAttachmentId]?.binary; annot.value = iJSON.attachments[annot.imageAttachmentId]?.binary;
else if (annot.lines && annot.strokeColor)
annot.value = JSON.stringify({
lines: annot.lines,
strokeColor: annot.strokeColor
});
else
throw new Error("Signature mapping failed: The data structure from the third-party library is incompatible or missing required fields.");
annot.name = 'signature'; annot.name = 'signature';
return annot; return annot;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long