Describe the bug
On large multi-page PDFs, only the first few pages render correctly. As you scroll further, pages appear blank/white and never paint. Any resize of the viewer — resizing the browser window, or toggling the sidebar/thumbnail panel (which animates the pages container width) — immediately repaints the affected pages correctly.
To Reproduce
Steps to reproduce the behavior:
- Render a viewer with RPProvider + default , initialScale={ZoomLevel.PAGE_WIDTH}.
- Load a large multi-page PDF (many pages / mixed page sizes).
- Scroll down past the first few pages.
- See pages render blank/white instead of their content.
- Resize the browser window (or toggle the sidebar) — the blank pages immediately render correctly.
Expected behavior
All pages render their content as they scroll into view, without requiring a manual resize.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: macOS 26 (likely independent)
- Browser: Firefox, Chrome (i think all browsers)
Smartphone (please complete the following information):
Not tested
Additional context
The library version is 2.7.2. RPProvider is used with initialScale={ZoomLevel.PAGE_WIDTH} and the default virtualized <RPPages />.
Likely root cause (from tracing the bundle):
<RPPages /> renders through a react-window VariableSizeGrid. Rows that haven't been mounted yet fall back to a single estimatedRowHeight. On tall documents the estimate diverges from the real page heights, so the grid maps scrollTop to the wrong visible range and the pages actually under the viewport are never mounted → blank.
ZoomContext derives the page scale from the container width via a ResizeObserver with a ~100ms debounce, and returns 0 while width/height are unset. While the scale is 0, CanvasLayer early-returns and enqueues no render, so those canvases never paint.
- A resize fires the ResizeObserver(s): AutoSizer pushes fresh width/height into the grid,
ZoomContext recomputes a non-zero scale, and the page-dimension change triggers resetAfterIndices(..., shouldForceUpdate: true), which invalidates the cached/estimated heights and forces the correct pages to mount and paint. This is why resizing fixes it.
This looks related to the virtual-scroll / viewport-detection issues previously fixed in #38 and #44, but the failure mode here is blank pages rather than page-count/layout drift.
- @react-pdf-kit/viewer version: 2.7.2
- React version: [e.g. 19.x]
- Bundler: Vite
- initialScale: ZoomLevel.PAGE_WIDTH
- Have not yet confirmed against 2.7.3-rc.0 / 2.8.0-beta
Describe the bug
On large multi-page PDFs, only the first few pages render correctly. As you scroll further, pages appear blank/white and never paint. Any resize of the viewer — resizing the browser window, or toggling the sidebar/thumbnail panel (which animates the pages container width) — immediately repaints the affected pages correctly.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All pages render their content as they scroll into view, without requiring a manual resize.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Not tested
Additional context
The library version is 2.7.2.
RPProvideris used withinitialScale={ZoomLevel.PAGE_WIDTH}and the default virtualized<RPPages />.Likely root cause (from tracing the bundle):
<RPPages />renders through areact-windowVariableSizeGrid. Rows that haven't been mounted yet fall back to a singleestimatedRowHeight. On tall documents the estimate diverges from the real page heights, so the grid mapsscrollTopto the wrong visible range and the pages actually under the viewport are never mounted → blank.ZoomContextderives the page scale from the container width via a ResizeObserver with a ~100ms debounce, and returns0while width/height are unset. While the scale is0,CanvasLayerearly-returns and enqueues no render, so those canvases never paint.ZoomContextrecomputes a non-zero scale, and the page-dimension change triggersresetAfterIndices(..., shouldForceUpdate: true), which invalidates the cached/estimated heights and forces the correct pages to mount and paint. This is why resizing fixes it.This looks related to the virtual-scroll / viewport-detection issues previously fixed in #38 and #44, but the failure mode here is blank pages rather than page-count/layout drift.