Instance API

Annotations and Selection

Create, update, delete, and select annotations with ViewerInstance APIs.

Annotation CRUD

  • create(annotation | annotation[])
  • update(annotation | annotation[])
  • delete(id | ids | annotations)
  • getAnnotations(pageIndex?)

Selection helpers

  • getSelection()
  • getTextSelection()
  • setSelectedAnnotations(...)
  • getSelectedAnnotations()

Deletion patterns

  • API (compat): delete(id | ids | annotations)
  • API (core): deleteAnnotation(id) and deleteAnnotations(ids)
  • Chrome UI:
    • Press Delete or Backspace when annotations are selected.
    • Use the delete button in the annotations sidebar row.

Fast creation from text selection

  • createNoteFromSelection(contents?)
  • createLinkFromSelection(url)
  • createHighlightFromSelection()
  • createUnderlineFromSelection()

Mode and author

  • setAnnotationMode(mode)
  • getAnnotationMode()
  • setAnnotationCreatorName(name)
  • getAnnotationCreatorName()