PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
The form toolbar in ComPDF can be flexibly configured to enable form types and tools. This section explains how to customize the form toolbar.
The default form toolbar contains the following form types and tools:
| Android | iOS |
|---|---|
![]() | ![]() |
You can enable or hide specific editing types by setting the availableTypes property in the formsConfig object. The following example demonstrates how to adjust the form types to only enable text fields and list boxes.
CPDFConfiguration configuration = CPDFConfiguration(
formsConfig: const CPDFFormsConfig(availableTypes: [
CPDFFormType.textField,
CPDFFormType.listBox
],availableTools: [
CPDFFormConfigTool.undo,
CPDFFormConfigTool.redo
]));
// CPDFReaderWidget Sample
Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(),
body: CPDFReaderWidget(
document: documentPath,
configuration: configuration,
onCreated: (controller) {},
));
// ComPDF.openDocument Sample
ComPDFKit.openDocument(documentPath, '', configuration)The customized toolbar will look like what’s shown below.
| Android | iOS |
|---|---|
![]() | ![]() |
| Type |
|---|
| CPDFFormType.textField |
| CPDFFormType.checkBox |
| CPDFFormType.radioButton |
| CPDFFormType.listBox |
| CPDFFormType.comboBox |
| CPDFFormType.signaturesFields |
| CPDFFormType.pushButton |
Note: Please refer to CPDFFormType for the relevant options.
| Tool | Description |
|---|---|
| SETTING | Set button, corresponding to open the selected annotation, text or picture property panel. |
| UNDO | Undo annotation, content editing, form operations. |
| REDO | Redo an undone action |
Note: Please refer to CPDFFormConfigTool for the relevant options.
You can control the visibility of the bottom toolbar in form mode by configuring CPDFConfiguration.
CPDFConfiguration configuration = CPDFConfiguration(
// Set whether the form mode bottom toolbar is visible
toolbarConfig: const CPDFToolbarConfig(formToolbarVisible: false),
);