Skip to main content

PdfAcroFormVisualField.ReadOnly Property

Gets or sets whether the interactive form field allows edit operations.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public bool ReadOnly { get; set; }

Property Value

Type Description
Boolean

true, if end-users cannot modify the form field’s value; otherwise, false.

Remarks

The code sample below creates a locked text box field:

using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("Documents//Invoice.pdf");

    // Create a text box field:
    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;

    // Lock the field:
    textBox.ReadOnly = true;

    pdfDocumentProcessor.AddFormFields(textBox);
}
See Also