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:
parent
8b505ae39a
commit
54f39103e1
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
10
EnvelopeGenerator.Web/Models/Annotation/Color.cs
Normal file
10
EnvelopeGenerator.Web/Models/Annotation/Color.cs
Normal 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;
|
||||
}
|
||||
@ -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; }
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user