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.
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 annotationdocument_id
: The ID of the documentuser_id
: The ID of the user that created the annotationuser_name
: The display name of the user that created the annotationcontext
: Please see the context page for an explanation ofcontext
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 locatedrect
: 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 isComment
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 rectangleopacity
: The opacity of the border of the rectanglewidth
: 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 annotationwidth
: 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 textfont
: Which font is being used and the font weighttext-align
: The alignment of the textbgColor
: The color of the space within the rectangle, behind the text. Can be a hex color or the stringtransparent
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 containsinreplyto
: The ID of the annotation this comment is associated with