Annotation API
The annotation
object is an instance accessible from the main mupdfwv.MuPDFWebViewer instance as follows:
This assumes you have returned your instance name as mupdf
from the initMuPDFWebViewer() promise!
annotation
The annotation
object has the following methods:
remove
remove(config: { annotations: Array<{ name: string; pageIndex: number } | { oid: number; pageIndex: number }>, emitEvent?: boolean })
Removes annotations.
- Arguments:
- config – (required) The configuration object.
Config object:
- Arguments:
- annotations – (required) Array of annotation information to remove.
- emitEvent – (optional) Whether to emit events.
- Returns:
Promise
.
Example
get
get(config?: { pageIndex: number })
Gets annotations. Returns array of annotations.
- Arguments:
- config – (optional) The configuration object. If undefined returns all annotations for all pages.
Config object:
- Arguments:
- pageIndex – (required) Page index.
- Returns:
Promise<mupdfwv.Annotation[]>
.
Example
add
add(config: { annotations: Annotation[]; emitEvent?: boolean })
Adds annotations. Returns array of added annotations.
- Arguments:
- config – (required) The configuration object.
Config object:
- Arguments:
- annotations – (required) an array of annotation objects.
- emitEvent – (optional) Whether to emit events.
- Returns:
Promise<mupdfwv.Annotation[]>
.
undo
undo()
Undoes annotation operations and returns success status.
- Returns:
Promise<{ success: boolean; }>
.
Example
redo
redo()
Redoes undone annotation operations and returns success status.
- Returns:
Promise<{ success: boolean; }>
.
Example