MeldUI

Document Viewer: Features

Every capability flag on the features prop, plus per-feature configuration shapes.

The features prop is a flat object of flags merged over sensible defaults. Disabled flags do not register their corresponding EmbedPDF plugin, which means the plugin package is tree-shaken from your bundle. The minimum required plugins (DocumentManager, Viewport, Scroll, Render, Tiling) are always registered.

Defaults are not all false. Out of the box you get a full read/navigate/search/print viewer: zoom, rotate, pan, fullscreen, search, selection, outline, thumbnails, print, download, keyboardShortcuts, and touchGestures default to true. You opt in to annotations, commentThreads, undoRedo, spread, and all Phase-2 editing features (they default to false). Pass only the flags you want to change — they’re merged over these defaults.

<DocumentViewer
  source="/doc.pdf"
  wasm-url="/pdfium.wasm"
  :features="{ zoom: true, search: true, annotations: true }"
/>

Changing features at runtime requires a :key. features (and featureConfig) are read once, at mount — EmbedPDF registers its plugin batch in onMounted and never re-reads it. Mutating a flag on a live viewer is silently ignored. To apply a change, remount the component with a :key derived from the feature set (the demo above does exactly this). See Reloading the viewer with :key for the full rule and the which-inputs table.

Flag reference

FlagDefaultWhat it enables
zoomtrueZoom in / out buttons, fit presets (page / width / actual), pinch-to-zoom on touch
rotatetrueRotate CW / CCW per 90°
spreadfalseTwo-page spread view mode toggle
pantrueHand-tool (drag-to-pan) interaction mode
fullscreentrueFullscreen toggle (F11 if keyboardShortcuts is on)

Search / selection

FlagDefaultWhat it enables
searchtrueSearch popover with case / whole-word toggles, prev / next, match counter
selectiontrueText selection on the page + copy-to-clipboard

Side panels

FlagDefaultWhat it enables
outlinetrueDocument outline / bookmark tree side panel
thumbnailstrueThumbnail grid side panel

Export

FlagDefaultWhat it enables
printtruePrint toolbar button (uses native browser print dialog)
downloadtrueDownload button. PDFs use the Export plugin; image / text / markdown download straight from the source. Pass downloadUrl to serve a server-driven / re-encoded copy instead

Annotations (Phase 1)

FlagDefaultWhat it enables
annotationsfalseHighlight tool + sticky-note comment tool, plus full annotation CRUD via the programmatic API
commentThreadsfalseThreaded comments overlay (replies + resolved state). Requires annotations
undoRedofalseUndo / redo via Ctrl+Z / Ctrl+Shift+Z and the programmatic API (undo(), redo(), canUndo(), canRedo()). There are no dedicated toolbar buttons today

Editing (Phase 2 — opt-in)

Not yet surfaced. Enabling these flags registers the EmbedPDF plugin (and so adds to your bundle), but Phase 2 has no toolbar UI and no DocumentViewerInstance methods wired up yet. The “What it enables” column below describes the intended Phase-2 behavior, not what ships today. Leave these false unless you’re driving the underlying plugin yourself.

FlagDefaultWhat it enables (planned)
stampsfalseStamp tool + stamp library picker
signaturefalseSignature pad dialog + place-signature flow
redactionfalseText-redact + area-redact tools + saveAsCopy burn-in
formsfalseInteractive PDF form-field rendering and setFieldValue API
attachmentsfalseAttachments side panel + downloadAttachment API

Interaction

FlagDefaultWhat it enables
keyboardShortcutstrueArrow keys (page nav), + / - (zoom), R (rotate), Ctrl+F (search), F11 (fullscreen), Esc (close popovers), C / O / T (toggle comment / outline / thumbnails panel)
touchGesturestrueSwipe page-nav, double-tap to zoom, pinch zoom (in combination with zoom)

Screenshot protection

FlagDefaultWhat it enables
screenshotProtectionfalseClient-side screen-capture deterrents: obscure-on-blur/tab-hide overlay, screenshot/devtools hotkey block overlay, print-blank, and right-click / drag-out blocking. Not a guarantee — see Screenshot Protection for behaviour and limits

screenshotProtection is a deterrent, not a guarantee, and it’s purely additive. It deters casual capture only and is removable via browser DevTools. It does not change selection, print, or download — to also block copying or downloading, set those flags yourself. Full details and caveats live on the Screenshot Protection page.

Per-feature configuration: featureConfig

featureConfig is keyed by feature name and lets you tune a plugin’s behaviour without re-implementing it.

import type { FeatureConfig } from '@meldui/vue'

const featureConfig: FeatureConfig = {
  zoom: { min: 0.25, max: 10, defaultMode: 'fit-width' },
  annotations: {
    author: '[email protected]',
  },
}

zoom

OptionTypeDefaultNotes
minnumber0.25Minimum scale factor (the zoom plugin’s default when omitted)
maxnumber10Maximum scale factor (the zoom plugin’s default when omitted)
stepnumberDeclared on the type but not currently applied — zoom-in/out use the plugin’s built-in step
defaultMode'fit-page' | 'fit-width' | 'actual-size''fit-width'Initial zoom preset

annotations

OptionTypeDefaultNotes
authorstringundefinedAttached to created annotations as the author. No automatic fallback to currentUser — pass it explicitly if you want authored annotations
useAnnotationModebooleanfalseWhen true, new redactions are stored as pending PDF REDACT annotations instead of applied immediately
defaultToolsAnnotationToolConfig[]Declared on the type but not currently applied — the highlight palette is fixed to HIGHLIGHT_COLORS. See the Highlight colour palette section below

Phase 2 config (stamps / signature / redaction) is plumbed to the plugin but not yet driven by any UI/API. These shapes pass through to createPluginRegistration so they’re ready for when the editing UI lands; they have no visible effect today.

stamps (Phase 2)

OptionTypeNotes
librariesStampLibraryConfig[]Preload stamp libraries from URL or ArrayBuffer
defaultLibrary{ id, name, categories? } | falseSet the toolbar’s default library; false to hide the library picker

signature (Phase 2)

OptionTypeNotes
mode'signature-only' | 'signature-and-initials'Whether the user is prompted for initials in addition to a full signature
defaultSize{ width: number; height: number }Initial bounding box for placed signatures

redaction (Phase 2)

OptionTypeNotes
useAnnotationModebooleanIf true, new redactions are pending (visible in panel) and applied via applyAllRedactions(); otherwise they burn in immediately

Highlight colour palette

@meldui/vue exports the 5 canonical colours as HIGHLIGHT_COLORS so you can render swatches matching the floating tooltip:

import { HIGHLIGHT_COLORS, DEFAULT_HIGHLIGHT_COLOR } from '@meldui/vue'

console.log(HIGHLIGHT_COLORS)
// [
//   { name: 'Yellow', value: '#FFCD45' },
//   { name: 'Green',  value: '#92E89E' },
//   { name: 'Blue',   value: '#8FCFEF' },
//   { name: 'Pink',   value: '#FFA0BD' },
//   { name: 'Purple', value: '#C8A5DD' },
// ]
console.log(DEFAULT_HIGHLIGHT_COLOR) // '#FFCD45'

Pass any of these values directly into updateAnnotation(id, { color }).

See also