refactor(Annotations.js): Hinzufügen von Container-Widget-Annotationen als Hintergrund von Annotationen ohne BoundingBox-Konfiguration.

- Konvertieren von Signaturen Hintergrundfarbe von gelb zu hellgelb.
This commit is contained in:
Developer 02 2025-04-23 13:38:32 +02:00
parent 5f8df74b9d
commit 13a87f29d9

View File

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