timeoutMilliseconds Property

Summary

Timeout in milliseconds to abort loading slow documents.

Syntax
TypeScript
JavaScript
Object.defineProperty(LoadDocumentOptions.prototype, 'timeoutMilliseconds', 
   get: function(), 
   set: function(value) 
) 
timeoutMilliseconds: number; 

Property Value

Timeout in milliseconds to abort loading slow documents. The default value is 0.

Remarks

The default value is 0, meaning there is no timeout set and the DocumentFactory will try to load slow documents regardless of how long it takes.

Complex document file formats such as DOCX and XSLX may require significantly more time to parse the file structure than simple formats. The amount of time depends on the source file itself, and for very complex document files such as a very large XLSX spreadsheet with thousands or millions of rows, the time can be in seconds or even minutes. DocumentFactory.loadFromUri will not return till all the file data is parsed.

For such kinds of documents, using the timeoutMilliseconds allow the user to abort long loading operations if required. After the allocated timeout has passed, DocumentFactory will abort the load operation and return null instead of a valid LEADDocument from loadFromUri.

In other words, aborting a loading operation does not throw an exception. Instead, the application should check the returned LEADDocument for null to detect when the user aborted.

Note that timeoutMilliseconds is an approximate value and only measures the time it took the engine to extract information about the document such as its format, number of pages, and the size of each page. Times for other operations such as downloading the image data from an external URL are not included in timeoutMilliseconds.

Some applications may have a requirement to abort all loading operations that take more than a certain amount of time (for example, a web server using LEADTOOLS to load documents in a web method). This server may require that all operations running within the web method take no more than 2 seconds. When this occurs, the operation should be aborted, and the work delegated to a dedicated thread or process outside of the web service worker thread.

Requirements

Target Platforms

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

Leadtools.Document Assembly