Guides
Content Editor
Content editor mode allows users to directly edit text and images in PDF pages. ContentEditorConfig controls the editable types, tool buttons, and default text properties.
Editable Types
availableTypes controls the editing types displayed in the content editor toolbar:
json
{
"contentEditorConfig": {
"availableTypes": [
"editorText",
"editorImage"
]
}
}| Value | Description |
|---|---|
editorText | Edit text areas |
editorImage | Edit image areas |
Available Tools
json
{
"contentEditorConfig": {
"availableTools": [
"setting",
"undo",
"redo"
]
}
}| Value | Description |
|---|---|
setting | Properties button |
undo | Undo |
redo | Redo |
Default Text Properties
Configure default properties for newly created text areas via initAttribute:
json
{
"contentEditorConfig": {
"initAttribute": {
"text": {
"fontColor": "#000000",
"fontColorAlpha": 255,
"fontSize": 30,
"isBold": false,
"isItalic": false,
"alignment": "left",
"familyName": "Helvetica",
"styleName": "Regular"
}
}
}
}| Field | Description |
|---|---|
fontColor | Text color |
fontColorAlpha | Text opacity (0-255) |
fontSize | Font size |
isBold | Whether bold |
isItalic | Whether italic |
alignment | Alignment: "left", "center", "right" |
familyName | Font family name |
styleName | Font style |
CEditToolbar Component
CEditToolbar is the core UI component of the content editor toolbar, located in the com.compdfkit.tools.contenteditor.pdfcontenteditorbar package.
Related Classes
| Class | Description |
|---|---|
CEditToolbar | Content editor toolbar main view |
CContentEditorToolListAdapter | Edit type list adapter |
CContentEditorToolBean | Edit tool item data model |
Property Editor Fragments
| Edit Type | Fragment Class |
|---|---|
| Text | CEditTextPropertiesFragment |
| Image | CEditImagePropertiesFragment |
Image Operations
After selecting an image in content editor mode, the context menu supports the following operations:
- Rotate: Rotate left/right
- Replace: Replace with an image from gallery
- Export: Export image to device
- Opacity: Set to 25%/50%/75%/100%
- Flip horizontal/vertical
- Crop: Free crop the image area
- Copy/Cut/Delete
These operations are controlled through the contentEditorMode configuration of the Context Menu.