Recipes
Recipe: Load and Navigate
A production-ready pattern for loading, paging, and zooming.
import { load, unload } from '@conekto/papyrium';
const instance = await load({
container: '#viewer',
document: pdfBytes,
locale: 'en-gb',
chrome: 'full',
});
instance.goToPage(1);
instance.setZoom(1.25);
instance.nextPage();
window.addEventListener('beforeunload', () => {
unload(instance);
});
Notes
- Keep a single instance per container.
- Always unload before replacing route/view shell.
- Use
setViewStateif you need atomic page + zoom updates.