TPTruPDF

Keyboard shortcuts

Default key map, wired automatically by <DocViewer>. Mod = Ctrl on Windows / Linux, Cmd on macOS.

Global

ShortcutAction
Mod+FOpen search (works even while typing in an input)
Mod+POpen print dialog
Mod+SOpen save dialog
Mod+ZUndo annotation change
Mod+Shift+Z / Mod+YRedo annotation change
EscapeCancel active tool (back to text selection), dismiss panels / modals

No modifier needed:

ShortcutAction
/ Page DownNext page
/ Page UpPrevious page
HomeFirst page
EndLast page
+ / =Zoom in
- / _Zoom out
0Reset to 100%

Annotation editing

ShortcutAction
Mod+CCopy selected annotations
Mod+XCut selected annotations
Mod+VPaste onto the current page
Mod+DDuplicate the selection in place
Mod+ASelect every annotation on the current page
Delete / BackspaceDelete the selection (one undo step)

Tools

Single letter, no modifier:

KeyTool
VSelect
EEraser
HHighlight
UUnderline
KStrikethrough
QSquiggly
IFreehand ink
TFree text
SSticky note
RRectangle
OEllipse
LLine
AArrow
MRubber stamp
DDistance
CCount
XMark for redaction

Text inputs and on-screen keyboards

Every shortcut except Mod+F and Escape is suppressed while an <input>, <textarea>, <select>, or contenteditable element has focus — users can type freely into form fields and free-text annotations, and on-screen keyboards never trigger tool switches accidentally.

Custom chrome

Hosts that render their own UI around the engine (instead of the full <DocViewer>) can reuse the same key map:

import { useKeyboardShortcuts } from '@trupdf/viewer';
 
useKeyboardShortcuts(engine, {
  onSearchOpen: () => searchInput.current?.focus(),
  onPrintOpen: () => setPrintDialogOpen(true),
  onSaveOpen: () => setSaveDialogOpen(true),
  onEscape: () => closePanels(),
  target: viewerRootEl, // defaults to window; pass an element to scope
});

All callbacks are optional — omit onPrintOpen and Mod+P does nothing, which is also the simplest way to opt out of a shortcut in a custom-chrome build. Pass target to keep the listeners scoped to the viewer element so the rest of your app keeps its own shortcut handling.

Plugin hotkey hints

The hotkey field on a plugin ToolbarAction (or preset button) is a display hint — it renders in the button's tooltip so users can discover it. Bind the actual key handling in your host:

sdk.install({
  id: 'review-plugin',
  toolbar: [{
    id: 'mark-reviewed',
    label: 'Mark reviewed',
    hotkey: 'Mod+R', // shown in the tooltip
    handler: () => markReviewed(),
  }],
});