This commit is contained in:
Jonathan Jenne
2023-11-20 10:56:25 +01:00
parent 36e441106a
commit ea35ed0e29
12 changed files with 83 additions and 100 deletions

View File

@@ -62,8 +62,7 @@ class App {
const annotations = this.Annotation.createAnnotations(this.currentDocument)
const createdAnnotations = await this.Instance.create(annotations)
const description = "Umschlag wurde geöffnet"
await this.Network.postHistory(this.envelopeKey, ActionType.Seen, description);
await this.Network.postHistory(this.envelopeKey, ActionType.Seen)
} catch (e) {
console.error(e)
}
@@ -77,47 +76,12 @@ class App {
handleAnnotationsChange() {}
async handleAnnotationsCreate(createdAnnotations) {
console.log("annotations created");
console.log(createdAnnotations.toJS())
const annotation = createdAnnotations.toJS()[0];
const isFormField = !!annotation.formFieldName;
const isSignature = !!annotation.isSignature;
if (isFormField === false && isSignature === true) {
const left = annotation.boundingBox.left - 25;
const top = annotation.boundingBox.top - 25;
const width = 150;
const height = 75;
console.log(annotation.boundingBox)
const imageUrl = await this.Annotation.createAnnotationFrameBlob(this.currentReceiver.name, width, height);
const request = await fetch(imageUrl);
const blob = await request.blob();
const imageAttachmentId = await this.Instance.createAttachment(blob);
const frameAnnotation = new PSPDFKit.Annotations.ImageAnnotation({
pageIndex: annotation.pageIndex,
isSignature: false,
readOnly: true,
locked: true,
lockedContents: true,
contentType: 'image/png',
imageAttachmentId,
description: 'FRAME',
boundingBox: new PSPDFKit.Geometry.Rect({
left: left,
top: top,
width: width,
height: height,
}),
});
this.Instance.create(frameAnnotation);
await this.Annotation.createFrameAnnotation(annotation, this.currentReceiver)
}
}
@@ -169,6 +133,9 @@ class App {
return false;
}
// Redirect to success page after saving to database
window.location.href = `/EnvelopeKey/${this.envelopeKey}/Success`
} catch (e) {
console.error(e);
return false;