GroupField Class
A logical group of related PDF form fields.
Declaration
public class GroupField extends FormField
Remarks
The following code snippet creates and groups text fields:
import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;
import com.devexpress.drawing.printing.DXPaperKind;
import java.nio.channels.*;
import java.nio.file.*;
public class Main {
public static void main(String[] args) throws Exception {
try (PdfDocument pdfDocument = new PdfDocument()) {
// Add an A4 page to the document.
Page page = pdfDocument.getPages().add(DXPaperKind.A4);
// Create text fields.
TextBoxField firstNameField = new TextBoxField("FirstName");
TextBoxField lastNameField = new TextBoxField("LastName");
firstNameField.setValue("John");
lastNameField.setValue("Doe");
TextBoxWidgetAnnotation widget1 =
new TextBoxWidgetAnnotation(
firstNameField,
new RectangleF(120, 720, 220, 20));
page.getAnnotations().add(widget1);
RectangleF bounds = new RectangleF(120, 720, 220, 20);
TextBoxWidgetAnnotation widget2 =
new TextBoxWidgetAnnotation(
lastNameField,
new RectangleF(120, 690, 220, 20));
page.getAnnotations().add(widget2);
// Create a group.
GroupField group = new GroupField("Contact");
// Add fields to the group.
group.getKids().add(firstNameField);
group.getKids().add(lastNameField);
// Add the group to the document.
pdfDocument.getFields().add(group);
// Save the document.
try (WritableByteChannel channel =
FileChannel.open(Path.of("result.pdf"),
StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING)) {
pdfDocument.save(channel);
}
}
}
}
Refer to the following help topic for additional information: Group Form Fields.
Inherited Members
com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)
Inheritance
Object
JavaObject
FormField
GroupField
GroupField(String name)
Initializes a new instance of the GroupField class with specified settings.
Declaration
public GroupField(String name)
Parameters
| Name | Type | Description |
|---|---|---|
| name | String | The name of the group field. |
Methods
getKids() Method
Returns child form fields contained in this group.
Declaration
public IFormFieldCollection getKids()
Returns
| Type | Description |
|---|---|
| IFormFieldCollection | Child form fields contained in this group. |