Plugin: Viewport
Owns the scrollable container DOM that hosts the rendered pages.
The Viewport plugin manages the DOM element that contains the rendered pages. It provides the scroll surface, size tracking, and coordinate system used by every other plugin.
Enabling flag
Always registered. No features flag.
What it does
- Owns the root scrollable
<div>insidePdfViewer - Tracks scroll position, viewport dimensions, and resize events
- Provides the coordinate frame that
scroll,zoom,pan, andselectionplugins translate to/from - Hosts the keyboard / mouse / touch event listeners that other plugins subscribe to
Composable
useViewport() from @embedpdf/plugin-viewport/vue exposes the underlying DOM ref and dimensions. DocumentViewer wires touch gestures (useTouch) into this element when features.touchGestures is on.
Events
viewport-resize— element dimensions changedscroll-position-change— viewport scrolled
Dependencies
None.
Configuration
No featureConfig.
When you’d touch it directly
For custom touch / gesture handling beyond what useTouch provides. Most consumers don’t need to.