I am trying to update the coordinates of an annotation and noticed that the position adjustment iText makes is reversed for rotations of 270 and 90 when getting a field position vs adding the annotation in the first place. This was not what I expected.
internal void AddAnnotation(PdfAnnotation annot, PdfDictionary pageN)
https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/PdfStamperImp.cs#L1428
virtual public IList GetFieldPositions(String name)
https://github.com/itext/itextsharp/blob/develop/src/core/iTextSharp/text/pdf/AcroFields.cs#L1639
Anyone know why this is and how to work around this? I basically need to update the position of an added annotation and run through the same transform iText makes when first adding it as an annotation. I could do this adjustment myself but would prefer not to if there is a clean way.
My attempt was
- Add annotation
- Update annotation rectangle directly
- Get field position of the annotation
- Re-Set the rectangle of the field with the transformed coordinates from the call to GetFieldPositions
This works perfectly for a page rotation of 180 degrees but 90 and 270 are do not work because the transform is flip-flopped.