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 DevExpress.DataProcessing
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
||||
Imports GdPicture14
|
||||
Imports Newtonsoft.Json
|
||||
Imports EnvelopeGenerator.CommonServices.Jobs.FinalizeDocument.FinalizeDocumentExceptions
|
||||
Imports DevExpress.DataProcessing
|
||||
|
||||
Namespace Jobs.FinalizeDocument
|
||||
Public Class PDFBurner
|
||||
@@ -68,6 +69,14 @@ Namespace Jobs.FinalizeDocument
|
||||
End Using
|
||||
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)
|
||||
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 isSeal = True 'First element is signature seal
|
||||
|
||||
Dim formFieldIndex = 0
|
||||
For Each oAnnotation In oAnnotationData.annotations
|
||||
Logger.Debug("Adding AnnotationID: " + oAnnotation.id)
|
||||
|
||||
@@ -97,13 +105,13 @@ Namespace Jobs.FinalizeDocument
|
||||
'Add form field values
|
||||
Dim formFieldValue = oAnnotationData.formFieldValues.FirstOrDefault(Function(fv) fv.name = oAnnotation.id)
|
||||
If formFieldValue IsNot Nothing AndAlso Not _pdfBurnerParams.IgnoredLabels.Contains(formFieldValue.value) Then
|
||||
AddFormFieldValue(oAnnotation, formFieldValue, formFieldIndex)
|
||||
formFieldIndex += 1
|
||||
AddFormFieldValue(oAnnotation, formFieldValue)
|
||||
End If
|
||||
Exit Select
|
||||
End Select
|
||||
|
||||
isSeal = False
|
||||
|
||||
Next
|
||||
|
||||
End Sub
|
||||
@@ -138,12 +146,15 @@ Namespace Jobs.FinalizeDocument
|
||||
Next
|
||||
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
|
||||
Dim oBounds = pAnnotation.bbox.Select(AddressOf ToInches).ToList()
|
||||
|
||||
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 oHeight = oBounds.Item(3)
|
||||
|
||||
@@ -206,10 +217,21 @@ Namespace Jobs.FinalizeDocument
|
||||
|
||||
Public index As Integer = Nothing
|
||||
|
||||
Public internalType As String = Nothing
|
||||
Public fieldName As String = FieldNames.NoName
|
||||
|
||||
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
|
||||
Get
|
||||
Return _id
|
||||
@@ -240,21 +262,31 @@ Namespace Jobs.FinalizeDocument
|
||||
Throw New BurnAnnotationException($"The index of annotation is not integer. Id: {_id}")
|
||||
End If
|
||||
|
||||
internalType = parts(3)
|
||||
fieldName = parts(3)
|
||||
|
||||
hasStructuredID = True
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Property bbox As List(Of Double)
|
||||
|
||||
Public Property type As String
|
||||
|
||||
Public Property isSignature As Boolean
|
||||
|
||||
Public Property imageAttachmentId As String
|
||||
|
||||
Public Property lines As Lines
|
||||
|
||||
Public Property pageIndex As Integer
|
||||
|
||||
Public Property strokeColor As String
|
||||
End Class
|
||||
|
||||
Public Class FieldNames
|
||||
Public Shared ReadOnly NoName As String = Guid.NewGuid().ToString()
|
||||
End Class
|
||||
|
||||
Friend Class Lines
|
||||
Public Property points As List(Of List(Of List(Of Single)))
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user