From 75e47d10e3ffadadf5b52cec232a65bfe9f1194e Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 28 Oct 2025 10:06:38 +0100 Subject: [PATCH] feat(pdfburner): add ink annotation support and refactor annotation handling - Added new AddInkAnnotation(page As Integer, value As String) method to handle ink annotations from element data. - Introduced new Ink model class for deserializing ink annotation data (lines and strokeColor). - Updated BurnElementAnnotsToPDF to support Ink annotation type. - Refactored annotation type handling for better extensibility. - Improved annotation burning logic for mixed annotation types (form fields, images, inks). --- .../Jobs/FinalizeDocument/PDFBurner.vb | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb index e6c5fed2..23d2aa4b 100644 --- a/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb +++ b/EnvelopeGenerator.CommonServices/Jobs/FinalizeDocument/PDFBurner.vb @@ -64,6 +64,8 @@ Namespace Jobs.FinalizeDocument AddFormFieldValue(annot.Name, x, y, 100, 180, element.Page, annot.Value) ElseIf annot.Type = AnnotationType.FormField Then AddImageAnnotation(x, y, 100, 180, element.Page, annot.Value) + ElseIf annot.Type = AnnotationType.Ink Then + AddInkAnnotation(element.Page, annot.Value) End If Next Next @@ -158,6 +160,23 @@ Namespace Jobs.FinalizeDocument Manager.AddEmbeddedImageAnnotFromBase64(oAttachment.Value.binary, oX, oY, oWidth, oHeight) End Sub + Private Sub AddInkAnnotation(page As Integer, value As String) + + Dim ink = JsonConvert.DeserializeObject(Of Ink)(value) + + Dim oSegments = ink.lines.points + Dim oColor = ColorTranslator.FromHtml(ink.strokeColor) + Manager.SelectPage(page + 1) + + For Each oSegment As List(Of List(Of Single)) In oSegments + Dim oPoints = oSegment. + Select(AddressOf ToPointF). + ToArray() + + Manager.AddFreeHandAnnot(oColor, oPoints) + Next + End Sub + Private Sub AddInkAnnotation(pAnnotation As Annotation) Dim oSegments = pAnnotation.lines.points Dim oColor = ColorTranslator.FromHtml(pAnnotation.strokeColor) @@ -339,6 +358,12 @@ Namespace Jobs.FinalizeDocument Public Property strokeColor As String End Class + Friend Class Ink + Public Property lines As Lines + + Public Property strokeColor As String + End Class + Public Class EGName Public Shared ReadOnly NoName As String = Guid.NewGuid().ToString()