add y offset to AddFormFieldValue metot

This commit is contained in:
tekh 2025-10-28 09:25:48 +01:00
parent 8ad7c37261
commit fee256a51a

View File

@ -61,7 +61,7 @@ Namespace Jobs.FinalizeDocument
For Each annot In element.Annotations For Each annot In element.Annotations
If annot.Type = AnnotationType.FormField Then If annot.Type = AnnotationType.FormField Then
AddFormFieldValue(x, y, 100, 180, element.Page, annot.Value) AddFormFieldValue(annot.Name, x, y, 100, 180, element.Page, annot.Value)
End If End If
Next Next
Next Next
@ -165,10 +165,18 @@ Namespace Jobs.FinalizeDocument
Next Next
End Sub End Sub
Private Sub AddFormFieldValue(x As Double, y As Double, width As Double, height As Double, page As Integer, value As String) Private Sub AddFormFieldValue(name As String, x As Double, y As Double, width As Double, height As Double, page As Integer, value As String)
Dim yOffset As New Dictionary(Of String, Integer) From {
{"position", 1},
{"date", 2},
{"city", 3},
}
Manager.SelectPage(page + 1) Manager.SelectPage(page + 1)
Dim posY = y + _pdfBurnerParams.YOffset * yOffset(name)
' Add the text annotation ' Add the text annotation
Dim ant = Manager.AddTextAnnot(x, y, width, height, value) Dim ant = Manager.AddTextAnnot(x, posY, width, height, value)
' Set the font properties ' Set the font properties
ant.FontName = _pdfBurnerParams.FontName ant.FontName = _pdfBurnerParams.FontName