Using jQuery Promises in the Document Library

Operations to contact the LEADTOOLS Document Service return a jQuery Promise object that must be used to act on events from the service call. The done, fail, progress, and always methods are used to attach event handlers to events.

The Fail Callback

If an error occurs during any service call, the fail callback handler will execute all registered functions with the three parameters normally returned by a failed jQuery Ajax call:

If the error occurred within the Document Service, all three of these parameters should have values. If the error occurred while parsing or delivering the data, only errorThrown, the third argument, will have a value. If an UploadFile service call was aborted using the special abort method, all of the parameters to the fail callback will be null.

The jqXHR object, if not null, may contain data used for creating a ServiceError object, which would include debugging information and messages to be displayed to the user. For more information, see ParseError. If an error occurs, the value sent through the request will be set in the ServiceError.UserData property of the object returned from ParseError.

The jQuery Promise object is a subset of the jQuery Deferred object. Refer to the jQuery documentation for more information on Promises and the Deferred object.

The PrepareAjax event occurs before any request made by the document library client-side code to the server. This allows users to examine or modify the parameters passed. The event data contains detailed information on the call as well as the JQueryAjaxSettings object being used. Any changes made to that object will be used in the request. For example, this will allow users to modify the headers of any request to set authorization headers as they wish.

The Document Service supports a "Service Heartbeat" feature. The defaults for this feature can be configured from each client application's "serviceConfig.json" file in the "heartbeatDefaults". If a timeout occurs, the IsTimeoutError value will be set to true.

Reference

Document Library Features

Documents Viewer Application

Loading Documents Using LEADTOOLS Document Library

Creating Documents with LEADTOOLS Document Library

Document Toolkit and Caching

Uploading Using the Document Library

Document Library Coordinate System

Loading Encrypted Files Using the Document Library

Parsing Text with the Document Library

Barcode Processing with the Document Library

Loading Images in the Document Library

Document Page Transformation

Using LEADTOOLS Document Viewer

Status Document Job Converter

Document View and Convert Redaction

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS HTML5 JavaScript