PrizmDoc Viewer v13.11 Release - Updated
Load Annotations from the Web Tier
Developer Guide > Viewer > How to Customize the Viewer > Work with Annotations > Load Annotations from the Web Tier

Annotation layers may be persisted to the web tier and then loaded back into the Viewer at a later time. On the web tier, the resource representing a layer is referred to as the 'markup layer record' while in the Viewer, it’s referred to as the 'markup layer object'. An important distinction to make is that the layer object in the Viewer has two IDs associated with it while a layer record persisted to the web tier has only one. A layer object in the Viewer has both an 'id' and a 'markupLayerRecordId' while a persisted layer record has only a 'markupLayerRecordId'.

What’s the difference? A layer’s 'id' is a runtime identifier that exists only for the life of the layer object. This 'id' is needed for several reasons; one of them being as a unique object identifier for the period of time when a layer is created in the Viewer but not yet persisted to the web tier. Only when a layer is persisted to the web tier will it have a 'markupLayerRecordId'.

The following is a code example for loading layer records in to the Viewer:

Example
Copy Code
// Get a ViewerControl object
var viewer = new PCCViewer.ViewerControl(viewerElement, {
    documentID: viewingSessionId,
    imageHandlerUrl: "../pcc.ashx"
});
        
        
// Retrieve a list of the annotation layer records persisted on the web tier.
viewer.requestMarkupLayerNames().then(
    function onResolve(annotationLayerRecords) {
        // Load a specific record so that its data is available to the API
        viewer.loadMarkupLayers(annotationLayerRecords[0].layerRecordId).then(
            function onResolve(annotationLayers){
                // A layer object representing the persisted record is now created.
                // Any marks and their associated comments are now displayed
                // on the loaded document.
                console.log("Annotation layer loaded: ", annotationLayers[0]);
            },
            function onReject(reason) {
                console.log("Failed to load annotation layer. ", reason);
            }
        );
    },
    function onReject(reason) {
        console.log("Failed to load annotation layer record list. ", reason);
    }
);