Skip to content

Configuration

Papyrus is configured through PapyrusConfig before loading a document.

Initialize

tsx
import { useViewerStore } from '@papyrus-sdk/core';

useViewerStore.getState().initializeStore({
  initialPage: 3,
  initialUITheme: 'dark',
  initialPageTheme: 'sepia',
  initialAccentColor: '#2563eb',
});

Options

PropertyTypeDescription
initialPagenumberPage shown on load (default: 1).
initialZoomnumberInitial zoom level (1.0 = 100%).
initialRotationnumberInitial rotation in degrees (0, 90, 180, 270).
initialUITheme'light' | 'dark'UI theme (sidebars and menus).
initialPageThemePageThemePage filter (normal, sepia, dark, high-contrast).
initialAccentColorstringAccent color (hex) for active UI states.
initialAnnotationsAnnotation[]Preloaded annotations from your backend.
sidebarLeftOpenbooleanWhether the thumbnail sidebar starts open.
sidebarRightOpenbooleanWhether the search/notes sidebar starts open.

Events

ts
import { papyrusEvents, PapyrusEventType } from '@papyrus-sdk/core';

papyrusEvents.on(PapyrusEventType.PAGE_CHANGED, ({ pageNumber }) => {
  console.log('page', pageNumber);
});