SDK Samples

Web SDK

In-browser PDF viewing, annotations, forms, signatures, and redaction. 37 samples spanning every major UI surface.

42 samples11 categoriesProduct home →Guides →
AI assistants

Wire up @nutrient-sdk/viewer-mcp — an MCP server that gives AI assistants live access to Web SDK docs, API, examples, and changelog. Add it to your MCP client config:

MCP client config
{
  "mcpServers": {
    "Nutrient": { "command": "npx", "args": ["@nutrient-sdk/viewer-mcp"] }
  }
}

Prefer agent skills? Follow the Web SDK agent skill guide to install Nutrient skills directly into your coding agent.

01

Fonts in the Viewer

Why a document renders with the wrong type, and how customFonts fixes it — the same document rendered without its fonts and with them, side by side

Fonts
02

Annotation Permissions

Role-based annotation permissions with a teacher/student classroom model — toggle visibility per student

Annotations
03

Annotation Presets

Customize default properties for annotation tools including colors, sizes, fonts, and line styles with live preview

Annotations
04

Annotation State Management

Save and restore annotation states locally with version control-like functionality for managing document changes

Annotations
05

Bookmark & Outline Navigation

Browse the document's table of contents and bookmarks in a custom sidebar with click-to-navigate

User Interface
06

Brightness & Contrast

Bidirectional slider to brighten dark or poorly-scanned documents, or enable night mode for comfortable dark reading

User Interface
07

Collaboration Comments

Threaded comment replies with author tracking, @mentions, and configurable display modes (Fitting, Floating, Popover)

Annotations
08

Content Editing API

Advanced content editing with text detection, find & replace, and AI text generation

Content Editor
09

Counting Annotations

Click anywhere on a document to place numbered markers using custom-rendered annotations with a sidebar tracker

Annotations
10

Construction Measurement

Measure distances on a construction floor plan by dropping two pins. The measurement line and its live distance label update as you drag either pin.

Annotations
11

Cross-Page Text Comparison

Extract and compare full document text across page boundaries with visual diff highlighting and change navigation

Document Comparison
12

Custom Menu Interface

A completely custom menu interface with custom toolbar, annotation tools, document comparison, and measurement capabilities

User Interface
13

Custom Renderers

Creative custom annotation renderers showcasing visual effects, animations, interactive widgets, and more

Annotations
14

Custom UI Form Creator

Build custom form builder UI by hiding SDK defaults and replacing with your own components

Forms
15

Document AssemblyWIP

Assemble documents by dragging pages between two panels with multi-select, reorder, rotate, duplicate, delete, upload, and export

Document Editor
16

Document Loading Methods

Demonstrate all supported document loading methods: URL, ArrayBuffer, Blob, and Base64. Includes file upload with method selection

User Interface
17

Document Markup Modes

View Word documents with tracked changes and comments in different markup modes: no markup, original, simple markup, and all markup

Document Conversion
18

Document Search

Search through PDF documents with context-aware results, instant highlighting, and automatic navigation to matches

User Interface
19

Search with Overlay Highlights

The same document search, but every match is highlighted with a CustomOverlayItem instead of a HighlightAnnotation — nothing is written to the document and teardown is one call per overlay

User Interface
20

Form Data Pre-Fill

Programmatically populate PDF form fields from JSON data presets with editable field values and apply/clear controls

Forms
21

Form Designer

Drag and drop form fields onto PDF documents with an intuitive form creator mode for building interactive forms

Forms
22

Form Validation

Client-side validation rules with visual feedback on PDF form fields using a declarative rule engine

Forms
23

Grouped Form Fields

Drag and drop grouped form fields with image backgrounds, company logos, checkboxes, signatures, and date fields. Moving or deleting any element affects the entire group.

Forms
24

Indexed Cross-Document Search

Search a corpus of mixed PDFs and Office documents using a prebuilt full-text index, then jump straight to the matching page in the viewer with the term highlighted

User Interface
25

Indexed Cross-Document Search (Server-Side)

Same cross-document search, but with the index in Postgres and queries served by an API route. Demonstrates the production path beyond a static JSON dump

User Interface
26

Keyword Highlight

Automatically search and highlight configurable keywords in a document with color-coded annotations

Annotations
27

Layer Management

Toggle PDF layer groups (OCGs) to show or hide building systems on a construction floor plan with quick presets

User Interface
28

Linked Exhibits

Cross-document navigation through link annotations — a contract and its exhibits, where every citation is a clickable link that swaps the document in the same viewer

Annotations
29

Multi-Document Tabs

View multiple PDF documents in a tabbed interface with page position memory, closeable tabs, and file upload

User Interface
30

Night Mode

Toggle night mode in the PDF viewer with a custom toolbar button using CSS filter inversion

User Interface
31

Numbered Callouts

Bluebeam/Procore-style numbered bubble + leader arrows for construction punch lists, with a live legend sidebar

Annotations
32

One-Step Link

Add a visible, clickable link in a single guided action — one button prompts for text, color, and URL, then one click creates the text label and link annotation together

Annotations
33

Patient Intake Forms

Digital patient check-in with smart form pre-population, progressive form completion, and HIPAA-compliant data handling

Forms
34

Search & Redact

Permanently redact sensitive information using preset PII patterns (SSN, credit card, email, phone), custom text terms, or regular expressions

Redaction
35

Simple Signing Demo

Complete signature workflow with drag-and-drop field placement, electronic signatures, role-based permissions, signature flattening, and a visible digital signature on an appended certificate page via DWS API

Signatures
36

Slot UI Customization

Custom sidebar, comment badges, and interactive slot actions — demonstrating the Nutrient Web SDK slot UI customization API

User Interface
37

Text Comparison

Side-by-side PDF comparison with synchronized viewing and interactive change tracking

Document Comparison
38

Hybrid Comparison

Compare a document pair visually (overlay) and textually at once, with auto-highlighted changes and reviewer markup on both views

Document Comparison
39

Hybrid Comparison — Custom Overlay

Single-view comparison where each text change is a custom-overlay callout pinned to its location, showing the before → after value

Document Comparison
40

Text Extraction

Extract text from PDF pages with current-page or full-document view, copy to clipboard, and download as plain text

Content
41

Watermark

Add configurable text watermarks to every page with customizable text, font size, color, opacity, and rotation

Document Editor
42

Zoom Level Display

Display the current zoom level as a percentage in a custom toolbar button with click-to-reset functionality

User Interface