fix: adjust annotation position calculation in PDFBurner
- Updated BurnElementAnnotsToPDF method to correctly align image annotations relative to the frame position. - Introduced frame-based coordinate shifting (frameXShift and frameYShift) to handle signature positioning accurately. - Replaced variable `x` with `frameX` for better clarity and consistency.
This commit is contained in:
parent
a11d9a0e0e
commit
0bb85c28c1
@ -74,18 +74,28 @@ Namespace Jobs.FinalizeDocument
|
|||||||
'Add annotations
|
'Add annotations
|
||||||
For Each element In elements
|
For Each element In elements
|
||||||
|
|
||||||
Dim x = (element.Left - 0.7 - margin)
|
Dim frameX = (element.Left - 0.7 - margin)
|
||||||
|
|
||||||
|
Dim frame = element.Annotations.FirstOrDefault(Function(a) a.Name = "frame")
|
||||||
|
Dim frameY = element.Top - 0.5 - margin
|
||||||
|
Dim frameYShift = frame.Y - frameY * inchFactor
|
||||||
|
Dim frameXShift = frame.X - frameX * inchFactor
|
||||||
|
|
||||||
For Each annot In element.Annotations
|
For Each annot In element.Annotations
|
||||||
Dim yOffsetofFF As Double = If(yOffsetsOfFF.TryGetValue(annot.Name, yOffsetofFF), yOffsetofFF, 0)
|
Dim yOffsetofFF As Double = If(yOffsetsOfFF.TryGetValue(annot.Name, yOffsetofFF), yOffsetofFF, 0)
|
||||||
|
Dim y = frameY + yOffsetofFF
|
||||||
'double y = (signature.Y - .5 - magin) * inchFactor
|
|
||||||
Dim y = element.Top - 0.5 - margin + yOffsetofFF
|
|
||||||
|
|
||||||
If annot.Type = AnnotationType.FormField Then
|
If annot.Type = AnnotationType.FormField Then
|
||||||
AddFormFieldValue(x, y, annot.Width / inchFactor, annot.Height / inchFactor, element.Page, annot.Value)
|
AddFormFieldValue(frameX, y, annot.Width / inchFactor, annot.Height / inchFactor, element.Page, annot.Value)
|
||||||
ElseIf annot.Type = AnnotationType.Image Then
|
ElseIf annot.Type = AnnotationType.Image Then
|
||||||
AddImageAnnotation(x, y, annot.Width / inchFactor, annot.Height / inchFactor, element.Page, annot.Value)
|
AddImageAnnotation(
|
||||||
|
If(annot.Name = "signature", (annot.X - frameXShift) / inchFactor, frameX),
|
||||||
|
If(annot.Name = "signature", (annot.Y - frameYShift) / inchFactor, y),
|
||||||
|
annot.Width / inchFactor,
|
||||||
|
annot.Height / inchFactor,
|
||||||
|
element.Page,
|
||||||
|
annot.Value
|
||||||
|
)
|
||||||
ElseIf annot.Type = AnnotationType.Ink Then
|
ElseIf annot.Type = AnnotationType.Ink Then
|
||||||
AddInkAnnotation(element.Page, annot.Value)
|
AddInkAnnotation(element.Page, annot.Value)
|
||||||
End If
|
End If
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user