Skip to main content
Lightweight annotation layer for documents. Supports drawing, text, and stickers.
Whiteboard currently works only with PDF documents. See PDF setup first.

Quick start

To disable the whiteboard layer entirely, set modules.whiteboard to false:

Tools / modes

  • select — default; select/drag/resize, drop stickers/text
  • draw — draw strokes only
  • erase — erases strokes only
  • text — click to add text
These modes are intentionally strict to avoid ambiguous interactions.

API methods

All APIs are exposed via superdoc.whiteboard.

register

Register palette items (e.g. stickers, comments). For stickers, src is an image URL and can point to common browser-supported formats (for example: svg, png, jpg, webp, or data URL).

Sticker drag-and-drop checklist

For sticker drag/drop, keep the id contract explicit:
  1. Register sticker ids when whiteboard is created.
  2. Set application/sticker to the exact sticker id on drag start.
  3. Use text/plain only as optional fallback content (empty string is fine).
If a dropped id is not in the registered sticker list, whiteboard continues through other drop handlers and may use text/plain.

getType

Get registered items by type.

setTool

Set the current tool: select, draw, erase, text.

setEnabled

Enable or disable whiteboard interactivity.

setOpacity

Set overlay opacity (0–1).

getWhiteboardData

Export annotations (normalized coordinates).

setWhiteboardData

Import annotations.

rerender

Force re-render for all pages.

Events

whiteboard:init

Fired when the whiteboard instance is created.

whiteboard:ready

Fired when all whiteboard pages are ready.

whiteboard:change

Fired on any data change. Receives full whiteboard JSON.

whiteboard:enabled

Fired when interactivity is toggled.

whiteboard:tool

Fired when the active tool changes.

Import / export

Whiteboard data is stored in normalized coordinates so annotations stay stable across zoom levels.