Web SDKv1.0.0

AnnotationsApi.update()

Changes rect, contents, author, color, fillColor (a square's, circle's or polygon's; refused on anything else) or opacity of the annotation with that id. A color with no alpha changes the color alone; one with an alpha, or an opacity beside it, sets the opacity too; null is refused, a color entry cannot be removed. A new rect moves and scales what the annotation draws — quads, strokes, line ends, a polygon's or polyline's corners — with it; a stamp's or text box's own picture is fitted to it.

update({ color }) rewrites the entry and rebuilds the appearance, so every reader draws the new color. A text box is refused with INVALID_ARGUMENT, since its color is its words'. A stamp accepts the call, but its picture is its own and keeps its colors: only the color entry and the opacity change. update() stamps the modification date when it changes something; it also acts on a reply or a status entry as on any annotation. Needs the annotations feature, and forms too for a form field's widget.

methodAnnotationssince 1.0.0

Signature

update(id: string, changes: AnnotationUpdate, options?: SignedDocumentOptions): Promise<void>

Parameters

ParameterTypeDescription
idstringThe annotation's id.
changesAnnotationUpdate{ rect?, contents?, author?, color?, fillColor?, opacity? }.
options?SignedDocumentOptions{ invalidateSignatures? }.

Returns

Promise<void>

Throws

  • INVALID_ARGUMENT — an id no annotation has, a text box's color, fillColor on anything but a square, circle or polygon, a null color, or a value the API does not take.
  • PAGE_ERROR — the change could not be written (the color cannot be written).
  • FEATURE_NOT_LICENSED — the license lacks annotations (or forms, for a form field's widget).
  • DOCUMENT_CLOSED — the document has been closed.
  • INVALID_STATE — a certified document whose certification forbids it, unless options.invalidateSignatures; or a progressive document still downloading.

Example

TypeScript
await doc.annotations.update(id, { contents: 'Checked — fine', color: '#12B76A' });

More in AnnotationsApi