PdfDocument.Fields Property
Returns the collection of form fields contained in the PDF document.
Namespace: DevExpress.Docs.Pdf
Assembly: DevExpress.Docs.Pdf.v26.1.dll
Declaration
Property Value
| Type | Description |
|---|---|
| FormFieldCollection | A collection of form fields contained in the PDF document. |
Remarks
Use the PdfDocument.Fields collection to access all fields in a PDF document. Iterate through the Fields collection to get field values or find a specific field by name. You can also add or remove fields from this collection.
The DevExpress PDF Document API library allow you to work with the following form field types:
- Text fields
- Check boxes
- Radio button groups
- List boxes
- Combo boxes
- Signature fields
Bind the field to a widget to display it on a PDF page. Create a WidgetAnnotation object and pass the field in the widget’s constructor.
Refer to the following help topic for more information: DevExpress PDF Document API - Form Fields.
Example
How to: Add a Text Box Field to a PDF Document
The following code snippet adds a text field to a PDF document and binds it to a text widget:

using DevExpress.Docs.Pdf;
using DevExpress.Drawing.Printing;
using System.Drawing;
namespace ConsoleApp1;
public class Program {
public static async Task Main(string[] _) {
using (PdfDocument pdfDocument = new()) {
// Add an A4 page to the document.
Page page = pdfDocument.Pages.Add(DXPaperKind.A4);
TextFont textFont = new("SegoeUI", TextFontStyle.Regular);
float y = 750;
float step = 30;
float textHeight = 14f;
// Create a label for the text field.
TextFragment loginLabel = new() {
Text = "Login:",
Location = new PointF(50, y - textHeight / 2),
Font = textFont
};
page.Fragments.Add(loginLabel);
// Create a text field and add it to the field collection.
TextBoxField loginField = new("Login");
pdfDocument.Fields.Add(loginField);
// Bind the text field to a widget and place it on the page.
RectangleF loginBounds = new(120, y - textHeight + 4, 220, textHeight);
TextBoxWidgetAnnotation loginWidget = new(loginField, loginBounds);
loginWidget.FontSize = 14;
page.Annotations.Add(loginWidget);
y -= step;
}
}
}