Logging wegen Y-Konstante

This commit is contained in:
Developer01
2025-09-04 14:35:54 +02:00
parent b8c00884a9
commit 85e0bc3400
5 changed files with 252 additions and 225 deletions

View File

@@ -123,6 +123,7 @@ Namespace Jobs
Throw New ArgumentNullException("EnvelopeData")
End If
Logger.Debug("Burning Annotations to pdf ...")
Dim oBurnedDocument As Byte() = BurnAnnotationsToPdf(oEnvelopeData)
If oBurnedDocument Is Nothing Then
Logger.Warn("Document could not be finalized!")

View File

@@ -16,6 +16,8 @@ Namespace Jobs.FinalizeDocument
Private Const ANNOTATION_TYPE_IMAGE = "pspdfkit/image"
Private Const ANNOTATION_TYPE_INK = "pspdfkit/ink"
Private Const ANNOTATION_TYPE_WIDGET = "pspdfkit/widget"
Private Annotationheight_min As Double = 0
Private Annotationheight_max As Double = 0
Private Property _pdfBurnerParams As PDFBurnerParams
Public Sub New(pLogConfig As LogConfig, pGDPictureLicenseKey As String, pdfBurnerParams As PDFBurnerParams)
@@ -69,12 +71,14 @@ Namespace Jobs.FinalizeDocument
Try
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
oAnnotationData.annotations.Reverse()
Dim formFieldIndex = 0
Dim formFieldIndex = 0, AnnotationIndex = 0, AnnotationImageIndex = 0
For Each oAnnotation In oAnnotationData.annotations
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
AnnotationIndex += 1
Logger.Debug("Adding AnnotationID: " + oAnnotation.id + " -Index: " + AnnotationIndex.ToString)
Select Case oAnnotation.type
Case ANNOTATION_TYPE_IMAGE
AddImageAnnotation(oAnnotation, oAnnotationData.attachments)
AnnotationImageIndex += 1
AddImageAnnotation(AnnotationImageIndex, oAnnotation, oAnnotationData.attachments)
Case ANNOTATION_TYPE_INK
AddInkAnnotation(oAnnotation)
@@ -98,19 +102,26 @@ Namespace Jobs.FinalizeDocument
End Try
End Function
Private Function AddImageAnnotation(pAnnotation As Annotation, pAttachments As Dictionary(Of String, Attachment)) As Boolean
Private Function AddImageAnnotation(pidX As Integer, pAnnotation As Annotation, pAttachments As Dictionary(Of String, Attachment)) As Boolean
Try
Dim oAttachment = pAttachments.Where(Function(a) a.Key = pAnnotation.imageAttachmentId).
SingleOrDefault()
' Convert pixels to Inches
Dim oBounds = pAnnotation.bbox.Select(AddressOf ToInches).ToList()
Dim oX = oBounds.Item(0)
Dim oY = oBounds.Item(1)
Dim oWidth = oBounds.Item(2)
Dim oHeight = oBounds.Item(3)
If pidX = 1 Then
If Annotationheight_min = 0 Then
Annotationheight_min = oHeight
Annotationheight_min = oHeight
End If
End If
Manager.SelectPage(pAnnotation.pageIndex + 1)
Manager.AddEmbeddedImageAnnotFromBase64(oAttachment.Value.binary, oX, oY, oWidth, oHeight)