How do I rotate a form field?

28 views
Skip to first unread message

Euan Carmichael

unread,
Mar 7, 2018, 6:55:19 PM3/7/18
to PDFTron PDFNet SDK
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();
}



Reply all
Reply to author
Forward
0 new messages