[]
Widget annotations are used in interactive forms to represent the appearance of fields. It is also used to manage user interaction. DsPdf provides WidgetAnnotation class to enable users to apply widget annotations to the PDF file.

Refer to the following example code to add a widget annotation to a PDF document:
public void CreateWidgetAnnotation()
{
var doc = new GcPdfDocument();
var page = doc.NewPage();
var g = page.Graphics;
TextFormat tf = new TextFormat();
tf.FontSize = 11;
PointF ip = new PointF(72, 72);
float fldOffset = 72 * 2;
float fldHeight = tf.FontSize * 1.2f;
float dY = 32;
// Text field:
g.DrawString("Text field:", tf, ip);
var fldText = new TextField();
fldText.Value = "Initial TextField value";
//Get the WidgetAnnotation to specify view properties of the text field.
WidgetAnnotation widgetAnnotation = fldText.Widget;
widgetAnnotation.Page = page;
widgetAnnotation.PdfRect = new RectangleF(ip.X + fldOffset, ip.Y, 72 * 3, fldHeight);
widgetAnnotation.Border.Color = Color.Silver;
widgetAnnotation.BackColor = Color.LightSkyBlue;
doc.AcroForm.Fields.Add(fldText);
ip.Y += dY;
doc.Save("WidgetAnnotation.pdf");
}