feat(IAnnotation): Hinzufügen und Implementieren der Eigenschaften BackgroundColor, BorderColor, BorderStyle und BorderWidth.

- Hintergrund mit neuen Eigenschaften in Annotations.js binden
This commit is contained in:
Developer 02 2025-04-24 00:36:24 +02:00
parent 8b505ae39a
commit 54f39103e1
6 changed files with 58 additions and 7 deletions

View File

@ -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
{

View File

@ -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<IAnnotation> annotations)
{
// set Top

View File

@ -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;
}

View File

@ -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; }
}

View File

@ -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,

View File

@ -8,18 +8,19 @@ async function createAnnotations(document, instance) {
//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({