From 13a87f29d902d819692b4c0bd2e3bfe5a6b70c13 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 13:38:32 +0200 Subject: [PATCH 01/14] =?UTF-8?q?refactor(Annotations.js):=20Hinzuf=C3=BCg?= =?UTF-8?q?en=20von=20Container-Widget-Annotationen=20als=20Hintergrund=20?= =?UTF-8?q?von=20Annotationen=20ohne=20BoundingBox-Konfiguration.=20=20-?= =?UTF-8?q?=20Konvertieren=20von=20Signaturen=20Hintergrundfarbe=20von=20g?= =?UTF-8?q?elb=20zu=20hellgelb.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/js/annotation.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index 628583d9..05d85a31 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -6,13 +6,32 @@ async function createAnnotations(document, instance) { const annotParams = await getAnnotationParams(element.left, element.top); const page = element.page - 1 + //background + const id_background = PSPDFKit.generateInstantId() + const annotation_background = new PSPDFKit.Annotations.WidgetAnnotation({ + id: id_background, + pageIndex: page, + formFieldName: id_background, + backgroundColor: PSPDFKit.Color.WHITE, + blendMode: 'normal', + //boundingBox: new PSPDFKit.Geometry.Rect({width: 152, height: 180, left: 186.09992, top: 648.8533600000001}), + fontSize: 8, + }) + + const formFieldBackground = new PSPDFKit.FormFields.ButtonFormField({ + name: id_background, + annotationIds: PSPDFKit.Immutable.List([annotation_background.id]), + value: "", + readOnly: false + }) + //signatures const id = PSPDFKit.generateInstantId() const annotation = new PSPDFKit.Annotations.WidgetAnnotation({ id: id, pageIndex: page, formFieldName: id, - backgroundColor: PSPDFKit.Color.YELLOW, + backgroundColor: PSPDFKit.Color.LIGHT_YELLOW, blendMode: 'multiply', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.signature), }) @@ -131,7 +150,8 @@ async function createAnnotations(document, instance) { name: id_city_label, annotationIds: PSPDFKit.Immutable.List([annotation_city_label.id]), value: "Ort", - readOnly: true + readOnly: true, + color: PSPDFKit.Color.BLACK }) //position label @@ -155,6 +175,9 @@ async function createAnnotations(document, instance) { readOnly: true }) + signatures.push(annotation_background) + signatures.push(formFieldBackground) + signatures.push(annotation) signatures.push(formField) signatures.push(annotation_date) From ea6ee11a4e9e09aa81fc38b19c5e7d1fb3a1b833 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 15:31:35 +0200 Subject: [PATCH 02/14] feat(Hintergrund): Erstellen, um den Hintergrund von Anmerkungen mit der Eigenschaft MarginRatio zu konfigurieren. - verschiebt Anmerkungen nach --- .../Controllers/ConfigController.cs | 2 +- .../Models/{ => Annotation}/Annotation.cs | 2 +- .../{ => Annotation}/AnnotationParams.cs | 19 +++++++++++++------ .../Models/Annotation/Background.cs | 6 ++++++ EnvelopeGenerator.Web/Program.cs | 1 + EnvelopeGenerator.Web/appsettings.json | 3 +++ 6 files changed, 25 insertions(+), 8 deletions(-) rename EnvelopeGenerator.Web/Models/{ => Annotation}/Annotation.cs (97%) rename EnvelopeGenerator.Web/Models/{ => Annotation}/AnnotationParams.cs (76%) create mode 100644 EnvelopeGenerator.Web/Models/Annotation/Background.cs diff --git a/EnvelopeGenerator.Web/Controllers/ConfigController.cs b/EnvelopeGenerator.Web/Controllers/ConfigController.cs index edf4859f..fc6f5efd 100644 --- a/EnvelopeGenerator.Web/Controllers/ConfigController.cs +++ b/EnvelopeGenerator.Web/Controllers/ConfigController.cs @@ -1,4 +1,4 @@ -using EnvelopeGenerator.Web.Models; +using EnvelopeGenerator.Web.Models.Annotation; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; diff --git a/EnvelopeGenerator.Web/Models/Annotation.cs b/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs similarity index 97% rename from EnvelopeGenerator.Web/Models/Annotation.cs rename to EnvelopeGenerator.Web/Models/Annotation/Annotation.cs index 6db0265a..ace9f811 100644 --- a/EnvelopeGenerator.Web/Models/Annotation.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace EnvelopeGenerator.Web.Models; +namespace EnvelopeGenerator.Web.Models.Annotation; public record Annotation { diff --git a/EnvelopeGenerator.Web/Models/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs similarity index 76% rename from EnvelopeGenerator.Web/Models/AnnotationParams.cs rename to EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs index 052968e1..59ad9a89 100644 --- a/EnvelopeGenerator.Web/Models/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs @@ -1,13 +1,20 @@ using System.Text.Json.Serialization; -namespace EnvelopeGenerator.Web.Models; +namespace EnvelopeGenerator.Web.Models.Annotation; public class AnnotationParams { + public AnnotationParams() + { + _annotationDictionaryInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a)); + } + + public Background? Background { get; init; } + [JsonIgnore] public Annotation? DefaultAnnotation { get; init; } - private readonly IEnumerable _annots = new List(); + private readonly List _annots = new List(); public Annotation this[string name] => _annots.First(a => a.Name == name); @@ -24,7 +31,7 @@ public class AnnotationParams get => _annots; init { - _annots = value; + _annots = value.ToList(); if (DefaultAnnotation is not null) foreach (var annot in _annots) @@ -48,10 +55,10 @@ public class AnnotationParams throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined."); #endregion } - - AnnotationDictionary = _annots.ToDictionary(a => a.Name.ToLower(), a => a); } } - public Dictionary AnnotationDictionary { get; private init; } = new(); + private readonly Lazy> _annotationDictionaryInitor; + + public Dictionary AnnotationDictionary => _annotationDictionaryInitor.Value; } diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs new file mode 100644 index 00000000..57220365 --- /dev/null +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -0,0 +1,6 @@ +namespace EnvelopeGenerator.Web.Models.Annotation; + +public class Background +{ + public int Margin { get; init; } +} diff --git a/EnvelopeGenerator.Web/Program.cs b/EnvelopeGenerator.Web/Program.cs index 8a2f7fc1..9448b5e4 100644 --- a/EnvelopeGenerator.Web/Program.cs +++ b/EnvelopeGenerator.Web/Program.cs @@ -15,6 +15,7 @@ using DigitalData.EmailProfilerDispatcher; using EnvelopeGenerator.Infrastructure; using EnvelopeGenerator.Web.Sanitizers; using EnvelopeGenerator.Application.Contracts.Services; +using EnvelopeGenerator.Web.Models.Annotation; var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger(); logger.Info("Logging initialized!"); diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 136c48a8..380644e5 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -151,6 +151,9 @@ }, "MainPageTitle": null, "AnnotationParams": { + "Background": { + "Margin": 0.20 + }, "DefaultAnnotation": { "Width": 1, "Height": 0.5, From d80fa0b023ba37a2c820f68be035c70c87c1fd96 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 15:38:14 +0200 Subject: [PATCH 03/14] feat(Background): Add Width, Height, Top and Left properties. - Add JsonIgnroe property to BackGround --- .../Models/Annotation/Background.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs index 57220365..b9143f5b 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Background.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -1,6 +1,17 @@ -namespace EnvelopeGenerator.Web.Models.Annotation; +using System.Text.Json.Serialization; + +namespace EnvelopeGenerator.Web.Models.Annotation; public class Background { + [JsonIgnore] public int Margin { get; init; } + + public double? Width { get; set; } + + public double? Height { get; set; } + + public double? Left { get; set; } + + public double? Top { get; set; } } From 32be5077f9d3382977491bd70003545c666456ea Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 15:41:53 +0200 Subject: [PATCH 04/14] feat(Hintergrund): Erstellen, um den Hintergrund von Anmerkungen mit der Eigenschaft MarginRatio zu konfigurieren. - verschiebt Anmerkungen nach --- EnvelopeGenerator.Web/Controllers/ConfigController.cs | 2 +- .../Models/Annotation/AnnotationParams.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/EnvelopeGenerator.Web/Controllers/ConfigController.cs b/EnvelopeGenerator.Web/Controllers/ConfigController.cs index fc6f5efd..8a4e6079 100644 --- a/EnvelopeGenerator.Web/Controllers/ConfigController.cs +++ b/EnvelopeGenerator.Web/Controllers/ConfigController.cs @@ -18,6 +18,6 @@ public class ConfigController : ControllerBase [HttpGet("Annotations")] public IActionResult GetAnnotationParams() { - return Ok(_annotParams.AnnotationDictionary); + return Ok(_annotParams.AnnotationJSObject); } } diff --git a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs index 59ad9a89..96a3e7f9 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs @@ -6,7 +6,7 @@ public class AnnotationParams { public AnnotationParams() { - _annotationDictionaryInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a)); + _AnnotationJSObjectInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a)); } public Background? Background { get; init; } @@ -16,8 +16,6 @@ public class AnnotationParams private readonly List _annots = new List(); - public Annotation this[string name] => _annots.First(a => a.Name == name); - public bool TryGet(string name, out Annotation annotation) { #pragma warning disable CS8601 // Possible null reference assignment. @@ -58,7 +56,7 @@ public class AnnotationParams } } - private readonly Lazy> _annotationDictionaryInitor; + private readonly Lazy> _AnnotationJSObjectInitor; - public Dictionary AnnotationDictionary => _annotationDictionaryInitor.Value; + public Dictionary AnnotationJSObject => _AnnotationJSObjectInitor.Value; } From e95d1d782e57e4a6ea8ea59bac7be6ac4dbe0bc4 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 16:50:10 +0200 Subject: [PATCH 05/14] feat(IAnnotation): Erstellt, um die grundlegenden Eigenschaften einer Annotation zu behandeln. - implementiert in Annotation und Hintergrund --- .../Models/Annotation/Annotation.cs | 2 +- .../Models/Annotation/Background.cs | 10 ++++++---- .../Models/Annotation/IAnnotation.cs | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs diff --git a/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs b/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs index ace9f811..613ae395 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs @@ -2,7 +2,7 @@ namespace EnvelopeGenerator.Web.Models.Annotation; -public record Annotation +public record Annotation : IAnnotation { public required string Name { get; init; } diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs index b9143f5b..aa770b87 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Background.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -2,16 +2,18 @@ namespace EnvelopeGenerator.Web.Models.Annotation; -public class Background +public record Background : IAnnotation { [JsonIgnore] - public int Margin { get; init; } + public double Margin { get; init; } + + public string Name { get; } = "Background"; public double? Width { get; set; } public double? Height { get; set; } - public double? Left { get; set; } + public double Left { get; set; } - public double? Top { get; set; } + public double Top { get; set; } } diff --git a/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs b/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs new file mode 100644 index 00000000..1bb30478 --- /dev/null +++ b/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs @@ -0,0 +1,14 @@ +namespace EnvelopeGenerator.Web.Models.Annotation; + +public interface IAnnotation +{ + string Name { get; } + + double? Width { get; } + + double? Height { get; } + + double Left { get; } + + double Top { get; } +} From e72ea534e596baa16c16037d623c8076942b30a1 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 17:25:58 +0200 Subject: [PATCH 06/14] =?UTF-8?q?refactor(AnnotationParams):=20AnnotationJ?= =?UTF-8?q?SObject=20aktualisieren,=20um=20IAnnotation=20(anstelle=20von?= =?UTF-8?q?=20Annotation)=20zu=20enthalten=20=20-=20Hintergrund=20in=20Ann?= =?UTF-8?q?otationJSObject=20hinzuf=C3=BCgen,=20wenn=20er=20nicht=20null?= =?UTF-8?q?=20ist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Annotation/AnnotationParams.cs | 20 ++++++++++++++++--- .../Models/Annotation/Background.cs | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs index 96a3e7f9..785d7046 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs @@ -6,11 +6,12 @@ public class AnnotationParams { public AnnotationParams() { - _AnnotationJSObjectInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a)); + _AnnotationJSObjectInitor = new(CreateAnnotationJSObject); } public Background? Background { get; init; } + #region Annotation [JsonIgnore] public Annotation? DefaultAnnotation { get; init; } @@ -55,8 +56,21 @@ public class AnnotationParams } } } + #endregion - private readonly Lazy> _AnnotationJSObjectInitor; + #region AnnotationJSObject + private Dictionary CreateAnnotationJSObject() + { + var dict = _annots.ToDictionary(a => a.Name.ToLower(), a => a as IAnnotation); + + if (Background is not null) + dict.Add(Background.Name.ToLower(), Background); + + return dict; + } + + private readonly Lazy> _AnnotationJSObjectInitor; - public Dictionary AnnotationJSObject => _AnnotationJSObjectInitor.Value; + public Dictionary AnnotationJSObject => _AnnotationJSObjectInitor.Value; + #endregion } diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs index aa770b87..fc0b76a4 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Background.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -2,6 +2,10 @@ namespace EnvelopeGenerator.Web.Models.Annotation; +/// +/// The Background is an annotation for the PSPDF Kit. However, it has no function. +/// It is only the first annotation as a background for other annotations. +/// public record Background : IAnnotation { [JsonIgnore] From d75da655d2063221493b86e0756c98752b05268f Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 18:13:46 +0200 Subject: [PATCH 07/14] =?UTF-8?q?feat(Hintergrund):=20Locate=20add,=20um?= =?UTF-8?q?=20die=20Position=20des=20Hintergrunds=20anhand=20anderer=20Anm?= =?UTF-8?q?erkungen=20zu=20berechnen.=20=20-=20Standort=20des=20Hintergrun?= =?UTF-8?q?ds=20zu=20Anmerkungen=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Annotation/AnnotationParams.cs | 3 ++ .../Models/Annotation/Background.cs | 25 +++++++++++ .../Models/Annotation/Extensions.cs | 8 ++++ .../wwwroot/js/annotation.js | 42 ++++++++++--------- 4 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 EnvelopeGenerator.Web/Models/Annotation/Extensions.cs diff --git a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs index 785d7046..2bf4ff09 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs @@ -64,7 +64,10 @@ public class AnnotationParams var dict = _annots.ToDictionary(a => a.Name.ToLower(), a => a as IAnnotation); if (Background is not null) + { + Background.Locate(_annots); dict.Add(Background.Name.ToLower(), Background); + } return dict; } diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs index fc0b76a4..7d05bfe1 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Background.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -20,4 +20,29 @@ public record Background : IAnnotation public double Left { get; set; } public double Top { get; set; } + + public void Locate(IEnumerable annotations) + { + // set Top + if (annotations.MinBy(a => a.Top)?.Top is double minTop) + Top = minTop; + + // set Left + if (annotations.MinBy(a => a.Left)?.Left is double minLeft) + Left = minLeft; + + // set Width + if(annotations.MaxBy(a => a.GetRight())?.GetRight() is double maxRight) + Width = maxRight - Left; + + // set Height + if (annotations.MaxBy(a => a.GetBottom())?.GetBottom() is double maxBottom) + Height = maxBottom - Top; + + // add margins + Top -= Margin; + Left -= Margin; + Width += Margin * 2; + Height += Margin * 2; + } } diff --git a/EnvelopeGenerator.Web/Models/Annotation/Extensions.cs b/EnvelopeGenerator.Web/Models/Annotation/Extensions.cs new file mode 100644 index 00000000..92fe3fa4 --- /dev/null +++ b/EnvelopeGenerator.Web/Models/Annotation/Extensions.cs @@ -0,0 +1,8 @@ +namespace EnvelopeGenerator.Web.Models.Annotation; + +public static class Extensions +{ + public static double GetRight(this IAnnotation annotation) => annotation.Left + annotation?.Width ?? 0; + + public static double GetBottom(this IAnnotation annotation) => annotation.Top + annotation?.Height ?? 0; +} diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index 05d85a31..2345cf59 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -7,23 +7,28 @@ async function createAnnotations(document, instance) { const page = element.page - 1 //background - const id_background = PSPDFKit.generateInstantId() - const annotation_background = new PSPDFKit.Annotations.WidgetAnnotation({ - id: id_background, - pageIndex: page, - formFieldName: id_background, - backgroundColor: PSPDFKit.Color.WHITE, - blendMode: 'normal', - //boundingBox: new PSPDFKit.Geometry.Rect({width: 152, height: 180, left: 186.09992, top: 648.8533600000001}), - fontSize: 8, - }) - - const formFieldBackground = new PSPDFKit.FormFields.ButtonFormField({ - name: id_background, - annotationIds: PSPDFKit.Immutable.List([annotation_background.id]), - value: "", - readOnly: false - }) + if(annotParams.background){ + const id_background = PSPDFKit.generateInstantId(); + const annotation_background = new PSPDFKit.Annotations.WidgetAnnotation({ + id: id_background, + pageIndex: page, + formFieldName: id_background, + backgroundColor: PSPDFKit.Color.WHITE, + blendMode: 'normal', + boundingBox: new PSPDFKit.Geometry.Rect(annotParams.background), + fontSize: 8, + }); + + const formFieldBackground = new PSPDFKit.FormFields.ButtonFormField({ + name: id_background, + annotationIds: PSPDFKit.Immutable.List([annotation_background.id]), + value: "", + readOnly: false + }); + + signatures.push(annotation_background) + signatures.push(formFieldBackground) + } //signatures const id = PSPDFKit.generateInstantId() @@ -175,9 +180,6 @@ async function createAnnotations(document, instance) { readOnly: true }) - signatures.push(annotation_background) - signatures.push(formFieldBackground) - signatures.push(annotation) signatures.push(formField) signatures.push(annotation_date) From 8b505ae39a33c5779bb87f5d1e3d161c96d74f64 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Wed, 23 Apr 2025 22:59:45 +0200 Subject: [PATCH 08/14] =?UTF-8?q?feat(annotations):=20verbessertes=20Styli?= =?UTF-8?q?ng=20f=C3=BCr=20Hintergrund-Anmerkungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Hintergrundfarbe der Hintergrund-Anmerkungen auf einen benutzerdefinierten hellen Ton geändert - Unterstrichener Rahmenstil mit spezifischer Farbe und Breite hinzugefügt - Blendmodus von 'multiply' zu 'normal' vereinheitlicht für bessere Konsistenz - Visuelle Hierarchie der Anmerkungselemente verbessert --- .../wwwroot/js/annotation.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index 2345cf59..d2fcde76 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -13,10 +13,13 @@ async function createAnnotations(document, instance) { id: id_background, pageIndex: page, formFieldName: id_background, - backgroundColor: PSPDFKit.Color.WHITE, + backgroundColor: new PSPDFKit.Color({ r: 222, g: 220, b: 215 }), blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.background), fontSize: 8, + borderStyle: 'underline', + borderWidth: 4, + borderColor: new PSPDFKit.Color({ r: 204, g: 202, b: 198 }) }); const formFieldBackground = new PSPDFKit.FormFields.ButtonFormField({ @@ -37,7 +40,7 @@ async function createAnnotations(document, instance) { pageIndex: page, formFieldName: id, backgroundColor: PSPDFKit.Color.LIGHT_YELLOW, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.signature), }) @@ -53,7 +56,7 @@ async function createAnnotations(document, instance) { pageIndex: page, formFieldName: id_position, backgroundColor: PSPDFKit.Color.DarkBlue, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.position), fontSize: 8 }) @@ -72,7 +75,7 @@ async function createAnnotations(document, instance) { pageIndex: page, formFieldName: id_city, backgroundColor: PSPDFKit.Color.DarkBlue, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.city), fontSize: 8 }) @@ -91,7 +94,7 @@ async function createAnnotations(document, instance) { pageIndex: page, formFieldName: id_date, backgroundColor: PSPDFKit.Color.DarkBlue, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.date), fontSize: 8, backgroundColor: PSPDFKit.Color.TRANSPARENT, @@ -121,7 +124,7 @@ async function createAnnotations(document, instance) { id: id_date_label, pageIndex: page, formFieldName: id_date_label, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.datelabel), fontSize: 8, backgroundColor: PSPDFKit.Color.TRANSPARENT, @@ -143,7 +146,7 @@ async function createAnnotations(document, instance) { id: id_city_label, pageIndex: page, formFieldName: id_city_label, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.citylabel), fontSize: 8, backgroundColor: PSPDFKit.Color.TRANSPARENT, @@ -165,7 +168,7 @@ async function createAnnotations(document, instance) { id: id_position_label, pageIndex: page, formFieldName: id_position_label, - blendMode: 'multiply', + blendMode: 'normal', boundingBox: new PSPDFKit.Geometry.Rect(annotParams.positionlabel), fontSize: 8, backgroundColor: PSPDFKit.Color.TRANSPARENT, From 54f39103e1948178b9840905821389e66f2f34db Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 00:36:24 +0200 Subject: [PATCH 09/14] =?UTF-8?q?feat(IAnnotation):=20Hinzuf=C3=BCgen=20un?= =?UTF-8?q?d=20Implementieren=20der=20Eigenschaften=20BackgroundColor,=20B?= =?UTF-8?q?orderColor,=20BorderStyle=20und=20BorderWidth.=20=20-=20Hinterg?= =?UTF-8?q?rund=20mit=20neuen=20Eigenschaften=20in=20Annotations.js=20bind?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Annotation/Annotation.cs | 10 ++++++++++ .../Models/Annotation/Background.cs | 10 ++++++++++ EnvelopeGenerator.Web/Models/Annotation/Color.cs | 10 ++++++++++ .../Models/Annotation/IAnnotation.cs | 8 ++++++++ EnvelopeGenerator.Web/appsettings.json | 14 +++++++++++++- EnvelopeGenerator.Web/wwwroot/js/annotation.js | 13 +++++++------ 6 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 EnvelopeGenerator.Web/Models/Annotation/Color.cs diff --git a/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs b/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs index 613ae395..ba85b509 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Annotation.cs @@ -60,6 +60,16 @@ public record Annotation : IAnnotation public Annotation? VerBoundAnnot { get; set; } #endregion + public Color? BackgroundColor { get; init; } + + #region Border + public Color? BorderColor { get; init; } + + public string? BorderStyle { get; init; } + + public int? BorderWidth { get; set; } + #endregion + [JsonIgnore] internal Annotation Default { diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs index 7d05bfe1..381dddbd 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Background.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -21,6 +21,16 @@ public record Background : IAnnotation public double Top { get; set; } + public Color? BackgroundColor { get; init; } + + #region Border + public Color? BorderColor { get; init; } + + public string? BorderStyle { get; init; } + + public int? BorderWidth { get; set; } + #endregion + public void Locate(IEnumerable annotations) { // set Top diff --git a/EnvelopeGenerator.Web/Models/Annotation/Color.cs b/EnvelopeGenerator.Web/Models/Annotation/Color.cs new file mode 100644 index 00000000..0dc025be --- /dev/null +++ b/EnvelopeGenerator.Web/Models/Annotation/Color.cs @@ -0,0 +1,10 @@ +namespace EnvelopeGenerator.Web.Models.Annotation; + +public record Color +{ + public int R { get; init; } = 0; + + public int G { get; init; } = 0; + + public int B { get; init; } = 0; +} diff --git a/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs b/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs index 1bb30478..8f49b90a 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/IAnnotation.cs @@ -11,4 +11,12 @@ public interface IAnnotation double Left { get; } double Top { get; } + + Color? BackgroundColor { get; } + + Color? BorderColor { get; } + + string? BorderStyle { get; } + + int? BorderWidth { get; } } diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 380644e5..1c6fb8c4 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -152,7 +152,19 @@ "MainPageTitle": null, "AnnotationParams": { "Background": { - "Margin": 0.20 + "Margin": 0.20, + "BackgroundColor": { + "R": 222, + "G": 220, + "B": 215 + }, + "BorderColor": { + "R": 204, + "G": 202, + "B": 198 + }, + "BorderStyle": "underline", + "BorderWidth": 4 }, "DefaultAnnotation": { "Width": 1, diff --git a/EnvelopeGenerator.Web/wwwroot/js/annotation.js b/EnvelopeGenerator.Web/wwwroot/js/annotation.js index d2fcde76..c5ddf54f 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/annotation.js +++ b/EnvelopeGenerator.Web/wwwroot/js/annotation.js @@ -5,21 +5,22 @@ async function createAnnotations(document, instance) { for(var element of document.elements) { const annotParams = await getAnnotationParams(element.left, element.top); const page = element.page - 1 - + //background if(annotParams.background){ + let background = annotParams.background; const id_background = PSPDFKit.generateInstantId(); const annotation_background = new PSPDFKit.Annotations.WidgetAnnotation({ id: id_background, pageIndex: page, formFieldName: id_background, - backgroundColor: new PSPDFKit.Color({ r: 222, g: 220, b: 215 }), + backgroundColor: background?.backgroundColor ? new PSPDFKit.Color(background.backgroundColor) : null, blendMode: 'normal', - boundingBox: new PSPDFKit.Geometry.Rect(annotParams.background), + boundingBox: new PSPDFKit.Geometry.Rect(background), fontSize: 8, - borderStyle: 'underline', - borderWidth: 4, - borderColor: new PSPDFKit.Color({ r: 204, g: 202, b: 198 }) + borderStyle: background.borderStyle, + borderWidth: background.borderWidth, + borderColor: background?.borderColor ? new PSPDFKit.Color(background.borderColor) : null }); const formFieldBackground = new PSPDFKit.FormFields.ButtonFormField({ From 2974ddb985df502ba60a0ef1cb148352ae207719 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 02:01:09 +0200 Subject: [PATCH 10/14] feat(ConfigController): add authorize attribute --- EnvelopeGenerator.Web/Controllers/ConfigController.cs | 2 ++ .../Models/Annotation/AnnotationParams.cs | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/EnvelopeGenerator.Web/Controllers/ConfigController.cs b/EnvelopeGenerator.Web/Controllers/ConfigController.cs index 8a4e6079..41a58e5e 100644 --- a/EnvelopeGenerator.Web/Controllers/ConfigController.cs +++ b/EnvelopeGenerator.Web/Controllers/ConfigController.cs @@ -1,4 +1,5 @@ using EnvelopeGenerator.Web.Models.Annotation; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; @@ -6,6 +7,7 @@ namespace EnvelopeGenerator.Web.Controllers; [Route("api/[controller]")] [ApiController] +[Authorize] public class ConfigController : ControllerBase { private readonly AnnotationParams _annotParams; diff --git a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs index 2bf4ff09..987a181c 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs @@ -36,20 +36,20 @@ public class AnnotationParams foreach (var annot in _annots) annot.Default = DefaultAnnotation; - foreach (var annot in _annots) + for (int i = 0; i < _annots.Count; i++) { #region set bound annotations // horizontal - if (annot.HorBoundAnnotName is string horBoundAnnotName) + if (_annots[i].HorBoundAnnotName is string horBoundAnnotName) if (TryGet(horBoundAnnotName, out var horBoundAnnot)) - annot.HorBoundAnnot = horBoundAnnot; + _annots[i].HorBoundAnnot = horBoundAnnot; else throw new InvalidOperationException($"{horBoundAnnotName} added as bound anotation. However, it is not defined."); // vertical - if (annot.VerBoundAnnotName is string verBoundAnnotName) + if (_annots[i].VerBoundAnnotName is string verBoundAnnotName) if (TryGet(verBoundAnnotName, out var verBoundAnnot)) - annot.VerBoundAnnot = verBoundAnnot; + _annots[i].VerBoundAnnot = verBoundAnnot; else throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined."); #endregion From 50796b22d954dfd7163e0e62581563560be3a2f8 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 02:10:18 +0200 Subject: [PATCH 11/14] refactor(network): convert getAnnotation params to async method --- EnvelopeGenerator.Web/wwwroot/js/network.js | 51 ++++++++++--------- .../wwwroot/js/network.min.js | 2 +- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.js b/EnvelopeGenerator.Web/wwwroot/js/network.js index 3f8ad38e..5948feee 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.js @@ -175,21 +175,21 @@ async function setLanguage(language) { 'Content-Type': 'application/json' } }) - .then(res => res.json()) - .then(langs => langs.includes(language)) - .catch(err => false); + .then(res => res.json()) + .then(langs => langs.includes(language)) + .catch(err => false); - if(hasLang) + if (hasLang) return await fetch(`/lang/${language}`, { method: 'POST', headers: { 'Content-Type': 'application/json' } }) - .then(response => { - if (response.redirected) - window.location.href = response.url; - else if (!response.ok) - return Promise.reject('Failed to set language'); - }); + .then(response => { + if (response.redirected) + window.location.href = response.url; + else if (!response.ok) + return Promise.reject('Failed to set language'); + }); } async function logout() { @@ -204,22 +204,23 @@ async function logout() { }); } -function getAnnotationParams(leftInInch = 0, topInInch = 0, inchToPointFactor = 72) { - return fetch(`${window.location.origin}/api/Config/Annotations`, { + +async function getAnnotationParams(leftInInch = 0, topInInch = 0, inchToPointFactor = 72) { + + const annotParams = await fetch(`${window.location.origin}/api/Config/Annotations`, { credentials: 'include', method: 'GET' }) - .then(res => res.json()) - .then(annotParams => { - for(var key in annotParams){ - var annot = annotParams[key]; - annot.width *= inchToPointFactor; - annot.height *= inchToPointFactor; - annot.left += leftInInch; - annot.left *= inchToPointFactor; - annot.top += topInInch; - annot.top *= inchToPointFactor; - } - return annotParams; - }); + .then(res => res.json()); + + for (var key in annotParams) { + var annot = annotParams[key]; + annot.width *= inchToPointFactor; + annot.height *= inchToPointFactor; + annot.left += leftInInch; + annot.left *= inchToPointFactor; + annot.top += topInInch; + annot.top *= inchToPointFactor; + } + return annotParams; } \ No newline at end of file diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.min.js b/EnvelopeGenerator.Web/wwwroot/js/network.min.js index f3dc9e20..d7be76b0 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.min.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.min.js @@ -1 +1 @@ -async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}function getAnnotationParams(n=0,t=0,i=72){return fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json()).then(r=>{var f,u;for(f in r)u=r[f],u.width*=i,u.height*=i,u.left+=n,u.left*=i,u.top+=t,u.top*=i;return r})}class Network{async getEnvelope(n){return this.getRequest(`/api/envelope/${n}`).then(this.wrapJsonResponse.bind(this))}async postEnvelope(n,t,i){return this.postRequest(`/api/envelope/${n}?index=${t}`,i).then(this.wrapJsonResponse.bind(this))}async getDocument(n,t){return this.getRequest(`/api/document/${n}?index=${t}`).then(this.wrapBinaryResponse.bind(this))}async openDocument(n){return this.postRequest(`/api/document/${n}`,{}).then(this.wrapJsonResponse.bind(this))}withCSRFToken(n){const t=getCSRFToken;let i=n.headers;return n.headers={...i,...t},n}getCSRFToken(){const n=document.getElementsByName("__RequestVerificationToken")[0].value;return{"X-XSRF-TOKEN":n}}getRequest(n){const t=this.getCSRFToken(),i={credentials:"include",method:"GET",headers:{...t}};return fetch(n,i)}postRequest(n,t){const i=this.getCSRFToken(),r={credentials:"include",method:"POST",headers:{...i,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(t)};return fetch(n,r)}async wrapJsonResponse(n){return await this.wrapResponse(n,async n=>await n.json())}async wrapBinaryResponse(n){return await this.wrapResponse(n,async n=>await n.arrayBuffer())}async wrapResponse(n,t){let i;if(n.status===200){const r=await t(n);i=new WrappedResponse(r,null)}else if(n.status===403){const t=await n.json();i=new WrappedResponse(null,t)}else i=new WrappedResponse(null,null);return i}}class WrappedResponse{constructor(n,t){this.data=n;this.error=t;this.fatal=n===null&&t===null}} \ No newline at end of file +async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n,r.left*=i,r.top+=t,r.top*=i;return u}class Network{async getEnvelope(n){return this.getRequest(`/api/envelope/${n}`).then(this.wrapJsonResponse.bind(this))}async postEnvelope(n,t,i){return this.postRequest(`/api/envelope/${n}?index=${t}`,i).then(this.wrapJsonResponse.bind(this))}async getDocument(n,t){return this.getRequest(`/api/document/${n}?index=${t}`).then(this.wrapBinaryResponse.bind(this))}async openDocument(n){return this.postRequest(`/api/document/${n}`,{}).then(this.wrapJsonResponse.bind(this))}withCSRFToken(n){const t=getCSRFToken;let i=n.headers;return n.headers={...i,...t},n}getCSRFToken(){const n=document.getElementsByName("__RequestVerificationToken")[0].value;return{"X-XSRF-TOKEN":n}}getRequest(n){const t=this.getCSRFToken(),i={credentials:"include",method:"GET",headers:{...t}};return fetch(n,i)}postRequest(n,t){const i=this.getCSRFToken(),r={credentials:"include",method:"POST",headers:{...i,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(t)};return fetch(n,r)}async wrapJsonResponse(n){return await this.wrapResponse(n,async n=>await n.json())}async wrapBinaryResponse(n){return await this.wrapResponse(n,async n=>await n.arrayBuffer())}async wrapResponse(n,t){let i;if(n.status===200){const r=await t(n);i=new WrappedResponse(r,null)}else if(n.status===403){const t=await n.json();i=new WrappedResponse(null,t)}else i=new WrappedResponse(null,null);return i}}class WrappedResponse{constructor(n,t){this.data=n;this.error=t;this.fatal=n===null&&t===null}} \ No newline at end of file From 4bf91df85f2d5effb1043580b9a5cfa21594a188 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 02:11:12 +0200 Subject: [PATCH 12/14] fx(network): add bias to left position --- EnvelopeGenerator.Web/wwwroot/js/network.js | 2 +- EnvelopeGenerator.Web/wwwroot/js/network.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.js b/EnvelopeGenerator.Web/wwwroot/js/network.js index 5948feee..b7bb4fcf 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.js @@ -217,7 +217,7 @@ async function getAnnotationParams(leftInInch = 0, topInInch = 0, inchToPointFac var annot = annotParams[key]; annot.width *= inchToPointFactor; annot.height *= inchToPointFactor; - annot.left += leftInInch; + annot.left += leftInInch - 0.7; annot.left *= inchToPointFactor; annot.top += topInInch; annot.top *= inchToPointFactor; diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.min.js b/EnvelopeGenerator.Web/wwwroot/js/network.min.js index d7be76b0..5dde97de 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.min.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.min.js @@ -1 +1 @@ -async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n,r.left*=i,r.top+=t,r.top*=i;return u}class Network{async getEnvelope(n){return this.getRequest(`/api/envelope/${n}`).then(this.wrapJsonResponse.bind(this))}async postEnvelope(n,t,i){return this.postRequest(`/api/envelope/${n}?index=${t}`,i).then(this.wrapJsonResponse.bind(this))}async getDocument(n,t){return this.getRequest(`/api/document/${n}?index=${t}`).then(this.wrapBinaryResponse.bind(this))}async openDocument(n){return this.postRequest(`/api/document/${n}`,{}).then(this.wrapJsonResponse.bind(this))}withCSRFToken(n){const t=getCSRFToken;let i=n.headers;return n.headers={...i,...t},n}getCSRFToken(){const n=document.getElementsByName("__RequestVerificationToken")[0].value;return{"X-XSRF-TOKEN":n}}getRequest(n){const t=this.getCSRFToken(),i={credentials:"include",method:"GET",headers:{...t}};return fetch(n,i)}postRequest(n,t){const i=this.getCSRFToken(),r={credentials:"include",method:"POST",headers:{...i,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(t)};return fetch(n,r)}async wrapJsonResponse(n){return await this.wrapResponse(n,async n=>await n.json())}async wrapBinaryResponse(n){return await this.wrapResponse(n,async n=>await n.arrayBuffer())}async wrapResponse(n,t){let i;if(n.status===200){const r=await t(n);i=new WrappedResponse(r,null)}else if(n.status===403){const t=await n.json();i=new WrappedResponse(null,t)}else i=new WrappedResponse(null,null);return i}}class WrappedResponse{constructor(n,t){this.data=n;this.error=t;this.fatal=n===null&&t===null}} \ No newline at end of file +async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n-.7,r.left*=i,r.top+=t,r.top*=i;return u}class Network{async getEnvelope(n){return this.getRequest(`/api/envelope/${n}`).then(this.wrapJsonResponse.bind(this))}async postEnvelope(n,t,i){return this.postRequest(`/api/envelope/${n}?index=${t}`,i).then(this.wrapJsonResponse.bind(this))}async getDocument(n,t){return this.getRequest(`/api/document/${n}?index=${t}`).then(this.wrapBinaryResponse.bind(this))}async openDocument(n){return this.postRequest(`/api/document/${n}`,{}).then(this.wrapJsonResponse.bind(this))}withCSRFToken(n){const t=getCSRFToken;let i=n.headers;return n.headers={...i,...t},n}getCSRFToken(){const n=document.getElementsByName("__RequestVerificationToken")[0].value;return{"X-XSRF-TOKEN":n}}getRequest(n){const t=this.getCSRFToken(),i={credentials:"include",method:"GET",headers:{...t}};return fetch(n,i)}postRequest(n,t){const i=this.getCSRFToken(),r={credentials:"include",method:"POST",headers:{...i,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(t)};return fetch(n,r)}async wrapJsonResponse(n){return await this.wrapResponse(n,async n=>await n.json())}async wrapBinaryResponse(n){return await this.wrapResponse(n,async n=>await n.arrayBuffer())}async wrapResponse(n,t){let i;if(n.status===200){const r=await t(n);i=new WrappedResponse(r,null)}else if(n.status===403){const t=await n.json();i=new WrappedResponse(null,t)}else i=new WrappedResponse(null,null);return i}}class WrappedResponse{constructor(n,t){this.data=n;this.error=t;this.fatal=n===null&&t===null}} \ No newline at end of file From 7c57b7e33254589f9e0a9877abb6a156ada60b78 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 02:23:22 +0200 Subject: [PATCH 13/14] refactor(network): add bias to annot.top --- EnvelopeGenerator.Web/wwwroot/js/network.js | 2 +- EnvelopeGenerator.Web/wwwroot/js/network.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.js b/EnvelopeGenerator.Web/wwwroot/js/network.js index b7bb4fcf..327f5910 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.js @@ -219,7 +219,7 @@ async function getAnnotationParams(leftInInch = 0, topInInch = 0, inchToPointFac annot.height *= inchToPointFactor; annot.left += leftInInch - 0.7; annot.left *= inchToPointFactor; - annot.top += topInInch; + annot.top += topInInch - 0.5; annot.top *= inchToPointFactor; } return annotParams; diff --git a/EnvelopeGenerator.Web/wwwroot/js/network.min.js b/EnvelopeGenerator.Web/wwwroot/js/network.min.js index 5dde97de..b5d07c01 100644 --- a/EnvelopeGenerator.Web/wwwroot/js/network.min.js +++ b/EnvelopeGenerator.Web/wwwroot/js/network.min.js @@ -1 +1 @@ -async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n-.7,r.left*=i,r.top+=t,r.top*=i;return u}class Network{async getEnvelope(n){return this.getRequest(`/api/envelope/${n}`).then(this.wrapJsonResponse.bind(this))}async postEnvelope(n,t,i){return this.postRequest(`/api/envelope/${n}?index=${t}`,i).then(this.wrapJsonResponse.bind(this))}async getDocument(n,t){return this.getRequest(`/api/document/${n}?index=${t}`).then(this.wrapBinaryResponse.bind(this))}async openDocument(n){return this.postRequest(`/api/document/${n}`,{}).then(this.wrapJsonResponse.bind(this))}withCSRFToken(n){const t=getCSRFToken;let i=n.headers;return n.headers={...i,...t},n}getCSRFToken(){const n=document.getElementsByName("__RequestVerificationToken")[0].value;return{"X-XSRF-TOKEN":n}}getRequest(n){const t=this.getCSRFToken(),i={credentials:"include",method:"GET",headers:{...t}};return fetch(n,i)}postRequest(n,t){const i=this.getCSRFToken(),r={credentials:"include",method:"POST",headers:{...i,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(t)};return fetch(n,r)}async wrapJsonResponse(n){return await this.wrapResponse(n,async n=>await n.json())}async wrapBinaryResponse(n){return await this.wrapResponse(n,async n=>await n.arrayBuffer())}async wrapResponse(n,t){let i;if(n.status===200){const r=await t(n);i=new WrappedResponse(r,null)}else if(n.status===403){const t=await n.json();i=new WrappedResponse(null,t)}else i=new WrappedResponse(null,null);return i}}class WrappedResponse{constructor(n,t){this.data=n;this.error=t;this.fatal=n===null&&t===null}} \ No newline at end of file +async function setLangAsync(n,t){document.getElementById("selectedFlag").className="fi "+t+" me-2";await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}})}async function setLanguage(n){const t=await fetch("/lang",{method:"GET",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(t=>t.includes(n)).catch(()=>!1);if(t)return await fetch(`/lang/${n}`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{if(n.redirected)window.location.href=n.url;else if(!n.ok)return Promise.reject("Failed to set language")})}async function logout(){return await fetch(`/auth/logout`,{method:"POST",headers:{"Content-Type":"application/json"}}).then(n=>{n.ok&&(window.location.href="/")})}async function getAnnotationParams(n=0,t=0,i=72){var f,r;const u=await fetch(`${window.location.origin}/api/Config/Annotations`,{credentials:"include",method:"GET"}).then(n=>n.json());for(f in u)r=u[f],r.width*=i,r.height*=i,r.left+=n-.7,r.left*=i,r.top+=t-.5,r.top*=i;return u}class Network{async getEnvelope(n){return this.getRequest(`/api/envelope/${n}`).then(this.wrapJsonResponse.bind(this))}async postEnvelope(n,t,i){return this.postRequest(`/api/envelope/${n}?index=${t}`,i).then(this.wrapJsonResponse.bind(this))}async getDocument(n,t){return this.getRequest(`/api/document/${n}?index=${t}`).then(this.wrapBinaryResponse.bind(this))}async openDocument(n){return this.postRequest(`/api/document/${n}`,{}).then(this.wrapJsonResponse.bind(this))}withCSRFToken(n){const t=getCSRFToken;let i=n.headers;return n.headers={...i,...t},n}getCSRFToken(){const n=document.getElementsByName("__RequestVerificationToken")[0].value;return{"X-XSRF-TOKEN":n}}getRequest(n){const t=this.getCSRFToken(),i={credentials:"include",method:"GET",headers:{...t}};return fetch(n,i)}postRequest(n,t){const i=this.getCSRFToken(),r={credentials:"include",method:"POST",headers:{...i,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(t)};return fetch(n,r)}async wrapJsonResponse(n){return await this.wrapResponse(n,async n=>await n.json())}async wrapBinaryResponse(n){return await this.wrapResponse(n,async n=>await n.arrayBuffer())}async wrapResponse(n,t){let i;if(n.status===200){const r=await t(n);i=new WrappedResponse(r,null)}else if(n.status===403){const t=await n.json();i=new WrappedResponse(null,t)}else i=new WrappedResponse(null,null);return i}}class WrappedResponse{constructor(n,t){this.data=n;this.error=t;this.fatal=n===null&&t===null}} \ No newline at end of file From 784a8342147564e11b4d2cc6942b5ab1744a195e Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 24 Apr 2025 09:28:27 +0200 Subject: [PATCH 14/14] =?UTF-8?q?chore:=20auf=203.1.2=20aufger=C3=BCstet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj b/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj index 7b50de3b..761e4780 100644 --- a/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj +++ b/EnvelopeGenerator.Web/EnvelopeGenerator.Web.csproj @@ -5,7 +5,7 @@ enable enable EnvelopeGenerator.Web - 3.1.1 + 3.1.2 Digital Data GmbH Digital Data GmbH EnvelopeGenerator.Web @@ -13,8 +13,8 @@ digital data envelope generator web EnvelopeGenerator.Web is an ASP.NET MVC application developed to manage signing processes. It uses Entity Framework Core (EF Core) for database operations. The user interface for signing processes is developed with Razor View Engine (.cshtml files) and JavaScript under wwwroot, integrated with PSPDFKit. This integration allows users to view and sign documents seamlessly. Assets\icon.ico - 3.1.1 - 3.1.1 + 3.1.2 + 3.1.2 Copyright © 2025 Digital Data GmbH. All rights reserved.