How do I rotate a form field?

Question:
I have a form field in my document that I need to rotate, how can I achieve this?

Answer:
The way in which form fields are displayed is dictated by their associated widget. The following code snippet iterates through all the fields in a document, gets the associated widget, via the SDF API, and sets the rotation value. Finally the widget is refreshed to ensure it is displayed accounting for the change in orientation.

`

for (FieldIterator itr = doc.GetFieldIterator(); itr.HasNext(); itr.Next())
{
Field curField = itr.Current();
pdftron.PDF.Annots.Widget curWidget = new pdftron.PDF.Annots.Widget(curField.GetSDFObj());
curWidget.SetRotation(270);
curWidget.RefreshAppearance();
}

`