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 content editing toolbar in ComPDF can be flexibly configured to enable content editing types and tools. This section describes how to customize the content editing toolbar.
The default content editor toolbar contains the following editor types and tools:
| Android | iOS |
|---|---|
![]() | ![]() |
You can enable or hide specific edit types by setting the availableTypes property in the contentEditorConfig object. The following example shows how to adjust the order of edit types and hide the settings button for the content editing tool.
CPDFConfiguration configuration = CPDFConfiguration(
contentEditorConfig: const CPDFContentEditorConfig(availableTypes: [
CPDFContentEditorType.editorImage,
CPDFContentEditorType.editorText
], availableTools: [
CPDFConfigTool.undo,
CPDFConfigTool.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 |
|---|
| CPDFContentEditorType.editorText |
| CPDFContentEditorType.editorImage |
Note: Please refer to CPDFContentEditorType 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 CPDFConfigTool for the relevant options.
You can control the visibility of the bottom toolbar in content editing mode by configuring CPDFConfiguration.
CPDFConfiguration configuration = CPDFConfiguration(
// Set whether the content editor mode bottom toolbar is visible
toolbarConfig: const CPDFToolbarConfig(contentEditorToolbarVisible: false),
);