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 Reader view config

Reader View Config ​

ReaderViewConfig controls the PDF reader view's display behavior, including page layout, theme, zoom, spacing, and more.

Configuration Fields Overview ​

FieldTypeDefaultDescription
displayModeString"singlePage"Page display mode
continueModebooleantrueWhether to enable continuous scrolling
verticalModebooleantrueWhether to scroll vertically
cropModebooleanfalseWhether to crop page margins
themesString"light"Reading theme
enableSliderBarbooleantrueWhether to show the slider progress bar
enablePageIndicatorbooleantrueWhether to show the page indicator
pageSpacingint10Page spacing (dp)
pageScalefloat1.0Initial page zoom scale
pageSameWidthbooleantrueWhether all pages display at the same width
enableMinScalebooleantrueWhether to enable minimum zoom limit
marginsint[][0, 0, 0, 0]Page margins [left, top, right, bottom]
linkHighlightbooleantrueWhether to highlight links
formFieldHighlightbooleantrueWhether to highlight form fields
annotationsVisiblebooleantrueWhether to show annotations
enableDoubleTapZoombooleanfalseWhether to enable double-tap zoom
enableCreateEditTextInputbooleantrueWhether to show input dialog when creating text in content editor mode
enableCreateImagePickerDialogbooleantrueWhether to show picker when creating image in content editor mode

Page Display Mode ​

displayMode controls the page layout:

ValueDescription
singlePageSingle page mode (default)
doublePageDouble page mode
coverPageCover mode (first page displayed alone, subsequent pages in pairs)
json
{
  "readerViewConfig": {
    "displayMode": "singlePage",
    "continueMode": true,
    "verticalMode": true
  }
}

Scroll Direction ​

  • continueMode: true + verticalMode: true → Vertical continuous scrolling (default)
  • continueMode: true + verticalMode: false → Horizontal continuous scrolling
  • continueMode: false → Page-by-page mode (displays one page/spread at a time)
json
{
  "readerViewConfig": {
    "continueMode": false,
    "verticalMode": false
  }
}

Reading Theme ​

themes provides 4 built-in themes:

ValueDescription
lightLight theme (default)
darkDark theme
sepiaEye-comfort mode (warm tone)
resedaGreen eye-comfort mode
json
{
  "readerViewConfig": {
    "themes": "light"
  }
}

Page Spacing & Margins ​

json
{
  "readerViewConfig": {
    "pageSpacing": 10,
    "margins": [0, 0, 0, 0]
  }
}
  • pageSpacing: Spacing between pages in dp.
  • margins: Page margin array [left, top, right, bottom] in dp.

Zoom Control ​

json
{
  "readerViewConfig": {
    "pageScale": 1.0,
    "pageSameWidth": true,
    "enableMinScale": true,
    "enableDoubleTapZoom": false
  }
}
FieldDescription
pageScaleInitial zoom scale, 1.0 means 100%
pageSameWidthWhether all pages display at the same width
enableMinScaleWhether to enable minimum zoom limit
enableDoubleTapZoomWhether double-tap zoom in/out is supported

Highlights & Visibility ​

json
{
  "readerViewConfig": {
    "linkHighlight": true,
    "formFieldHighlight": true,
    "annotationsVisible": true,
    "cropMode": false
  }
}
FieldDescription
linkHighlightHighlight hyperlink areas in the document
formFieldHighlightHighlight form field areas
annotationsVisibleWhether to render and display annotations
cropModeCrop page margins and only display the content area

UI Style Configuration ​

readerViewConfig.uiStyle provides fine-grained UI style control:

json
{
  "readerViewConfig": {
    "uiStyle": {
      "selectTextColor": "#33000000",
      "displayPageRect": {
        "fillColor": "#4D1460F3",
        "borderColor": "#6499FF",
        "borderWidth": 5,
        "borderDashPattern": [0.0, 0.0]
      },
      "screenshot": {
        "outsideColor": "#00000000",
        "fillColor": "#00000000",
        "borderColor": "#6499FF",
        "borderWidth": 5,
        "borderDashPattern": [20.0, 8.0]
      },
      "formPreview": {
        "style": "fill",
        "strokeWidth": 2,
        "color": "#4D1460F3"
      },
      "defaultBorderStyle": {
        "borderColor": "#FF888888",
        "borderWidth": 2,
        "borderDashPattern": [10, 10]
      },
      "focusBorderStyle": {
        "nodeColor": "#6499FF",
        "borderColor": "#6499FF",
        "borderWidth": 2,
        "borderDashPattern": [10.0, 10.0]
      }
    }
  }
}
Style ItemDescription
selectTextColorText selection highlight color
displayPageRectBorder/fill style for page display area
screenshotBorder/fill style for screenshot mode
formPreviewForm preview style
defaultBorderStyleDefault border style for objects
focusBorderStyleBorder style when an object is selected
cropImageStyleBorder style for image cropping

Full Example ​

json
{
  "readerViewConfig": {
    "linkHighlight": true,
    "formFieldHighlight": true,
    "displayMode": "singlePage",
    "continueMode": true,
    "verticalMode": true,
    "cropMode": false,
    "themes": "light",
    "enableSliderBar": true,
    "enablePageIndicator": true,
    "pageSpacing": 10,
    "margins": [0, 0, 0, 0],
    "pageScale": 1.0,
    "pageSameWidth": true,
    "enableMinScale": true,
    "annotationsVisible": true,
    "enableDoubleTapZoom": false
  }
}