The viewer types are built on the card framework, so you implement them as a type IViewerCard.
Prerequisites: Before creating a custom viewer type, review the information about cards in Card Framework. See Viewer Architecture for an overview about how cards are used in viewer types.
This page contains the following information:
A viewer card definition must implement the IViewerCardConfig interface, which extends the ICardConfig interface.
When creating a viewer card, you set many of the same required properties as for a standard card definition. The IViewerCardConfig object also requires you to set additional properties described in the following sections:
Note: Viewer cards do ignore some of the ICardConfig properties.
The viewerType property is a unique string that identifies the viewer type. Use this property through the API to indicate when a viewer type is active and when to switch viewer types.
For reference content, see IViewerCardConfig.viewerType.
Viewer cards require a card instance unlike standard cards. The createInstance property is a method that the card framework invokes when a IViewerCollection is created. The IViewerCollection is then used to create the viewer card instance. See Step 2 - Implement the viewer card instance.
For reference content, see IViewerCardConfig.createInstance.
The Relativity Review Interface executes the supportsItem (IViewerCardConfig.supportsItem) method to determine whether a viewer type supports a specific item in the queue. It returns a Boolean value or a Promise that resolves to a Boolean value, which indicates whether the queue item is supported by the viewer type.
Review the following guidelines for using the supportsItem
method:
fileTypeId parameter - The fileTypeId
is one of the parameters passed to the supportsItem
method. It indicates the ID of the native file type for the queue item when its available. To view a list of native file types, query the [EDDSDBO].[NativeType]
table in the workspace database. You can use this information to determine if the viewer type supports the provided queue item.
Note: The file type may be unavailable. For example, a Document may have long text fields and images, but no native. No file type ID is available, because a native file isn't associated with the Document.
Ensure method performance - Consider performance when retrieving remote information for a custom viewer type. Avoid slowing navigation by optimizing the performance of the supportsItem
method, which is invoked regardless of the active viewer type.
Memoize this method - The supportsItem
is called multiple times for a specific queue item parameter. To optimize performance, memoize this method so that it returns cached results when possible. This approach improves navigation performance.
Check the item type property - Not all queue items are Documents. They could also be files uploaded to the file field of a Relativity Dynamic Object (RDO) or a custom queue item type. Check the IQueueItem.type property to ensure the viewer type supports the item. For information, see Unsupported Items.
For reference content, see IViewerCardConfig.supportsItem.
Viewer cards require a card instance to function properly unlike standard cards. The card instance for viewer cards (IViewerCardInstance) requires additional parameters as follows:
type - This property should be the same as IViewerCardConfig.viewerType property for the viewer card. For reference content, see IViewerCardInstance.type.
id - This property should be a string unique to this viewer. For example, the native viewer ID is ri-native-viewer. For reference content, see IViewerCardInstance.id.
cardLoadItem - This property defines the method called when the viewer card should load a new queue item. The viewer collection invokes this method to load a Document or file in the custom viewer type. For information about implementing this method, see Loading Queue Items, and see IViewerCardInstance.cardLoadItem for reference content.
The viewer card definitions are registered at application startup with the IExtensionConfig object. They are registered on the extensions configuration object by adding them to the IExtensionConfig.viewers array.
Note: Unlike standard cards, viewer card definitions can't be registered on-the-fly and they aren't added to the IExtensionConfig.cards array.
After the viewer card definition is added to the extension configuration, the viewer type registration is complete. Don't manually create an instance of a viewer type. The viewer collection automatically performs this operation.
Review the code sample for a custom viewer type at Sample Viewer Type.