Compare commits
3 Commits
57422a481c
...
1f745ae79c
| Author | SHA1 | Date | |
|---|---|---|---|
| 1f745ae79c | |||
| ce7ca39c39 | |||
| 7b6f916486 |
@@ -1,11 +1,12 @@
|
|||||||
Imports System.Drawing
|
Imports System.Collections.Immutable
|
||||||
|
Imports System.Drawing
|
||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
Imports DevExpress.DataProcessing
|
||||||
Imports DigitalData.Modules.Base
|
Imports DigitalData.Modules.Base
|
||||||
Imports DigitalData.Modules.Logging
|
Imports DigitalData.Modules.Logging
|
||||||
|
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
||||||
Imports GdPicture14
|
Imports GdPicture14
|
||||||
Imports Newtonsoft.Json
|
Imports Newtonsoft.Json
|
||||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
|
||||||
Imports DevExpress.DataProcessing
|
|
||||||
|
|
||||||
Namespace Jobs.FinalizeDocument
|
Namespace Jobs.FinalizeDocument
|
||||||
Public Class PDFBurner
|
Public Class PDFBurner
|
||||||
@@ -68,6 +69,14 @@ Namespace Jobs.FinalizeDocument
|
|||||||
End Using
|
End Using
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Shared ReadOnly FormFieldIndex As New Dictionary(Of String, Integer) From {
|
||||||
|
{FieldNames.NoName, 0},
|
||||||
|
{"signature", 1},
|
||||||
|
{"position", 2},
|
||||||
|
{"city", 3},
|
||||||
|
{"date", 4}
|
||||||
|
}
|
||||||
|
|
||||||
Private Sub AddInstantJSONAnnotationToPDF(pInstantJSON As String)
|
Private Sub AddInstantJSONAnnotationToPDF(pInstantJSON As String)
|
||||||
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
|
Dim oAnnotationData = JsonConvert.DeserializeObject(Of AnnotationData)(pInstantJSON)
|
||||||
|
|
||||||
@@ -75,7 +84,6 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Dim yPosOfSigAnnot = oAnnotationData.annotations.ElementAt(2).bbox.ElementAt(1) - 71.84002685546875 + 7
|
Dim yPosOfSigAnnot = oAnnotationData.annotations.ElementAt(2).bbox.ElementAt(1) - 71.84002685546875 + 7
|
||||||
Dim isSeal = True 'First element is signature seal
|
Dim isSeal = True 'First element is signature seal
|
||||||
|
|
||||||
Dim formFieldIndex = 0
|
|
||||||
For Each oAnnotation In oAnnotationData.annotations
|
For Each oAnnotation In oAnnotationData.annotations
|
||||||
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
|
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
|
||||||
|
|
||||||
@@ -97,13 +105,13 @@ Namespace Jobs.FinalizeDocument
|
|||||||
'Add form field values
|
'Add form field values
|
||||||
Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id)
|
Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id)
|
||||||
If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then
|
If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then
|
||||||
AddFormFieldValue(oAnnotation, formFieldValue, formFieldIndex)
|
AddFormFieldValue(oAnnotation, formFieldValue)
|
||||||
formFieldIndex += 1
|
|
||||||
End If
|
End If
|
||||||
Exit Select
|
Exit Select
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
isSeal = False
|
isSeal = False
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -138,12 +146,15 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Next
|
Next
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function AddFormFieldValue(pAnnotation As Annotation, formFieldValue As FormFieldValue, index As Integer) As Void
|
Private Function AddFormFieldValue(pAnnotation As Annotation, formFieldValue As FormFieldValue) As Void
|
||||||
|
|
||||||
|
Dim index As Integer = FormFieldIndex(pAnnotation.fieldName)
|
||||||
|
|
||||||
' Convert pixels to Inches
|
' Convert pixels to Inches
|
||||||
Dim oBounds = pAnnotation.bbox.Select(AddressOf ToInches).ToList()
|
Dim oBounds = pAnnotation.bbox.Select(AddressOf ToInches).ToList()
|
||||||
|
|
||||||
Dim oX = oBounds.Item(0)
|
Dim oX = oBounds.Item(0)
|
||||||
Dim oY = oBounds.Item(1) + _pdfBurnerParams.YOffset * index + _pdfBurnerParams.TopMargin
|
Dim oY = oBounds.Item(1) + _pdfBurnerParams.YOffset * Index + _pdfBurnerParams.TopMargin
|
||||||
Dim oWidth = oBounds.Item(2)
|
Dim oWidth = oBounds.Item(2)
|
||||||
Dim oHeight = oBounds.Item(3)
|
Dim oHeight = oBounds.Item(3)
|
||||||
|
|
||||||
@@ -206,10 +217,21 @@ Namespace Jobs.FinalizeDocument
|
|||||||
|
|
||||||
Public index As Integer = Nothing
|
Public index As Integer = Nothing
|
||||||
|
|
||||||
Public internalType As String = Nothing
|
Public fieldName As String = FieldNames.NoName
|
||||||
|
|
||||||
Public hasStructuredID As Boolean = False
|
Public hasStructuredID As Boolean = False
|
||||||
|
|
||||||
|
Public ReadOnly Property isLabel As Boolean
|
||||||
|
Get
|
||||||
|
If String.IsNullOrEmpty(fieldName) Then
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim parts As String() = fieldName.Split("_"c)
|
||||||
|
Return parts.Length > 1 AndAlso parts(1) = "label"
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
Public Property id As String
|
Public Property id As String
|
||||||
Get
|
Get
|
||||||
Return _id
|
Return _id
|
||||||
@@ -240,21 +262,31 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Throw New BurnAnnotationException($"The index of annotation is not integer. Id: {_id}")
|
Throw New BurnAnnotationException($"The index of annotation is not integer. Id: {_id}")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
internalType = parts(3)
|
fieldName = parts(3)
|
||||||
|
|
||||||
hasStructuredID = True
|
hasStructuredID = True
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
Public Property bbox As List(Of Double)
|
Public Property bbox As List(Of Double)
|
||||||
|
|
||||||
Public Property type As String
|
Public Property type As String
|
||||||
|
|
||||||
Public Property isSignature As Boolean
|
Public Property isSignature As Boolean
|
||||||
|
|
||||||
Public Property imageAttachmentId As String
|
Public Property imageAttachmentId As String
|
||||||
|
|
||||||
Public Property lines As Lines
|
Public Property lines As Lines
|
||||||
|
|
||||||
Public Property pageIndex As Integer
|
Public Property pageIndex As Integer
|
||||||
|
|
||||||
Public Property strokeColor As String
|
Public Property strokeColor As String
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
Public Class FieldNames
|
||||||
|
Public Shared ReadOnly NoName As String = Guid.NewGuid().ToString()
|
||||||
|
End Class
|
||||||
|
|
||||||
Friend Class Lines
|
Friend Class Lines
|
||||||
Public Property points As List(Of List(Of List(Of Single)))
|
Public Property points As List(Of List(Of List(Of Single)))
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user