Skip to content

Themes

Theme refers to using different background colors to render PDF document pages when displaying PDF files to adapt to user preferences and scene needs, enhancing the reading experience.

When modifying the theme, only the visual effects during document display are altered, and it does not modify the PDF document data on the disk. The theme settings are not saved within the PDF document data.

This example shows how to set the dark theme:

tsx
let config = ComPDFKit.getDefaultConfig({
  readerViewConfig: {
    themes: CPDFThemes.DARK
  }
});
ComPDFKit.openDocument(samplePDF, '', config);

// CPDFReaderView Sample
<CPDFReaderView
    ref={pdfReaderRef}
    document={samplePDF}
    saveDocument={saveDocument}
    configuration={config}/>

Explanation of Themes

ModeDescriptionOption Values
LIGHTUses a white background and black text, suitable for reading in well-lit environments.CPDFThemes.LIGHT
DARKUses a dark background and light text, suitable for reading in low-light environments.CPDFThemes.DARK
SEPIAUse a beige background for users who are used to reading on paper.CPDFThemes.SEPIA
RESEDASoft light green background reduces discomfort from high brightness and strong contrast when reading, effectively relieving visual fatigue.CPDFThemes.RESEDA