Skip to content
ComPDF
Guides

Customize PDF Content Area UI

This section describes how to customize the interactive UI styles within PDF pages using readerViewConfig.uiStyle. This configuration only applies to the PDF content area itself, including text selection, annotation and form selection borders, screenshot selections, page rectangle highlights, and page icons. It does not include toolbar, theme colors, or overall reader UI configuration.

Annotation and Content Editing Selection Style

Controls the border and control point styles when annotations and content editing objects are selected.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      focusBorderStyle: {
        nodeColor: "#FC534E",
        borderColor: "#FC534E",
        borderWidth: 2,
        borderDashPattern: [20, 10]
      },
    },
  },
});
FieldTypeDescription
nodeColorStringControl point (corner) color.
borderColorStringSelected border color.
borderWidthNumberBorder width.
borderDashPatternNumber[]Dash pattern, format: [dash length, gap length].

Content Editing Default Border Style

Controls the border display style for content editing objects when not selected.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      defaultBorderStyle: {
        borderColor: "#50507F",
        borderWidth: 2,
        borderDashPattern: [20, 10],
      },
    },
  },
});
FieldTypeDescription
borderColorStringBorder color.
borderWidthNumberBorder width.
borderDashPatternNumber[]Dash pattern.

Form Drawing and Preview Style

Sets the drawing preview effect during form control creation.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      formPreview: {
        style: "fill",
        color: "#48C2FF6C",
      },
    },
  },
});
FieldDescription
stylePreview style, supports fill / stroke.
strokeWidthBorder width.
colorPreview color (supports transparency).

Screenshot Selection Style

Customizes the display of selection borders and mask areas in screenshot functionality.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      screenshot: {
        fillColor: "#00000000",
        borderColor: "#FF6499FF",
        outsideColor: "#00000000",
        borderWidth: 5,
        borderDashPattern: [20, 10],
      },
    },
  },
});
FieldDescription
outsideColorMask color outside selection.
fillColorFill color inside selection.
borderColorBorder color.
borderWidthBorder width.
borderDashPatternDash pattern.

Text Selection Style and Operation Indicators

Controls the background color of text selection areas and operation indicator icons on both sides.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      icons: {
        selectTextLeftIcon: "ic_test_cursor_left",
        selectTextRightIcon: "ic_test_cursor_right",
        selectTextIcon: "ic_test_cursor",
        rotationAnnotationIcon: "ic_test_rotate",
      },
      selectTextColor: "#E7473BBC",
    },
  },
});
FieldDescription
selectTextColorText selection background color.
selectTextLeftIconLeft operation indicator icon.
selectTextRightIconRight operation indicator icon.
selectTextIconDefault operation icon.
rotationAnnotationIconRotation annotation icon.

Adding Custom Icon Resources:

  • Android: Place icon files (e.g., ic_test_cursor.png) in the android/app/src/main/res/drawable directory.
  • iOS: Add icon files (e.g., ic_test_cursor.png) to the ios/Runner/Assets.xcassets asset catalog.

Page Rectangle Highlight Style

Styles for rectangle areas when highlighting specified pages via the controller.setDisplayPageIndex() API.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      displayPageRect: {
        fillColor: "#4D1460F3",
        borderColor: "#FF6499FF",
        borderWidth: 2,
        borderDashPattern: [0, 0]
      },
    },
  },
});
FieldDescription
fillColorRectangle fill color.
borderColorRectangle border color.
borderWidthBorder width.
borderDashPatternDash pattern.

Bookmark Indicator Icon

Customizes the display icon for bookmark markers within pages.

tsx
const configuration = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    uiStyle: {
      bookmarkIcon: "ic_test_bookmark",
    },
  },
});