Skip to main content

Guides

Viewer & layout

Zoom and fit modes, eased transitions, scroll modes, columns and spreads, rotation and rendering budget.


Viewer.Root owns zoom, rotation, scroll mode, columns and the page theme. All of them are bindable.

<Viewer.Root bind:zoom bind:zoomMode bind:page bind:columns scrollMode="vertical">
	<Viewer.Viewport class="h-full"><Viewer.Pages /></Viewer.Viewport>
</Viewer.Root>
<Viewer.Root bind:zoom bind:zoomMode bind:page bind:columns scrollMode="vertical">
	<Viewer.Viewport class="h-full"><Viewer.Pages /></Viewer.Viewport>
</Viewer.Root>

Zoom

Prop Values
zoom 1 = 100%. Assigning it jumps and switches zoomMode to 'manual'
zoomMode 'auto' · 'page-width' · 'page-height' · 'page-fit' · 'manual'
zoomSteps Steps used by Zoom.In / Zoom.Out and the keyboard
smoothZoom Ease zoom changes (default true; off with reduced motion)
wheelZoom Ctrl/⌘ + wheel and trackpad pinch (default true)
minZoom · maxZoom Limits for every way of zooming, fit modes included (defaults 0.1 and 10); viewer.minZoom / viewer.maxZoom
zoomLocked User zooming (pinch, wheel, shortcuts, zoomTo, mode changes) does nothing; a fit mode keeps fitting the view as it resizes
  • Eased transitions. viewer.zoomTo(z), the zoom steps, Zoom.Select and fit-mode switches animate. Drive a slider with bind:value={() => viewer.zoom, (z) => viewer.zoomTo(z)}.
  • Anchored zoom. While pages are narrower than the view they stay centred; once wider, Ctrl/⌘ + wheel and pinch zoom around the cursor.
  • Sharp zoom-ins. Below 100% pages render at up to twice the resolution (oversampling), and during a long zoom a badly stretched page is refreshed once, so quick zoom-ins rarely look blurry.

Scroll modes, columns and spreads

Prop Values
scrollMode 'vertical' · 'horizontal' · 'wrapped' · 'page' (one page or spread at a time)
columns 1–4 pages per row, or 'auto': more pages per row as you zoom out, up to maxColumns
firstPageAlone Book spreads with the cover on its own
rotation 0 · 90 · 180 · 270

When the column count changes, pages slide to their new place instead of jumping.

Rendering budget

Prop Purpose
overscan Pages within this many viewport heights are rendered (default 1)
maxCanvasPixels Cap on a page bitmap’s area in device pixels (default 16M)
oversampling Render zoomed-out pages at up to 2× (default true)
detailMinWidth Pages narrower than this (default 260 px) skip text layers

Room for side notes

Pages always stay centred and side notes never add a scrollbar. Annotations.Margin sizes itself from viewer.sideRoom (the free width beside the centred pages): full notes when they fit, narrower ones when space is tight (over the page's blank margin, never its text, if needed), and compact markers below minWidth (140 px by default). Hovering a marker shows the note, and clicking it opens the note in the popover. With fit-to-width, set --pdf-pages-aside: 272px on the viewport to keep that much room on each side for the notes (pages shrink by at most a quarter for it). Next to another page (a spread, Auto's grid, a horizontal strip) and on thumbnail-sized pages, notes are always markers; beside a neighbor they sit just past the page's edge (data-placement="gap"), painted above it.