DocumentLoadMode Enumeration

Summary

Load document mode.

Syntax
TypeScript
JavaScript
lt.Document.DocumentLoadMode = { 
   service: 0, 
   local: 1, 
   localThenService: 2 
} 
lt.Document.DocumentLoadMode = { 
   service: 0, 
   local: 1, 
   localThenService: 2 
} 

Members

ValueMemberDescription
service0Always call the service. This is default behavior.
local1Try to load the document locally in the client without calling the service.
localThenService2Try to load the document locally, if it fails, try to load it using the service.

Remarks

DocumentLoadMode is used as the type for the LoadDocumentOptions.loadMode property.

The document library supports loading some file formats locally without requiring a service. Currently this support is limited to the following:

  • PDF: Adobe Portable Document Format

  • JPEG, PNG and GIF: Standard web formats and any other file format supported natively by the browser.

Later versions of the document library will add support for more formats.

Documents are loaded from external URL or files using DocumentFactory.loadFromUri or DocumentFactory.loadFromUri. Both of these methods accept parameter options of type LoadDocumentOptions which contains the loadMode property.

The default value of this property is DocumentLoadMode.service. This instructs the library to load the document using the document service (set in DocumentFactory.serviceHost).

When the value of loadMode is set to local, the library tries to load the URL or file without contacting the service. The data in the file must be one of the supported file formats described above otherwise the load operation fails.

When the value of loadMode is set to localThenService, the library tries to load the URL or file without contacting the service (similar to local). If not successful, it then tries to load the file using the service (similar to service).

Local documents that are loaded successfully cannot be shared in a multi-user application and only exist in the local browser. The document library will automatically upload the document to the service when operations such as DocumentFactory.saveToCache (to save it to the cache) or StatusJobDataRunner are used (to convert it to a different file format).

Some JavaScript environments do not support loading external resources at all. Other environments require CORS support on the server that the original resource might not provide. Therefore, a proxy may be required to redirect the calls between DocumentFactory and the external resources. The application can use any standard CORS proxy and set its template in DocumentFactory.localProxyUrlTemplate. The LEADTOOLS Document Service provides such a proxy that can be used. Refer to any of the DocumentService examples in your LEADTOOLS installation for more information.

Requirements

Target Platforms

See Also

Reference

lt.Document Namespace

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

Leadtools.Document Assembly