This page contains legacy content applicable only to Relativity 10.2 (Foxglove) through Relativity 11.1 (Juniper).
You can use the Relativity Review API to determine the build type, version, and other information about viewer. In addition, it provides an API supports CRUD and other methods for markups and markup sets.
Note: The Relativity Review API will continue to undergo minor contract changes and further enhancements. The following functionality will continue to be supported for the full release of the APIs.
This page contains the following information:
See these related pages:
The Info API contains properties that provide about the Review Interface build type and version. The following code samples illustrate how to get this information:
Build type - ("development"
or "production"
)
review.info.buildType;
Relativity Review RAP version
review.info.version;
Outside In Viewer version
review.info.oiVersion;
You can use the Viewer API to perform CRUD and other operations on markups and markup sets.
Use the following code to access the viewer instance:
var viewer = review.viewer.mainCollection.activeViewer;
The IImageViewer
API exposes multiple methods and properties for interacting with markup sets and markups, such as redactions and highlights.
See the following subsections for more information:
To get the artifact ID of the active (displayed) markup set:
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
var markupSetArtifactId = imageViewer.activeMarkupSetArtifactId;
To set the active markup set:
var markupSetArtifactId = 1234567;
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer.setActiveMarkupSet(markupSetArtifactId).then(function () {
// Markup set updated
});
The IImageViewer
API exposes methods for creating single or multiple markups.
Use the following code to create a single non-full-page text redaction with specified redaction text and font size. This redaction is persisted to the Relativity Redaction database table.
var pageIndex = 0; // Indicates the document's first page.
var markupType = "redaction";
var markupSubType = "text";
var markupLocation = {
x: 100,
y: 200,
height: 250,
width: 150,
};
var options = {
persist: true,
text: "My Redaction Text",
textSize: 20,
};
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer
.createAnnotation(
pageIndex,
markupType,
markupSubType,
markupLocation,
options
)
.then(function () {
// Annotation creation finished
});
Use the following code to create a single temporary full-page highlight that isn't persisted to the Relativity Redaction database table:
var pageIndex = 1; // Indicates the document's second page.
var markupType = "highlight";
var markupSubType = "yellow";
var markupLocation = "fullpage";
var options = { persist: false };
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer
.createAnnotation(
pageIndex,
markupType,
markupSubType,
markupLocation,
options
)
.then(function () {
// Annotation creation finished
});
Use the following code to mass create multiple white full-page redactions and persist them to the Relativity Redaction database table:
var pageIndexes = [0, 2, 3, 8]; // Zero-indexed page numbers
var markupType = "redaction";
var markupSubType = "white";
var markupLocation = "fullpage";
var options = { persist: true };
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer
.massCreateAnnotation(
pageIndexes,
markupType,
markupSubType,
markupLocation,
options
)
.then(function () {
// Annotation creation finished
});
The IImageViewer
API exposes methods for deleting single or multiple markups.
To delete cross redactions from specified pages, use the following code:
var pageIndexes = [0, 2, 3, 8]; // Zero-indexed page numbers
var markupType = "redaction";
var markupSubType = "cross";
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer
.deleteAnnotationType(pageIndexes, markupType, markupSubType)
.then(function () {
// Annotation deletion finished
});
The following list includes additional markup deletion methods:
The IImageViewer
API supports updating a single markup or multiple markups.
⚠️ IImageViewer.updateAnnotation and IImageViewer.updateAnnotations only support changes to markup styles, such as redaction text, text styles, and border styles. IAnnotation.customAnnotationData and IAnnotation.textData support similar changes.
The following code sample illustrates how to update the redaction text size of an existing redaction. For example, you might have the IAnnotation annotation
from prior call that is passed to an update method.
annotation.textData.redactionTextSize = 48;
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer.updateAnnotation(annotation).then(function () {
// Annotation updated
});
You can use the IImageViewer
API to select or deselect markups. Review the following guidelines for markup sets:
markupSetArtifactId
passed into the method doesn't match the Artifact ID of the active markup set, then no markup is selected.markupId
values to select multiple markups.To select markups on the active markup set, see the following code:
var markupSetArtifactId = 1234567;
var markupId: 123;
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer.selectAnnotation(markupSetArtifactId, markupId).then(function () {
// Annotation selected
});
To deselect markups, use the following code:
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer.deselectAllAnnotations();
To listen for new markup events, use the following code:
var myEventHandler = function () {
// Do something
};
var imageViewer = window.top.hydroImageApi.viewer.mainCollection.activeViewer;
imageViewer.on("annotationadded", myEventHandler);
You can listen for all ImageViewerEventType events in this manner.