This commit is contained in:
Jonathan Jenne
2023-11-20 16:42:11 +01:00
parent 624266a971
commit 56688d2690
18 changed files with 305 additions and 59 deletions

View File

@@ -101,23 +101,9 @@
return annotation
}
async createFrameAnnotation(annotation, receiver) {
const left = annotation.boundingBox.left - 25
const top = annotation.boundingBox.top - 25
const width = 150
const height = 75
const imageUrl = await this.Annotation.createAnnotationFrameBlob(
receiver.name,
width,
height
)
const request = await fetch(imageUrl)
const blob = await request.blob()
const imageAttachmentId = await this.Instance.createAttachment(blob)
createImageAnnotation(boundingBox, pageIndex, imageAttachmentId) {
const frameAnnotation = new PSPDFKit.Annotations.ImageAnnotation({
pageIndex: annotation.pageIndex,
pageIndex: pageIndex,
isSignature: false,
readOnly: true,
locked: true,
@@ -125,13 +111,9 @@
contentType: 'image/png',
imageAttachmentId,
description: 'FRAME',
boundingBox: new PSPDFKit.Geometry.Rect({
left: left,
top: top,
width: width,
height: height,
}),
})
boundingBox: boundingBox,
});
return frameAnnotation
}
async createAnnotationFrameBlob(receiverName, width, height) {

View File

@@ -93,10 +93,26 @@ class App {
const isSignature = !!annotation.isSignature
if (isFormField === false && isSignature === true) {
await this.Annotation.createFrameAnnotation(
annotation,
this.currentReceiver
)
const left = annotation.boundingBox.left - 25;
const top = annotation.boundingBox.top - 25;
const width = 150;
const height = 75;
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 = this.Annotation.createImageAnnotation(new PSPDFKit.Geometry.Rect({
left: left,
top: top,
width: width,
height: height,
}), annotation.pageIndex, imageAttachmentId)
this.Instance.create(frameAnnotation);
}
}
@@ -119,8 +135,8 @@ class App {
result = await this.handleFinish(null)
if (result == true) {
// TODO: Redirect to success page
alert('Dokument erfolgreich signiert!')
// Redirect to success page after saving to database
window.location.href = `/EnvelopeKey/${this.envelopeKey}/Success`
} else {
alert('Fehler beim Abschließen des Dokuments!')
}
@@ -147,12 +163,11 @@ class App {
JSON.stringify(json)
)
console.log(postEnvelopeResult)
if (postEnvelopeResult === false) {
return false
}
// Redirect to success page after saving to database
window.location.href = `/EnvelopeKey/${this.envelopeKey}/Success`
} catch (e) {
console.error(e)
return false

View File

@@ -39,6 +39,8 @@
actionType: actionType,
}
console.log(data)
const options = {
credentials: 'include',
method: 'POST',