This commit is contained in:
2024-06-25 08:42:49 +02:00
50 changed files with 239 additions and 168 deletions

View File

@@ -32,6 +32,7 @@
Public Property History As New List(Of EnvelopeHistoryEntry)
Public Property EnvelopeType As EnvelopeType
Public Property DOC_RESULT As Byte()
Public Property Doc1 As Byte()
Public ReadOnly Property EnvelopeTypeTitle As String
Get

View File

@@ -15,6 +15,7 @@ Namespace Jobs.FinalizeDocument
Private Const ANNOTATION_TYPE_IMAGE = "pspdfkit/image"
Private Const ANNOTATION_TYPE_INK = "pspdfkit/ink"
Private Const ANNOTATION_TYPE_WIDGET = "pspdfkit/widget"
Public Sub New(pLogConfig As LogConfig, pGDPictureLicenseKey As String)
MyBase.New(pLogConfig)
@@ -77,6 +78,12 @@ Namespace Jobs.FinalizeDocument
Case ANNOTATION_TYPE_INK
AddInkAnnotation(oAnnotation)
Case ANNOTATION_TYPE_WIDGET
'Add form field values
Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id)
If formFieldValue IsNot Nothing Then
AddFormFieldValue(oAnnotation, formFieldValue)
End If
End Select
Next
@@ -137,6 +144,33 @@ Namespace Jobs.FinalizeDocument
End Function
Private Function AddFormFieldValue(pAnnotation As Annotation, formFieldValue As FormFieldValue) As Boolean
Try
' 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)
Manager.SelectPage(pAnnotation.pageIndex + 1)
' Add the text annotation
Dim ant = Manager.AddTextAnnot(oX, oY, oWidth, oHeight, formFieldValue.value)
' Set the font properties
ant.FontName = "Arial"
ant.FontSize = 8
ant.FontStyle = FontStyle.Italic
Manager.SaveAnnotationsToPage()
Return True
Catch ex As Exception
Logger.Warn("Could not add image annotation!")
Logger.Error(ex)
Return False
End Try
End Function
Private Function ToPointF(pPoints As List(Of Single)) As PointF
Dim oPoints = pPoints.Select(AddressOf ToInches).ToList()
Return New PointF(oPoints.Item(0), oPoints.Item(1))
@@ -153,6 +187,7 @@ Namespace Jobs.FinalizeDocument
Friend Class AnnotationData
Public Property annotations As List(Of Annotation)
Public Property attachments As Dictionary(Of String, Attachment)
Public Property formFieldValues As List(Of FormFieldValue)
End Class
Friend Class Annotation
@@ -174,5 +209,10 @@ Namespace Jobs.FinalizeDocument
Public Property binary As String
Public Property contentType As String
End Class
Friend Class FormFieldValue
Public Property name As String
Public Property value As String
End Class
End Class
End Namespace