Skip to content

Viewer: zoom a document's pages or an image without zooming the window - #737

Merged
Matthew Shaxted (mattshax) merged 1 commit into
mainfrom
viewer-zoom
Nov 20, 2026
Merged

Matthew Shaxted (mattshax) merged 1 commit into
mainfrom
viewer-zoom

Conversation

@mattshax

Copy link
Copy Markdown
Member

A PDF's or Office file's pages, and an image, can now be zoomed in the viewer without zooming the whole Studio. Zooming the window to read a page made the rest of the layout too large.

Zoom

  • Range: 25% to 400% of the pane's width.
  • Controls:
    • + and - in the viewer's header. The percentage between them fits the pane again.
    • Ctrl or Cmd with the scroll wheel.
    • A trackpad pinch. Chromium reports it as wheel events with Ctrl; Safari and the macOS window send gesture events.
    • +, - and 0 when the document has focus.
  • A wheel or pinch keeps the point under the pointer in place. The buttons zoom about the middle of the view.
  • Only the document grows. Its pane scrolls across and the Library pane scrolls down, as before.
  • The window's own zoom keys still zoom the window. In the macOS app the menu takes Cmd+ and Cmd- before the page sees them.
  • Each file keeps its zoom while the Studio is open.

Sharp pages

  • pdf.js (the macOS app, and any host without poppler): each page is drawn again at the new width once the zoom holds still for a quarter second. The canvas is capped at 16 million pixels. The page is drawn off screen and copied in, so the one on screen never goes blank.
  • Server page images: GET /api/kb/pdf-page takes dpi= and rounds it up to 200, 300 or 400 (130 stays the default). Each resolution is cached in its own folder with its own ETag. Zoomed past 100%, the viewer asks for the resolution the page's width needs on the screen. A finer image replaces the one on screen only after it has loaded, and is kept for that file, so zooming back out makes no new request.

Also

The file's tab row now stays under the header at the header's measured height. In a narrow pane the header wraps to two lines, and the fixed 49px offset had left the tabs under it.

Checked

  • Go: PageDPI rounding; pages drawn at 130, 300 and 400 dpi (1105, 2550 and 3400 pixels wide for a letter page), each in its own cache file.
  • Web: the zoom steps; wheel factors for a mouse notch, a pinch and line-mode deltas; page widths; the resolution choice; Ctrl and Cmd with the wheel prevented and applied, while a plain wheel still scrolls; pinch gesture events; the keys, with window zoom keys left alone; the 25% and 400% limits; the handle the header buttons use.
  • Chromium and WebKit, in a test Studio with poppler:
    • the buttons step to 110% and 125%;
    • Ctrl with the wheel kept the point under the pointer at the same spot on the page (0.800 before, 0.799 after);
    • the window stayed at scale 1;
    • zoomed pages asked for 200 and 300 dpi;
    • an image zoomed with + and scrolled across;
    • the tab row starts at the header's bottom edge.
  • The same with no poppler on the PATH (the pdf.js path): at 250%, each page canvas was redrawn at 2515 pixels for its 1258-pixel width, with the page's text on it.

HELP.md, REFERENCE.md and README are updated.

A PDF's or Office file's pages, and an image, zoom from 25% to 400% of
the pane's width: + and - in the viewer's header (the percentage between
them fits the pane again), Ctrl or Cmd with the wheel, a trackpad pinch
(wheel events with Ctrl in Chromium, gesture events in Safari and the
macOS window), or +, - and 0 with the document focused. Only the document
grows; its pane scrolls across, the Library pane scrolls down, and the
window's own zoom keys stay the window's. A wheel or pinch keeps the spot
under the pointer in place; the buttons zoom about the middle of the
view. Each file keeps its zoom while the Studio is open.

Pages zoomed in are drawn again once the zoom holds still. pdf.js draws
the page off screen at the new width, up to 16 million pixels, and copies
it in. The server's page images take dpi= (200, 300 or 400 besides the
130 they are drawn at), each cached in its own folder, and the viewer
asks for the resolution the width needs on the screen; a finer image
replaces the shown one once it has loaded, and is kept for the file.

The file's tab row now stays under the header at the header's measured
height: in a narrow pane the header wraps to two lines, and the fixed
offset left the tabs under it.
@mattshax
Matthew Shaxted (mattshax) merged commit 077cef2 into main Nov 20, 2026
14 checks passed
@mattshax
Matthew Shaxted (mattshax) deleted the viewer-zoom branch November 20, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant