Web SDKv1.0.0

Annotations

The author written into every comment, Acrobat's shared-review rule for the Comments panel, and the lists every picker offers: colors, highlighter and note colors, line weights, mark sizes, border styles and line endings. The annotation tools and the Comments panel's editing need a license that includes annotations.
AnnotationsConfigconfig.annotations

Example

viewer.tsTypeScript
annotations: {
  author: session.user.displayName,
  palette: [
    { color: '#0B3D91', label: 'Brand navy' },
    { color: '#E03C31', label: 'Brand red' },
    '#1F2937',
  ],
  highlightColors: ['#FFF59D', '#C5E1A5'],
  strokeWidths: [1, 2, 3],
}

Options 9

authorstringDefault'' (none)
Written into each comment as its author: notes, highlights, text boxes, drawings, shapes, stamps, replies and statuses. The note composer shows the author's name and initials at the top, and the name is stored on every note, highlight, text box, drawing, shape and stamp the user adds, and on every reply and status, where every other reader shows it as the author. Empty, the composer reads "You" and the note carries only its text and color, so a host that does not know who is signed in gives nothing away by accident.
authorTypeScript
const viewer = new PDFViewer(container, doc, {
  annotations: { author: session.user.displayName },
});
ownCommentsOnlybooleanDefaultfalse
Acrobat's shared-review rule: the Comments panel edits and deletes only the author's own comments (those whose stored author matches author); anyone replies and sets a status. Off, as in Acrobat on an ordinary file, anyone edits or deletes any comment that is not Locked. The API is your code and is not held to it.
paletteColorListDefaultthe SDK's twelve
Every color picker's swatches — shapes, drawing, text, and the highlighter's picker beyond its own row. The SDK's twelve are black, graphite, red, orange, amber, green, teal, blue, indigo, violet, pink and white. Shapes start in the palette's first color when it leaves out the SDK's default ink; new text starts in pure black, or in your palette's first color when your own palette leaves black out.
highlightColorsColorListDefaultyellow, green, blue, pink
The highlighter's own row. Highlights — from the Highlight tool, Mark text or the selection bar, whichever is used first — start in the first of highlightColors when yellow is not in it.
noteColorsColorListDefaultyellow, green, blue, pink
A sticky note's colors.
strokeWidthsreadonly number[]Default0.5, 1, 2, 4, 6
Line weights (pt) for drawing and shapes. Sorted and de-duplicated. Shapes start at the listed weight nearest 2 pt.
markSizesreadonly number[]Default12, 16, 20, 28, 40
The Marks tools' sizes (pt): a tick, a cross, a dot. A form's box is 10–14 pt, a checklist's 20. Sorted and de-duplicated.
borderStylesreadonly BorderStyle[]Default'solid', 'dashed', 'dotted', 'cloudy'
The drawing bar's Style picker, in order. BorderStyle is 'solid' | 'dashed' | 'dotted' | 'cloudy'; a cloud goes only round a rectangle, ellipse or polygon. [] hides the picker, and every shape is drawn solid.
lineEndingsreadonly LineEnding[]Defaultall ten
The Line and Arrow tools' Ends picker, in order (any of 'none', 'square', 'circle', 'diamond', 'openArrow', 'closedArrow', 'butt', 'rOpenArrow', 'rClosedArrow', 'slash' — see LineEnding). [] hides the picker, and each tool keeps its own caps.

Notes

The shapes. ColorList is readonly (string | ColorOption)[]. A ColorOption is { color: string; label: string }: color is '#rgb' or '#rrggbb', stored and written as '#RRGGBB'; label is what the color is called — tooltip and screen-reader name — and empty means the hex.

Your own colors. The color lists are ink: they are written into the document, so they do not follow the theme. A bare hex is named by itself for screen readers; give a ColorOption to name it in your users' language. The built-in colors are named from the string table (color.*, ink.*).

An invalid entry is skipped. A value that is not a hex color is skipped with a console warning, and a list with nothing valid left keeps the default — a picker is never empty. Each dropped value is reported once per page as [Kernstra] <option>: ignoring <value> (for example, [Kernstra] annotations.palette: ignoring "teal"). An eraser value that has to be corrected is reported only if you set it yourself. A color listed twice (#f00 and #FF0000 are the same) is shown once. Weights and sizes are sorted and de-duplicated the same way.

A tool starts on your lists: shapes in the palette's first color when it leaves out the SDK's default ink, and at the listed weight nearest 2 pt; new text in pure black, or in your palette's first color when your own palette leaves black out; highlights in the first of highlightColors when yellow is not in it. A color the user picks is kept.

A viewer reads the picker lists once, when it is built; to change them, build a new viewer (see Locale for what a rebuild keeps).