Skip to main content
All docs
V25.1
  • PdfAcroFormTextBoxField.AddWidget(PdfRectangle) Method

    Adds a widget annotation related to the text box. The widget is added to the page where the form field is located.

    Namespace: DevExpress.Pdf

    Assembly: DevExpress.Pdf.v25.1.Core.dll

    NuGet Package: DevExpress.Pdf.Core

    Declaration

    public void AddWidget(
        PdfRectangle rectangle
    )

    Parameters

    Name Type Description
    rectangle PdfRectangle

    The page rectangle where to add the widget annotation.

    Remarks

    A widget annotation contains form field display properties. One field can be related to multiple widget annotations. When you create a form field, the widget annotation is created automatically. Call the AddWidget method to create an additional widget on the same page with the form field.

    The code sample below creates a text box with two widget annotations, one below another:

    widgets

    using DevExpress.Pdf;
    
    using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    {
        // Load a document
        processor.LoadDocument("..\\..\\Document.pdf");
    
        // Create a text box field on the first page
        PdfAcroFormTextBoxField textBox = new PdfAcroFormTextBoxField("text box", 1, new PdfRectangle(230, 690, 280, 710));
    
        // Specify text box text and appearance
        textBox.Text = "Text Box";
        textBox.Appearance.BackgroundColor = new PdfRGBColor(0.8, 0.5, 0.3);
        textBox.Appearance.FontSize = 12;
    
        // Add a text box widget below the first widget
        textBox.AddWidget(new PdfRectangle(230, 660, 280, 680));
    
        // Add a form field to the page
        processor.AddFormFields(textBox, radioGroup);
    
        // Save the result
        processor.SaveDocument("..\\..\\Result.pdf");
    }
    
    See Also