Interactive Form Filling
- 2 minutes to read
This document describes how to fill a document with interactive forms and provides customization options.
You are able to type directly into PDF documents that contain the form field information.
As you can see from the image above, each field is rendered according to its form type, providing text boxes, radio buttons and combo boxes with auto complete, check boxes and lists.
The image below shows the auto complete, combo box and check box features embedded in an address form.
Highlight Form Field
The PDF Viewer can highlight interactive form fields with a color. To enable this functionality, set the PdfViewerControl.HighlightFormFields property to true.
If you wish to change the default color, which is used to highlight form fields, use the PdfViewerControl.HighlightedFormFieldColor property.
The image below demonstrates the PdfViewerControl.HighlightedFormFieldColor property set to Color.FromArgb(120, 255, 0, 0).
Change Form Field Value
After a form field value is changed, the PdfViewerControl.FormFieldValueChanged event is raised. The FormFieldValueChangedEventArgs.FieldName, FormFieldValueChangedEventArgs.OldValue and FormFieldValueChangedEventArgs.NewValue properties allow you to obtain the field name, the field's previous value and new value.
When a form field receives the input focus, the form field's editor is activated and the PDF Viewer raises the PdfViewerControl.ShowingEditor event. In this event, you can prevent end-users from showing the form field's editor using the PdfShowingEditorEventArgs.Cancel property. When this property is enabled, end-users can't edit the form field value.
You can obtain a form field name using the PdfEditorEventArgsBase.FieldName property when the PDF Viewer raises the PdfViewerControl.ShowingEditor, PdfViewerControl.ShownEditor or PdfViewerControl.HiddenEditor event.