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).
This commit is contained in:
parent
7f9125b3aa
commit
75e47d10e3
@ -64,6 +64,8 @@ Namespace Jobs.FinalizeDocument
|
|||||||
AddFormFieldValue(annot.Name, x, y, 100, 180, element.Page, annot.Value)
|
AddFormFieldValue(annot.Name, x, y, 100, 180, element.Page, annot.Value)
|
||||||
ElseIf annot.Type = AnnotationType.FormField Then
|
ElseIf annot.Type = AnnotationType.FormField Then
|
||||||
AddImageAnnotation(x, y, 100, 180, element.Page, annot.Value)
|
AddImageAnnotation(x, y, 100, 180, element.Page, annot.Value)
|
||||||
|
ElseIf annot.Type = AnnotationType.Ink Then
|
||||||
|
AddInkAnnotation(element.Page, annot.Value)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
@ -158,6 +160,23 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Manager.AddEmbeddedImageAnnotFromBase64(oAttachment.Value.binary, oX, oY, oWidth, oHeight)
|
Manager.AddEmbeddedImageAnnotFromBase64(oAttachment.Value.binary, oX, oY, oWidth, oHeight)
|
||||||
End Sub
|
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)
|
Private Sub AddInkAnnotation(pAnnotation As Annotation)
|
||||||
Dim oSegments = pAnnotation.lines.points
|
Dim oSegments = pAnnotation.lines.points
|
||||||
Dim oColor = ColorTranslator.FromHtml(pAnnotation.strokeColor)
|
Dim oColor = ColorTranslator.FromHtml(pAnnotation.strokeColor)
|
||||||
@ -339,6 +358,12 @@ Namespace Jobs.FinalizeDocument
|
|||||||
Public Property strokeColor As String
|
Public Property strokeColor As String
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
Friend Class Ink
|
||||||
|
Public Property lines As Lines
|
||||||
|
|
||||||
|
Public Property strokeColor As String
|
||||||
|
End Class
|
||||||
|
|
||||||
Public Class EGName
|
Public Class EGName
|
||||||
Public Shared ReadOnly NoName As String = Guid.NewGuid().ToString()
|
Public Shared ReadOnly NoName As String = Guid.NewGuid().ToString()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user