ImageGear .NET v25.1 - Updated
IPCC.LoadMarkupLayersRequest
API Reference > ViewerControl API > IPCC.LoadMarkupLayersRequest

Class: LoadMarkupLayersRequest

(protected) IPCC.LoadMarkupLayersRequest(viewerControl, layerRecordIds)

(protected) new LoadMarkupLayersRequest(viewerControl, layerRecordIds)

The `LoadMarkupLayersRequest` object is created when loading markup layers using IPCC.ViewerControl#loadMarkupLayers. The `LoadMarkupLayersRequest` is a thenable object, which allows Promise-like interactions. Calling the IPCC.LoadMarkupLayersRequest#then method will return a `IPCC.Promise` object. On successful layer loading, the `Promise` success method, if added, is called with the IPCC.LoadMarkupLayer objects created by the loaded layer records. On a load failure, the `Promise` is rejected. The `LoadMarkupLayersRequest` object also provides an event subscription method, to get notified of other types of information. See IPCC.LoadMarkupLayersRequest.EventType. _Note: This constructor should not be used directly. Instead, a LoadMarkupLayersRequest is created by a call to IPCC.ViewerControl#loadMarkupLayers._
Parameters:
Name Type Description
viewerControl string The IPCC.ViewerControl for the loaded document.
layerRecordIds Array.<string> An array of layer record IDs.
Example
function onSuccessfulLoad(annotationLayers) {
   console.log(annotationLayers);
}

function onFailedConvert(error) {
  alert("Markup layer record loading failed, reason:" + (error.message ? error.message : error));
}

// A LoadMarkupLayersRequest object is created by and returned from the call to the ViewerControl#convertDocument method
var LoadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
LoadMarkupLayersRequest.then(onSuccessfulConvert, onFailedConvert);

//register some events
LoadMarkupLayersRequest
  .on(IPCC.LoadMarkupLayersRequest.EventType.LoadMarkupLayersCompleted,
      function(ev) {
          alert("Markup layer loading completed.");
      })
  .on(IPCC.LoadMarkupLayersRequest.EventType.LoadMarkupLayersProgress,
      function(event) {
          alert("Conversion progress: " + event.percent + "%");
      })
  .on(IPCC.LoadMarkupLayersRequest.EventType.LoadMarkupLayersFailed,
      function(event) {
          alert("Markup layer loading failed.");
      })
  .on(IPCC.LoadMarkupLayersRequest.EventType.LoadMarkupLayersCancelled,
      function(event) {
          alert("Markup layer loading was cancelled.");
      });

Members

(static, readonly) EventType :string

A list of events that can be triggered by the IPCC.LoadMarkupLayersRequest object. **Note:** This enumeration is for convenience for API developers. Instead of using this enumeration, you can pass string values of the eventType (enumeration values)
Type:
  • string
Properties:
Name Type Description
LoadMarkupLayersFailed string
LoadMarkupLayersCompleted string
LoadMarkupLayersCancelled string
LoadMarkupLayersProgress string
See:

(readonly) errorCode :number

Gets the errorCode if there is a failure during load process. This property is defined on all LoadMarkupLayersRequest objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
var errorCode = LoadMarkupLayersRequest.errorCode;

(readonly) progress :number

Gets the current estimate of the loading process progress. This property is defined on all LoadMarkupLayersRequest objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • number
See:
Example
var percentProgress = LoadMarkupLayersRequest.progress;

(readonly) viewerControl :Object

Gets the viewer control associated with this request. This property is defined on all LoadMarkupLayersRequest objects. _This is an ECMA 5 accessor property that is defined only in browsers supporting ECMA 5. This property is not available in the older browsers like IE8. For the greatest browser compatibility, use the corresponding getter and setter methods._
Type:
  • Object
See:
Example
var viewerControl = LoadMarkupLayersRequest.viewerControl;

Methods

cancel() → {IPCC.LoadMarkupLayersRequest}

Cancels the load request. The `IPCC.Promise` object that is returned will be rejected. If the user cancels the operation, then a `IPCC.Error` object will be returned as the rejection reason and its code property will be set to UserCancelled.
Returns:
The cancelled request.
Type
IPCC.LoadMarkupLayersRequest
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
loadMarkupLayersRequest.cancel();

getErrorCode() → {string}

Gets the error code for the load request, in cases where the request has failed.
Returns:
A value for programmatic identification of an error condition, or null if an error has not occurred.
Type
string
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var errorCode = loadMarkupLayersRequest.getErrorCode();

getProgress() → {number}

Gets the currently known loading progress value.
Returns:
A number between 0 and 100 (inclusive). A value of 100 means the loading process completed.
Type
number
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var percent = loadMarkupLayersRequest.getProgress();

getViewerControl() → {IPCC.ViewerControl}

Gets the viewer control associated with this request.
Returns:
A viewer control object.
Type
IPCC.ViewerControl
Example
var loadMarkupLayersRequest = viewerControl.loadMarkupLayers(['abc123']);
var viewerControl = loadMarkupLayersRequest.getViewerControl();

off(eventType) → {IPCC.LoadMarkupLayersRequest}

Unsubscribe an event handler from a specified event type. Typically, an event is unsubscribed when you no longer want further notification of the event.
Parameters:
Name Type Description
eventType string A string specifying the event type. See IPCC.LoadMarkupLayersRequest.EventType for a list and description of all supported events.
`IPCC.Event~eventHandler` handler A function that was attached previously to the `ViewerControl`. **Note:** This must be the same function object previously passed to IPCC.LoadMarkupLayersRequest#on. It cannot be a different object that is functionally equivalent.
See:
Returns:
The `LoadMarkupLayersRequest` object on which this method was called.
Type
IPCC.LoadMarkupLayersRequest

on(eventType) → {IPCC.LoadMarkupLayersRequest}

Subscribe an event handler to an event of a specified type.
Parameters:
Name Type Description
eventType string A string that specifies the event type. This value is case-insensitive. See IPCC.LoadMarkupLayersRequest.EventType for a list and description of all supported events.
`IPCC.Event~eventHandler` handler A function that will be called whenever the event is triggered.
See:
Returns:
The `LoadMarkupLayersRequest` object on which this method was called.
Type
IPCC.LoadMarkupLayersRequest