Skip to content
ComPDF
Guides

Display Modes

ComPDF supports single-page, double-page, and book mode document layouts. It also provides page-flipping and continuous-scrolling reading modes, along with crop mode and view mode configuration.

Quick Example

The following example sets the viewer to single-page continuous mode:

  • Single-page mode: disable double-page display.
  • Continuous mode: enable continuous scrolling.
java
readerView.setDoublePageMode(false);
readerView.setContinueMode(true);

Display Mode Configuration

The following table summarizes common display mode settings and the methods used to configure them:

OptionMethodDescription
Scroll directionsetVerticalMode(boolean vertical)true enables vertical scrolling. false enables horizontal scrolling.
Single-page or double-pagesetDoublePageMode(boolean doublePage)true enables double-page display. false enables single-page display.
Continuous scrollingsetContinueMode(boolean continuous)true enables continuous scrolling mode.
Book modesetCoverPageMode(boolean coverPage)Typically used with double-page mode to display the first page as a cover page.

The following examples show how to configure each option.

Set the scroll direction:

java
// Vertical scrolling.
readerView.setVerticalMode(true);
// Horizontal scrolling.
readerView.setVerticalMode(false);

Set single-page or double-page mode:

java
// Double-page display.
readerView.setDoublePageMode(true);
// Single-page display.
readerView.setDoublePageMode(false);

Set continuous scrolling mode:

java
readerView.setContinueMode(true);

Set book mode:

java
readerView.setDoublePageMode(true);
readerView.setCoverPageMode(true);

Set the Crop Mode

Crop mode adjusts the visible page area. It is useful for hiding extra page margins and improving the use of the reading area.

This example shows how to set the crop mode:

java
readerView.setCropMode(true);

Set the View Mode

When using CPDFReaderView, you can switch view modes with readerView.setViewMode(ViewMode viewMode) for different scenarios, such as reading, annotation editing, and document editing.

Choose a view mode based on the scenario:

  • VIEW: best for reading documents and filling forms.
  • ANNOT: best for adding, deleting, and editing annotations.
  • FORM: best for editing form structure and properties.
  • PDFEDIT: best for editing text and images in the document.
  • ALL: best for working with forms and annotations together.
View ModeRecommended forLimitations
VIEWReading documents and filling formsDoes not support annotation addition, selection, movement, deletion, or property editing. Does not support form addition, selection, movement, deletion, or property editing.
ANNOTAdding, deleting, and editing annotationsDoes not support form filling. Does not support form addition, selection, movement, deletion, or property editing. Does not support document text or image editing.
FORMEditing form structure and propertiesDoes not support annotation addition, selection, movement, deletion, or property editing. Does not support form filling.
PDFEDITEditing document text and imagesDoes not support annotation addition, selection, movement, deletion, or property editing. Does not support form filling. Does not support form addition, selection, movement, deletion, or property editing.
ALLWorking with forms and annotations togetherDoes not support form filling. Does not support document text or image editing.