Skip to content

Content Editor Toolbar

The content editing toolbar in ComPDFKit can be flexibly configured to enable content editing types and tools. This section describes how to customize the content editing toolbar.

Default Content Editor ToolBar

The default content editor toolbar contains the following editor types and tools:

AndroidiOS

Customizing the Toolbar Buttons

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.

dart
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) {},
  ));

// ComPDFKit.openDocument Sample
ComPDFKit.openDocument(documentPath, '', configuration)

The customized toolbar will look like what’s shown below.

AndroidiOS

Available Toolbar Customization Options

Type
CPDFContentEditorType.editorText
CPDFContentEditorType.editorImage

Note: Please refer to CPDFContentEditorType for the relevant options.

Available Toolbar Tool Customization Options

ToolDescription
settingSet button, corresponding to open the selected annotation, text or picture property panel.
undoUndo annotation, content editing, form operations.
redoRedo an undone action

Note: Please refer to CPDFConfigTool for the relevant options.