diff --git a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb index f5f3cc6d..83155e46 100644 --- a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb +++ b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb @@ -76,35 +76,35 @@ Namespace Jobs.FinalizeDocument Dim isSeal = True 'First element is signature seal Dim formFieldIndex = 0 - For Each oAnnotation In oAnnotationData.annotations - Logger.Debug("Adding AnnotationID: " + oAnnotation.id) + For Each oAnnotation In oAnnotationData.annotations + Logger.Debug("Adding AnnotationID: " + oAnnotation.id) - Select Case oAnnotation.type - Case ANNOTATION_TYPE_IMAGE + Select Case oAnnotation.type + Case ANNOTATION_TYPE_IMAGE - If (isSeal) Then - oAnnotation.bbox.Item(1) = yPosOfSigAnnot - End If + If (isSeal) Then + oAnnotation.bbox.Item(1) = yPosOfSigAnnot + End If - AddImageAnnotation(oAnnotation, oAnnotationData.attachments) - Exit Select + AddImageAnnotation(oAnnotation, oAnnotationData.attachments) + Exit Select - Case ANNOTATION_TYPE_INK - AddInkAnnotation(oAnnotation) - Exit Select + Case ANNOTATION_TYPE_INK + AddInkAnnotation(oAnnotation) + Exit Select - Case ANNOTATION_TYPE_WIDGET - '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 - End If - Exit Select - End Select + Case ANNOTATION_TYPE_WIDGET + '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 + End If + Exit Select + End Select - isSeal = False - Next + isSeal = False + Next End Sub Private Function AddImageAnnotation(pAnnotation As Annotation, pAttachments As Dictionary(Of String, Attachment)) As Void @@ -193,7 +193,50 @@ Namespace Jobs.FinalizeDocument End Class Friend Class Annotation + + Private _id As Integer + + Public envelopeId As Integer + + Public receiverId As Integer + + Public index As Integer + + Public internalType As String + Public Property id As String + Get + Return _id + End Get + Set(value As String) + _id = value + + If String.IsNullOrWhiteSpace(id) Then + Throw New BurnAnnotationException("The identifier of annotation is null or empty.") + End If + + Dim parts As String() = value.Split("-"c) + + If (parts.Length <> 4) Then + Throw New BurnAnnotationException($"The identifier of annotation has more or less than 4 sub-part. Id: {_id}") + End If + + If Not Integer.TryParse(parts(0), envelopeId) Then + Throw New BurnAnnotationException($"The envelope ID of annotation is not integer. Id: {_id}") + End If + + If Not Integer.TryParse(parts(1), receiverId) Then + Throw New BurnAnnotationException($"The receiver ID of annotation is not integer. Id: {_id}") + End If + + If Not Integer.TryParse(parts(2), index) Then + Throw New BurnAnnotationException($"The index of annotation is not integer. Id: {_id}") + End If + + internalType = parts(3) + End Set + End Property + Public Property bbox As List(Of Double) Public Property type As String Public Property isSignature As Boolean