fix(pdf-burner): Korrektur des Versatzes von Siegelbildern für Tintenunterschriften

- Hinzufügen des Parameters „yOffset“ zu „AddImageAnnotation“, um die Position der Siegel anzupassen.
- Aktualisierung von „AddInstantJSONAnnotationToPDF“, um den Versatz für das erste Unterschriftssiegel anzuwenden.
- Stellt sicher, dass Tintenunterschriftssiegel in PDF-Dateien korrekt dargestellt werden, ohne andere Anmerkungen zu beeinträchtigen.
This commit is contained in:
tekh 2025-09-05 13:25:25 +02:00
parent fa8d2f5f62
commit 59105caffc

View File

@ -70,21 +70,18 @@ Namespace Jobs.FinalizeDocument
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
oAnnotationData.annotations.Reverse()
Dim annotCountPerSign = 5
Dim annotIndex = 1
Dim calcSignIndex = Function() CInt(Math.Ceiling(CDbl(annotIndex) / CDbl(annotCountPerSign)))
Dim calcAnnotIndexInSign = Function() (annotIndex - 1) Mod annotCountPerSign + 1
Dim sigAnnotType = oAnnotationData.annotations.ElementAt(1).type
Dim isSeal = True 'First element is signature seal
Dim formFieldIndex = 0
For Each oAnnotation In oAnnotationData.annotations
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
Dim signIndex = calcSignIndex()
Dim annotIndexInSign = calcAnnotIndexInSign()
Select Case oAnnotation.type
Case ANNOTATION_TYPE_IMAGE
AddImageAnnotation(oAnnotation, oAnnotationData.attachments)
'Add offset to solve the seal position problem in ink signatures
Dim yOffset As Double = If(isSeal And sigAnnotType = ANNOTATION_TYPE_INK, 0.16, 0)
AddImageAnnotation(oAnnotation, oAnnotationData.attachments, yOffset)
Case ANNOTATION_TYPE_INK
AddInkAnnotation(oAnnotation)
@ -98,7 +95,7 @@ Namespace Jobs.FinalizeDocument
End If
End Select
annotIndex += 1
isSeal = False
Next
Return True
@ -109,7 +106,7 @@ Namespace Jobs.FinalizeDocument
End Try
End Function
Private Function AddImageAnnotation(pAnnotation As Annotation, pAttachments As Dictionary(Of String, Attachment)) As Boolean
Private Function AddImageAnnotation(pAnnotation As Annotation, pAttachments As Dictionary(Of String, Attachment), Optional yOffset As Double = 0) As Boolean
Try
Dim oAttachment = pAttachments.Where(Function(a) a.Key = pAnnotation.imageAttachmentId).
SingleOrDefault()
@ -118,7 +115,7 @@ Namespace Jobs.FinalizeDocument
Dim oBounds = pAnnotation.bbox.Select(AddressOf ToInches).ToList()
Dim oX = oBounds.Item(0)
Dim oY = oBounds.Item(1)
Dim oY = oBounds.Item(1) + yOffset
Dim oWidth = oBounds.Item(2)
Dim oHeight = oBounds.Item(3)