DocViewer API

DocViewer API

  • Docs
  • API
  • Help
  • Blog

›Guides

Getting Started

  • Spinning up a Local Instance
  • Using the DocViewer Client
  • Build Your Own Client

Guides

  • Admin Interface
  • DynamoDB Interface
  • Session Types
  • Types of Annotations
  • Annotation Context
  • Anonymizing & Hiding Annotations
  • Annotation Audit Events
  • Annotation Notifications
  • Document Conversion
  • Document Rotation
  • Supported File Types
  • Supported Fonts
  • DocViewer API Keys
  • DocViewer Environments
  • Re-rendering Canvas Files
  • API Versioning

Types of Annotations

Intro

Docviewer supports 6 different types of annotations, as well as comments. These annotations types do not match the XFDF standard, though there is some carryover in terminology.

  • Point
  • Area
  • Highlight
  • Strikeout
  • Free Draw
  • Free Text
  • Comments

Please see the Annotations API page for the data type for each parameter, as well as example API calls.

All annotations include the following attributes:

  • id: The ID of the annotation
  • document_id: The ID of the document
  • user_id: The ID of the user that created the annotation
  • user_name: The display name of the user that created the annotation
  • context: Please see the context page for an explanation of context
  • type: The type of this annotation (see below for a list of the Annotation Types)
  • page: The number of the page (0 indexed) on which this annotation is located
  • rect: A description of the physical space occupied by the annotation. Not present for comments. The origin is the upper left corner of the document.

Point Annotations

The Point Annotation is similar to the XFDF Text Annotation, or the PSPDFKit Note Annotation. The point annotation is an icon that can be placed on the document to "point" to something of interest. It may or may not have a comment associated; it is possible to have a Point Annotation by itself, with no associated text or comments.

The Point Annotation includes:

  • type: text (This is a holdover from XFDF standard)
  • icon: Specifies the icon to be displayed. Currently the only supported value is Comment
  • color: The color of the icon

Area annotations

The Area Annotation is a rectangle with a colored border and transparent interior.

The Area Annotation includes:

  • type: square
  • color: The color of the border of the rectangle
  • opacity: The opacity of the border of the rectangle
  • width: The width of the border of the rectangle

Highlight Annotations

The Highlight annotation is fairly straightforward - it is a selection of text that has been highlighted.

The Highlight Annotation includes:

  • type: highlight
  • coords: Defines the shape of the highlight. It contains coordinates for each corner of each section, or rectangle, of the highlight. The origin is the upper left corner of the document.
  • color: The color of the highlight rectangles

Strikeout Annotations

The Strikeout Annotation is fairly straightforward - it is a selection of text that has been struck through.

The Strikeout Annotation includes:

  • type: strikeout
  • coords: Defines a bounding box around the strikeout. It contains coordinates for each corner of each section. The origin is the upper left corner of the document.
  • color: The color of the strikeout line

Free Draw Annotations

The Free Draw Annotation, also referred to as the Ink Annotation, is what allows users to draw directly on the document. It consists of a series of strokes, each stroke consisting of a series of points. Color and width may be specified, but all strokes in a single ink annotation share the same color and width.

The Free Draw Annotation includes:

  • type: ink
  • color: The color of the strokes in the annotation
  • width: The width of the strokes in the annotation. Please note that width is also stored on each point in the inklist, in order to support varying widths within a stroke, based on pressure sensitivity. This feature is only available on platforms that support pressure sensitivity.
  • inklist: A list of strokes, which each contain a list of points. Each point contains location, width (where supported), and opacity. Please see the Annotations API Page for specifics.

Free Text Annotations

The Free Text Annotation is a way for users to enter text directly on the document. It is similar to a textbox in that it consists of a rectangle that contains typed text.

The Free Text Annotation includes:

  • type: freetext
  • color: The color of the text
  • font: Which font is being used and the font weight
  • text-align: The alignment of the text
  • bgColor: The color of the space within the rectangle, behind the text. Can be a hex color or the string transparent
  • contents: The text itself

Comments

Comments can be left on any annotation except Free Text, and multiple comments on a single annotation will create a comment thread.

A Comment includes:

  • type: commentReply
  • contents: The text that the comment contains
  • inreplyto: The ID of the annotation this comment is associated with
← Session TypesAnnotation Context →
DocViewer API
Docs
Getting StartedGuidesAPI Reference
More
BlogCanvas Community
Instructure Logo
Copyright © 2025 Instructure, Inc.