Plugin: Scroll
Page-aware virtual scrolling for continuous, paged, and spread modes.
The Scroll plugin tracks which pages are in view, fires page-change events as the user scrolls, and supports both continuous and paged modes.
Enabling flag
Always registered. No features flag.
What it does
- Reactive
currentPageandtotalPagesstate - Continuous scroll by default — pages flow one after another
- Page-mode and spread-mode supported (the latter via
features.spread) - Smooth scroll to a specific page (
goToPageprogrammatic call)
Composable
useScroll(documentId) from @embedpdf/plugin-scroll/vue. Returns reactive state and goToPage / scrollToTop / scrollToBottom methods. DocumentViewer re-exposes goToPage and getCurrentPage on its instance.
Events
page-change— viewport-centered page changed (surfaces as@page-changeonDocumentViewer)total-pages-change— total page count became known (fires once shortly afterdocument-loaded)
Dependencies
- viewport
Configuration
No featureConfig block — scroll behaviour adapts to features.spread automatically.
When you’d touch it directly
For custom scroll-aware UI (e.g. a sticky “Page 4 of 14” indicator outside the viewer chrome):
import { useScroll } from '@embedpdf/plugin-scroll/vue'
const scroll = useScroll(() => documentId)
console.log(scroll.state.value.currentPage)