Skip to content
DemoSampleAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub
Android Guides Content editor

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"
    ]
  }
}
ValueDescription
editorTextEdit text areas
editorImageEdit image areas

Available Tools ​

json
{
  "contentEditorConfig": {
    "availableTools": [
      "setting",
      "undo",
      "redo"
    ]
  }
}
ValueDescription
settingProperties button
undoUndo
redoRedo

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"
      }
    }
  }
}
FieldDescription
fontColorText color
fontColorAlphaText opacity (0-255)
fontSizeFont size
isBoldWhether bold
isItalicWhether italic
alignmentAlignment: "left", "center", "right"
familyNameFont family name
styleNameFont style

CEditToolbar Component ​

CEditToolbar is the core UI component of the content editor toolbar, located in the com.compdfkit.tools.contenteditor.pdfcontenteditorbar package.

ClassDescription
CEditToolbarContent editor toolbar main view
CContentEditorToolListAdapterEdit type list adapter
CContentEditorToolBeanEdit tool item data model

Property Editor Fragments ​

Edit TypeFragment Class
TextCEditTextPropertiesFragment
ImageCEditImagePropertiesFragment

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.