"Fit Selection in Window" for Adobe InDesign — the missing zoom function.
InDesign has "Fit Page in Window" and "Fit Spread in Window", but no "Fit Selection in Window". This script fills that gap: select any object (or multiple objects), run the script, and the view zooms to show your selection centered with a 10 % margin — regardless of which page it's on.
Created and tested with Adobe InDesign 2026 (v21.3) on macOS.
Should work with recent CC versions. Not tested on older versions or Windows.
- Open the Scripts panel: Window → Utilities → Scripts
- Right-click the User folder → Reveal in Finder
- Copy
ZoomToSelection.jsxinto theScripts Panelfolder - The script appears immediately in the Scripts panel — no restart needed
Edit → Keyboard Shortcuts → Product Area: Scripts
Find ZoomToSelection in the list, assign your preferred shortcut (luc prefers Command Shift 2), click Assign.
Shortcut suggested sby Claude: ⌥⌘= (mirrors the feel of the existing fit commands ... but luc did not bother to try on his german keyboard )
- Select one or more objects
- Run the script (double-click in Scripts panel, or use your shortcut)
- The view zooms to fit the selection with 10% padding, centered
Works with any page item: text frames, images, groups, shapes.
Handles multi-object selections (zooms to the combined bounding box).
InDesign 2026's scripting API offers no direct scroll position control —
scrollPosition, viewBounds, and setting zoom as a property are all
unavailable or broken. The script works around this by:
- Using
parentPageto reliably identify the page containing the selection - Calling
zoom(ZoomOptions.FIT_PAGE)to establish a zoom reference - Reading
layoutWindows[0].zoomPercentage(the only working zoom API) - Calculating the target zoom from the page/selection size ratio
- Setting
zoomPercentage— InDesign automatically centers on the active selection
This centering behavior (InDesign centers zoom changes on the current selection)
is the key that makes the whole thing work.
luc / lucdesign Vienna
Developed April 2025 with Claude (Anthropic) after considerable API archaeology.
Do whatever you want with it.
This was made with A LOT of help from AI.