Essentials
Getting Started
Load a PDF, mount the viewer, and safely unload it.
Install and import
Use the package entrypoints from the library build.
import { load, unload } from '@conekto/papyrium';
Basic load flow
const instance = await load({
container: '#viewer',
document: pdfBytes,
locale: 'ja-jp',
});
instance.setViewState((state) => state.set('currentPageIndex', 0));
Unload flow
When you replace routes or remove the viewer container, call unload.
unload(instance);
What load does
- If
chromeis enabled, it mounts<papyrium-chrome>and returns its ready reader instance. - If
chromeis omitted, Papyrium currently defaults to chrome minimal mode. - The same returned object exposes both
ViewerInstanceand compatibility methods fromPapyriumInstance. - Locale also drives effective direction (
ltr/rtl) for chrome UI; no standalone direction option is required.