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
|
||||
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
|
||||
Dim yOffsetofFF As Double = If(yOffsetsOfFF.TryGetValue(annot.Name, yOffsetofFF), yOffsetofFF, 0)
|
||||
|
||||
'double y = (signature.Y - .5 - magin) * inchFactor
|
||||
Dim y = element.Top - 0.5 - margin + yOffsetofFF
|
||||
Dim y = frameY + yOffsetofFF
|
||||
|
||||
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
|
||||
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
|
||||
AddInkAnnotation(element.Page, annot.Value)
|
||||
End If
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user