diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index 1a54d193..97c08045 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -309,6 +309,13 @@ function isCityField(formField) { return cityFieldNames.includes(formField.name) } +function fixBase64(escapedBase64) { + return escapedBase64 + .replace(/\\u002B/g, "+") + .replace(/\\u002F/g, "/") + .replace(/\\u003D/g, "="); +} + function mapSignature(iJSON) { return { formFields: iJSON.formFieldValues.filter(field => !field.name.includes("label")).map((field) => { @@ -318,6 +325,9 @@ function mapSignature(iJSON) { return field; }), frames: iJSON.annotations.filter(annot => annot.description === 'FRAME').map((annot) => { + const preElement = findNearest(annot, e => e.bbox[0], e => e.bbox[1], ...iJSON.annotations.filter(field => field.id.includes("signature"))); + const idPartsOfPre = preElement.id.split('#'); + annot.elementId = Number(idPartsOfPre[2]); annot.name = annot.description.toLowerCase(); annot.value = iJSON.attachments[annot.imageAttachmentId]?.binary || null; return annot;