mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 17:32:52 -05:00
Opening a long PDF in the preview drew every page at full resolution before showing anything and kept them all in memory, so a 1500-page manual took over half a minute, and one report had a 357-page scanned file push Firefox past 20 GB. The preview now lays out all pages right away, draws only the pages near the screen and releases pages once they scroll far away. Jumping to a cited page, zooming and scrolling work as before, and comment highlights and the zoom level apply to far-off pages as they are drawn. The page thumbnails also release each page after drawing it; without that, the scanned file below still passes 9 GB while its thumbnails load. The browser's find (Ctrl+F) now only matches text on pages near the screen, and selecting text across into far-off pages no longer works. | Large PDF in the file preview | before | after | | --- | --- | --- | | 1500-page text PDF, opened at page 1200 | 35.7 s, 7.5 GB | 1.3 s, 1.0 GB | | 400-page scanned PDF (39 MB), opened at page 300 | nothing shown, over 9.8 GB after 9.4 s (stopped) | 1.4 s, 1.1 GB, 1.5 GB peak scrolling the whole file | Fixes #29576